diff options
Diffstat (limited to 'contrib/libc++/include/iterator')
-rw-r--r-- | contrib/libc++/include/iterator | 513 |
1 files changed, 280 insertions, 233 deletions
diff --git a/contrib/libc++/include/iterator b/contrib/libc++/include/iterator index 0caabbb..b8f6570 100644 --- a/contrib/libc++/include/iterator +++ b/contrib/libc++/include/iterator @@ -89,57 +89,60 @@ public: typedef typename iterator_traits<Iterator>::reference reference; typedef typename iterator_traits<Iterator>::pointer pointer; - reverse_iterator(); - explicit reverse_iterator(Iterator x); - template <class U> reverse_iterator(const reverse_iterator<U>& u); - Iterator base() const; - reference operator*() const; - pointer operator->() const; - reverse_iterator& operator++(); - reverse_iterator operator++(int); - reverse_iterator& operator--(); - reverse_iterator operator--(int); - reverse_iterator operator+ (difference_type n) const; - reverse_iterator& operator+=(difference_type n); - reverse_iterator operator- (difference_type n) const; - reverse_iterator& operator-=(difference_type n); - reference operator[](difference_type n) const; + constexpr reverse_iterator(); + constexpr explicit reverse_iterator(Iterator x); + template <class U> constexpr reverse_iterator(const reverse_iterator<U>& u); + template <class U> constexpr reverse_iterator& operator=(const reverse_iterator<U>& u); + constexpr Iterator base() const; + constexpr reference operator*() const; + constexpr pointer operator->() const; + constexpr reverse_iterator& operator++(); + constexpr reverse_iterator operator++(int); + constexpr reverse_iterator& operator--(); + constexpr reverse_iterator operator--(int); + constexpr reverse_iterator operator+ (difference_type n) const; + constexpr reverse_iterator& operator+=(difference_type n); + constexpr reverse_iterator operator- (difference_type n) const; + constexpr reverse_iterator& operator-=(difference_type n); + constexpr reference operator[](difference_type n) const; }; template <class Iterator1, class Iterator2> -bool +constexpr bool // constexpr in C++17 operator==(const reverse_iterator<Iterator1>& x, const reverse_iterator<Iterator2>& y); template <class Iterator1, class Iterator2> -bool +constexpr bool // constexpr in C++17 operator<(const reverse_iterator<Iterator1>& x, const reverse_iterator<Iterator2>& y); template <class Iterator1, class Iterator2> -bool +constexpr bool // constexpr in C++17 operator!=(const reverse_iterator<Iterator1>& x, const reverse_iterator<Iterator2>& y); template <class Iterator1, class Iterator2> -bool +constexpr bool // constexpr in C++17 operator>(const reverse_iterator<Iterator1>& x, const reverse_iterator<Iterator2>& y); template <class Iterator1, class Iterator2> -bool +constexpr bool // constexpr in C++17 operator>=(const reverse_iterator<Iterator1>& x, const reverse_iterator<Iterator2>& y); template <class Iterator1, class Iterator2> -bool +constexpr bool // constexpr in C++17 operator<=(const reverse_iterator<Iterator1>& x, const reverse_iterator<Iterator2>& y); template <class Iterator1, class Iterator2> -auto +constexpr auto operator-(const reverse_iterator<Iterator1>& x, const reverse_iterator<Iterator2>& y) --> decltype(__y.base() - __x.base()); +-> decltype(__y.base() - __x.base()); // constexpr in C++17 template <class Iterator> -reverse_iterator<Iterator> -operator+(typename reverse_iterator<Iterator>::difference_type n, const reverse_iterator<Iterator>& x); +constexpr reverse_iterator<Iterator> +operator+(typename reverse_iterator<Iterator>::difference_type n, + const reverse_iterator<Iterator>& x); // constexpr in C++17 -template <class Iterator> reverse_iterator<Iterator> make_reverse_iterator(Iterator i); // C++14 +template <class Iterator> +constexpr reverse_iterator<Iterator> make_reverse_iterator(Iterator i); // C++14, constexpr in C++17 template <class Container> class back_insert_iterator @@ -216,61 +219,64 @@ public: typedef typename iterator_traits<Iterator>::iterator_category iterator_category; typedef value_type&& reference; - move_iterator(); - explicit move_iterator(Iterator i); - template <class U> move_iterator(const move_iterator<U>& u); - template <class U> move_iterator& operator=(const move_iterator<U>& u); - iterator_type base() const; - reference operator*() const; - pointer operator->() const; - move_iterator& operator++(); - move_iterator operator++(int); - move_iterator& operator--(); - move_iterator operator--(int); - move_iterator operator+(difference_type n) const; - move_iterator& operator+=(difference_type n); - move_iterator operator-(difference_type n) const; - move_iterator& operator-=(difference_type n); - unspecified operator[](difference_type n) const; + constexpr move_iterator(); // all the constexprs are in C++17 + constexpr explicit move_iterator(Iterator i); + template <class U> + constexpr move_iterator(const move_iterator<U>& u); + template <class U> + constexpr move_iterator& operator=(const move_iterator<U>& u); + constexpr iterator_type base() const; + constexpr reference operator*() const; + constexpr pointer operator->() const; + constexpr move_iterator& operator++(); + constexpr move_iterator operator++(int); + constexpr move_iterator& operator--(); + constexpr move_iterator operator--(int); + constexpr move_iterator operator+(difference_type n) const; + constexpr move_iterator& operator+=(difference_type n); + constexpr move_iterator operator-(difference_type n) const; + constexpr move_iterator& operator-=(difference_type n); + constexpr unspecified operator[](difference_type n) const; private: Iterator current; // exposition only }; template <class Iterator1, class Iterator2> -bool +constexpr bool // constexpr in C++17 operator==(const move_iterator<Iterator1>& x, const move_iterator<Iterator2>& y); template <class Iterator1, class Iterator2> -bool +constexpr bool // constexpr in C++17 operator!=(const move_iterator<Iterator1>& x, const move_iterator<Iterator2>& y); template <class Iterator1, class Iterator2> -bool +constexpr bool // constexpr in C++17 operator<(const move_iterator<Iterator1>& x, const move_iterator<Iterator2>& y); template <class Iterator1, class Iterator2> -bool +constexpr bool // constexpr in C++17 operator<=(const move_iterator<Iterator1>& x, const move_iterator<Iterator2>& y); template <class Iterator1, class Iterator2> -bool +constexpr bool // constexpr in C++17 operator>(const move_iterator<Iterator1>& x, const move_iterator<Iterator2>& y); template <class Iterator1, class Iterator2> -bool +constexpr bool // constexpr in C++17 operator>=(const move_iterator<Iterator1>& x, const move_iterator<Iterator2>& y); template <class Iterator1, class Iterator2> -auto +constexpr auto // constexpr in C++17 operator-(const move_iterator<Iterator1>& x, const move_iterator<Iterator2>& y) -> decltype(x.base() - y.base()); template <class Iterator> -move_iterator<Iterator> operator+(typename move_iterator<Iterator>::difference_type n, - const move_iterator<Iterator>& x); +constexpr move_iterator<Iterator> operator+( // constexpr in C++17 + typename move_iterator<Iterator>::difference_type n, + const move_iterator<Iterator>& x); -template <class Iterator> -move_iterator<Iterator> make_move_iterator(const Iterator& i); +template <class Iterator> // constexpr in C++17 +constexpr move_iterator<Iterator> make_move_iterator(const Iterator& i); template <class T, class charT = char, class traits = char_traits<charT>, class Distance = ptrdiff_t> @@ -372,25 +378,25 @@ public: bool failed() const noexcept; }; -template <class C> auto begin(C& c) -> decltype(c.begin()); -template <class C> auto begin(const C& c) -> decltype(c.begin()); -template <class C> auto end(C& c) -> decltype(c.end()); -template <class C> auto end(const C& c) -> decltype(c.end()); -template <class T, size_t N> T* begin(T (&array)[N]); -template <class T, size_t N> T* end(T (&array)[N]); - -template <class C> auto cbegin(const C& c) -> decltype(std::begin(c)); // C++14 -template <class C> auto cend(const C& c) -> decltype(std::end(c)); // C++14 -template <class C> auto rbegin(C& c) -> decltype(c.rbegin()); // C++14 -template <class C> auto rbegin(const C& c) -> decltype(c.rbegin()); // C++14 -template <class C> auto rend(C& c) -> decltype(c.rend()); // C++14 -template <class C> auto rend(const C& c) -> decltype(c.rend()); // C++14 -template <class E> reverse_iterator<const E*> rbegin(initializer_list<E> il); // C++14 -template <class E> reverse_iterator<const E*> rend(initializer_list<E> il); // C++14 -template <class T, size_t N> reverse_iterator<T*> rbegin(T (&array)[N]); // C++14 -template <class T, size_t N> reverse_iterator<T*> rend(T (&array)[N]); // C++14 -template <class C> auto crbegin(const C& c) -> decltype(std::rbegin(c)); // C++14 -template <class C> auto crend(const C& c) -> decltype(std::rend(c)); // C++14 +template <class C> constexpr auto begin(C& c) -> decltype(c.begin()); +template <class C> constexpr auto begin(const C& c) -> decltype(c.begin()); +template <class C> constexpr auto end(C& c) -> decltype(c.end()); +template <class C> constexpr auto end(const C& c) -> decltype(c.end()); +template <class T, size_t N> constexpr T* begin(T (&array)[N]); +template <class T, size_t N> constexpr T* end(T (&array)[N]); + +template <class C> auto constexpr cbegin(const C& c) -> decltype(std::begin(c)); // C++14 +template <class C> auto constexpr cend(const C& c) -> decltype(std::end(c)); // C++14 +template <class C> auto constexpr rbegin(C& c) -> decltype(c.rbegin()); // C++14 +template <class C> auto constexpr rbegin(const C& c) -> decltype(c.rbegin()); // C++14 +template <class C> auto constexpr rend(C& c) -> decltype(c.rend()); // C++14 +template <class C> constexpr auto rend(const C& c) -> decltype(c.rend()); // C++14 +template <class E> reverse_iterator<const E*> constexpr rbegin(initializer_list<E> il); // C++14 +template <class E> reverse_iterator<const E*> constexpr rend(initializer_list<E> il); // C++14 +template <class T, size_t N> reverse_iterator<T*> constexpr rbegin(T (&array)[N]); // C++14 +template <class T, size_t N> reverse_iterator<T*> constexpr rend(T (&array)[N]); // C++14 +template <class C> constexpr auto crbegin(const C& c) -> decltype(std::rbegin(c)); // C++14 +template <class C> constexpr auto crend(const C& c) -> decltype(std::rend(c)); // C++14 // 24.8, container access: template <class C> constexpr auto size(const C& c) -> decltype(c.size()); // C++17 @@ -425,11 +431,11 @@ template <class E> constexpr const E* data(initializer_list<E> il) noexcept; _LIBCPP_BEGIN_NAMESPACE_STD -struct _LIBCPP_TYPE_VIS_ONLY input_iterator_tag {}; -struct _LIBCPP_TYPE_VIS_ONLY output_iterator_tag {}; -struct _LIBCPP_TYPE_VIS_ONLY forward_iterator_tag : public input_iterator_tag {}; -struct _LIBCPP_TYPE_VIS_ONLY bidirectional_iterator_tag : public forward_iterator_tag {}; -struct _LIBCPP_TYPE_VIS_ONLY random_access_iterator_tag : public bidirectional_iterator_tag {}; +struct _LIBCPP_TEMPLATE_VIS input_iterator_tag {}; +struct _LIBCPP_TEMPLATE_VIS output_iterator_tag {}; +struct _LIBCPP_TEMPLATE_VIS forward_iterator_tag : public input_iterator_tag {}; +struct _LIBCPP_TEMPLATE_VIS bidirectional_iterator_tag : public forward_iterator_tag {}; +struct _LIBCPP_TEMPLATE_VIS random_access_iterator_tag : public bidirectional_iterator_tag {}; template <class _Tp> struct __has_iterator_category @@ -472,11 +478,11 @@ struct __iterator_traits<_Iter, true> // the client expects instead of failing at compile time. template <class _Iter> -struct _LIBCPP_TYPE_VIS_ONLY iterator_traits +struct _LIBCPP_TEMPLATE_VIS iterator_traits : __iterator_traits<_Iter, __has_iterator_category<_Iter>::value> {}; template<class _Tp> -struct _LIBCPP_TYPE_VIS_ONLY iterator_traits<_Tp*> +struct _LIBCPP_TEMPLATE_VIS iterator_traits<_Tp*> { typedef ptrdiff_t difference_type; typedef typename remove_const<_Tp>::type value_type; @@ -508,12 +514,12 @@ struct __is_random_access_iterator : public __has_iterator_category_convertible_ template <class _Tp> struct __is_exactly_input_iterator : public integral_constant<bool, - __has_iterator_category_convertible_to<_Tp, input_iterator_tag>::value && - !__has_iterator_category_convertible_to<_Tp, forward_iterator_tag>::value> {}; + __has_iterator_category_convertible_to<_Tp, input_iterator_tag>::value && + !__has_iterator_category_convertible_to<_Tp, forward_iterator_tag>::value> {}; template<class _Category, class _Tp, class _Distance = ptrdiff_t, class _Pointer = _Tp*, class _Reference = _Tp&> -struct _LIBCPP_TYPE_VIS_ONLY iterator +struct _LIBCPP_TEMPLATE_VIS iterator { typedef _Tp value_type; typedef _Distance difference_type; @@ -610,7 +616,7 @@ prev(_BidiretionalIter __x, } template <class _Iter> -class _LIBCPP_TYPE_VIS_ONLY reverse_iterator +class _LIBCPP_TEMPLATE_VIS reverse_iterator : public iterator<typename iterator_traits<_Iter>::iterator_category, typename iterator_traits<_Iter>::value_type, typename iterator_traits<_Iter>::difference_type, @@ -618,7 +624,7 @@ class _LIBCPP_TYPE_VIS_ONLY reverse_iterator typename iterator_traits<_Iter>::reference> { private: - mutable _Iter __t; // no longer used as of LWG #2360, not removed due to ABI break + /*mutable*/ _Iter __t; // no longer used as of LWG #2360, not removed due to ABI break protected: _Iter current; public: @@ -627,33 +633,45 @@ public: typedef typename iterator_traits<_Iter>::reference reference; typedef typename iterator_traits<_Iter>::pointer pointer; - _LIBCPP_INLINE_VISIBILITY reverse_iterator() : current() {} - _LIBCPP_INLINE_VISIBILITY explicit reverse_iterator(_Iter __x) : __t(__x), current(__x) {} - template <class _Up> _LIBCPP_INLINE_VISIBILITY reverse_iterator(const reverse_iterator<_Up>& __u) - : __t(__u.base()), current(__u.base()) {} - _LIBCPP_INLINE_VISIBILITY _Iter base() const {return current;} - _LIBCPP_INLINE_VISIBILITY reference operator*() const {_Iter __tmp = current; return *--__tmp;} - _LIBCPP_INLINE_VISIBILITY pointer operator->() const {return _VSTD::addressof(operator*());} - _LIBCPP_INLINE_VISIBILITY reverse_iterator& operator++() {--current; return *this;} - _LIBCPP_INLINE_VISIBILITY reverse_iterator operator++(int) - {reverse_iterator __tmp(*this); --current; return __tmp;} - _LIBCPP_INLINE_VISIBILITY reverse_iterator& operator--() {++current; return *this;} - _LIBCPP_INLINE_VISIBILITY reverse_iterator operator--(int) - {reverse_iterator __tmp(*this); ++current; return __tmp;} - _LIBCPP_INLINE_VISIBILITY reverse_iterator operator+ (difference_type __n) const - {return reverse_iterator(current - __n);} - _LIBCPP_INLINE_VISIBILITY reverse_iterator& operator+=(difference_type __n) - {current -= __n; return *this;} - _LIBCPP_INLINE_VISIBILITY reverse_iterator operator- (difference_type __n) const - {return reverse_iterator(current + __n);} - _LIBCPP_INLINE_VISIBILITY reverse_iterator& operator-=(difference_type __n) - {current += __n; return *this;} - _LIBCPP_INLINE_VISIBILITY reference operator[](difference_type __n) const - {return *(*this + __n);} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 + reverse_iterator() : __t(), current() {} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 + explicit reverse_iterator(_Iter __x) : __t(__x), current(__x) {} + template <class _Up> + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 + reverse_iterator(const reverse_iterator<_Up>& __u) : __t(__u.base()), current(__u.base()) {} + template <class _Up> + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 + reverse_iterator& operator=(const reverse_iterator<_Up>& __u) + { __t = current = __u.base(); return *this; } + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 + _Iter base() const {return current;} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 + reference operator*() const {_Iter __tmp = current; return *--__tmp;} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 + pointer operator->() const {return _VSTD::addressof(operator*());} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 + reverse_iterator& operator++() {--current; return *this;} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 + reverse_iterator operator++(int) {reverse_iterator __tmp(*this); --current; return __tmp;} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 + reverse_iterator& operator--() {++current; return *this;} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 + reverse_iterator operator--(int) {reverse_iterator __tmp(*this); ++current; return __tmp;} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 + reverse_iterator operator+ (difference_type __n) const {return reverse_iterator(current - __n);} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 + reverse_iterator& operator+=(difference_type __n) {current -= __n; return *this;} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 + reverse_iterator operator- (difference_type __n) const {return reverse_iterator(current + __n);} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 + reverse_iterator& operator-=(difference_type __n) {current += __n; return *this;} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 + reference operator[](difference_type __n) const {return *(*this + __n);} }; template <class _Iter1, class _Iter2> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 bool operator==(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y) { @@ -661,7 +679,7 @@ operator==(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& } template <class _Iter1, class _Iter2> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 bool operator<(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y) { @@ -669,7 +687,7 @@ operator<(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& _ } template <class _Iter1, class _Iter2> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 bool operator!=(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y) { @@ -677,7 +695,7 @@ operator!=(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& } template <class _Iter1, class _Iter2> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 bool operator>(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y) { @@ -685,7 +703,7 @@ operator>(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& _ } template <class _Iter1, class _Iter2> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 bool operator>=(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y) { @@ -693,7 +711,7 @@ operator>=(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& } template <class _Iter1, class _Iter2> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 bool operator<=(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y) { @@ -702,7 +720,7 @@ operator<=(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& #ifndef _LIBCPP_CXX03_LANG template <class _Iter1, class _Iter2> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 auto operator-(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y) -> decltype(__y.base() - __x.base()) @@ -720,7 +738,7 @@ operator-(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& _ #endif template <class _Iter> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 reverse_iterator<_Iter> operator+(typename reverse_iterator<_Iter>::difference_type __n, const reverse_iterator<_Iter>& __x) { @@ -729,7 +747,7 @@ operator+(typename reverse_iterator<_Iter>::difference_type __n, const reverse_i #if _LIBCPP_STD_VER > 11 template <class _Iter> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 reverse_iterator<_Iter> make_reverse_iterator(_Iter __i) { return reverse_iterator<_Iter>(__i); @@ -737,7 +755,7 @@ reverse_iterator<_Iter> make_reverse_iterator(_Iter __i) #endif template <class _Container> -class _LIBCPP_TYPE_VIS_ONLY back_insert_iterator +class _LIBCPP_TEMPLATE_VIS back_insert_iterator : public iterator<output_iterator_tag, void, void, @@ -770,7 +788,7 @@ back_inserter(_Container& __x) } template <class _Container> -class _LIBCPP_TYPE_VIS_ONLY front_insert_iterator +class _LIBCPP_TEMPLATE_VIS front_insert_iterator : public iterator<output_iterator_tag, void, void, @@ -803,7 +821,7 @@ front_inserter(_Container& __x) } template <class _Container> -class _LIBCPP_TYPE_VIS_ONLY insert_iterator +class _LIBCPP_TEMPLATE_VIS insert_iterator : public iterator<output_iterator_tag, void, void, @@ -839,7 +857,7 @@ inserter(_Container& __x, typename _Container::iterator __i) template <class _Tp, class _CharT = char, class _Traits = char_traits<_CharT>, class _Distance = ptrdiff_t> -class _LIBCPP_TYPE_VIS_ONLY istream_iterator +class _LIBCPP_TEMPLATE_VIS istream_iterator : public iterator<input_iterator_tag, _Tp, _Distance, const _Tp*, const _Tp&> { public: @@ -878,7 +896,7 @@ public: }; template <class _Tp, class _CharT = char, class _Traits = char_traits<_CharT> > -class _LIBCPP_TYPE_VIS_ONLY ostream_iterator +class _LIBCPP_TEMPLATE_VIS ostream_iterator : public iterator<output_iterator_tag, void, void, void, void> { public: @@ -889,9 +907,9 @@ private: ostream_type* __out_stream_; const char_type* __delim_; public: - _LIBCPP_INLINE_VISIBILITY ostream_iterator(ostream_type& __s) + _LIBCPP_INLINE_VISIBILITY ostream_iterator(ostream_type& __s) _NOEXCEPT : __out_stream_(_VSTD::addressof(__s)), __delim_(0) {} - _LIBCPP_INLINE_VISIBILITY ostream_iterator(ostream_type& __s, const _CharT* __delimiter) + _LIBCPP_INLINE_VISIBILITY ostream_iterator(ostream_type& __s, const _CharT* __delimiter) _NOEXCEPT : __out_stream_(_VSTD::addressof(__s)), __delim_(__delimiter) {} _LIBCPP_INLINE_VISIBILITY ostream_iterator& operator=(const _Tp& __value_) { @@ -907,7 +925,7 @@ public: }; template<class _CharT, class _Traits> -class _LIBCPP_TYPE_VIS_ONLY istreambuf_iterator +class _LIBCPP_TEMPLATE_VIS istreambuf_iterator : public iterator<input_iterator_tag, _CharT, typename _Traits::off_type, _CharT*, _CharT> @@ -978,7 +996,7 @@ bool operator!=(const istreambuf_iterator<_CharT,_Traits>& __a, {return !__a.equal(__b);} template <class _CharT, class _Traits> -class _LIBCPP_TYPE_VIS_ONLY ostreambuf_iterator +class _LIBCPP_TEMPLATE_VIS ostreambuf_iterator : public iterator<output_iterator_tag, void, void, void, void> { public: @@ -1019,7 +1037,7 @@ public: }; template <class _Iter> -class _LIBCPP_TYPE_VIS_ONLY move_iterator +class _LIBCPP_TEMPLATE_VIS move_iterator { private: _Iter __i; @@ -1040,37 +1058,40 @@ public: typedef typename iterator_traits<iterator_type>::reference reference; #endif - _LIBCPP_INLINE_VISIBILITY move_iterator() : __i() {} - _LIBCPP_INLINE_VISIBILITY explicit move_iterator(_Iter __x) : __i(__x) {} - template <class _Up> _LIBCPP_INLINE_VISIBILITY move_iterator(const move_iterator<_Up>& __u) - : __i(__u.base()) {} - _LIBCPP_INLINE_VISIBILITY _Iter base() const {return __i;} - _LIBCPP_INLINE_VISIBILITY reference operator*() const { - return static_cast<reference>(*__i); - } - _LIBCPP_INLINE_VISIBILITY pointer operator->() const { return __i;} - _LIBCPP_INLINE_VISIBILITY move_iterator& operator++() {++__i; return *this;} - _LIBCPP_INLINE_VISIBILITY move_iterator operator++(int) - {move_iterator __tmp(*this); ++__i; return __tmp;} - _LIBCPP_INLINE_VISIBILITY move_iterator& operator--() {--__i; return *this;} - _LIBCPP_INLINE_VISIBILITY move_iterator operator--(int) - {move_iterator __tmp(*this); --__i; return __tmp;} - _LIBCPP_INLINE_VISIBILITY move_iterator operator+ (difference_type __n) const - {return move_iterator(__i + __n);} - _LIBCPP_INLINE_VISIBILITY move_iterator& operator+=(difference_type __n) - {__i += __n; return *this;} - _LIBCPP_INLINE_VISIBILITY move_iterator operator- (difference_type __n) const - {return move_iterator(__i - __n);} - _LIBCPP_INLINE_VISIBILITY move_iterator& operator-=(difference_type __n) - {__i -= __n; return *this;} - _LIBCPP_INLINE_VISIBILITY reference operator[](difference_type __n) const - { - return static_cast<reference>(__i[__n]); - } + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 + move_iterator() : __i() {} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 + explicit move_iterator(_Iter __x) : __i(__x) {} + template <class _Up> + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 + move_iterator(const move_iterator<_Up>& __u) : __i(__u.base()) {} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 _Iter base() const {return __i;} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 + reference operator*() const { return static_cast<reference>(*__i); } + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 + pointer operator->() const { return __i;} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 + move_iterator& operator++() {++__i; return *this;} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 + move_iterator operator++(int) {move_iterator __tmp(*this); ++__i; return __tmp;} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 + move_iterator& operator--() {--__i; return *this;} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 + move_iterator operator--(int) {move_iterator __tmp(*this); --__i; return __tmp;} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 + move_iterator operator+ (difference_type __n) const {return move_iterator(__i + __n);} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 + move_iterator& operator+=(difference_type __n) {__i += __n; return *this;} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 + move_iterator operator- (difference_type __n) const {return move_iterator(__i - __n);} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 + move_iterator& operator-=(difference_type __n) {__i -= __n; return *this;} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 + reference operator[](difference_type __n) const { return static_cast<reference>(__i[__n]); } }; template <class _Iter1, class _Iter2> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 bool operator==(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y) { @@ -1078,7 +1099,7 @@ operator==(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y) } template <class _Iter1, class _Iter2> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 bool operator<(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y) { @@ -1086,7 +1107,7 @@ operator<(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y) } template <class _Iter1, class _Iter2> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 bool operator!=(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y) { @@ -1094,7 +1115,7 @@ operator!=(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y) } template <class _Iter1, class _Iter2> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 bool operator>(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y) { @@ -1102,7 +1123,7 @@ operator>(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y) } template <class _Iter1, class _Iter2> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 bool operator>=(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y) { @@ -1110,7 +1131,7 @@ operator>=(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y) } template <class _Iter1, class _Iter2> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 bool operator<=(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y) { @@ -1119,7 +1140,7 @@ operator<=(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y) #ifndef _LIBCPP_CXX03_LANG template <class _Iter1, class _Iter2> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 auto operator-(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y) -> decltype(__x.base() - __y.base()) @@ -1137,7 +1158,7 @@ operator-(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y) #endif template <class _Iter> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 move_iterator<_Iter> operator+(typename move_iterator<_Iter>::difference_type __n, const move_iterator<_Iter>& __x) { @@ -1145,7 +1166,7 @@ operator+(typename move_iterator<_Iter>::difference_type __n, const move_iterato } template <class _Iter> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 move_iterator<_Iter> make_move_iterator(_Iter __i) { @@ -1159,56 +1180,58 @@ template <class _Iter> class __wrap_iter; template <class _Iter1, class _Iter2> _LIBCPP_INLINE_VISIBILITY bool -operator==(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT; +operator==(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT_DEBUG; template <class _Iter1, class _Iter2> _LIBCPP_INLINE_VISIBILITY bool -operator<(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT; +operator<(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT_DEBUG; template <class _Iter1, class _Iter2> _LIBCPP_INLINE_VISIBILITY bool -operator!=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT; +operator!=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT_DEBUG; template <class _Iter1, class _Iter2> _LIBCPP_INLINE_VISIBILITY bool -operator>(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT; +operator>(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT_DEBUG; template <class _Iter1, class _Iter2> _LIBCPP_INLINE_VISIBILITY bool -operator>=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT; +operator>=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT_DEBUG; template <class _Iter1, class _Iter2> _LIBCPP_INLINE_VISIBILITY bool -operator<=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT; +operator<=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT_DEBUG; #ifndef _LIBCPP_CXX03_LANG template <class _Iter1, class _Iter2> _LIBCPP_INLINE_VISIBILITY auto -operator-(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT +operator-(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT_DEBUG -> decltype(__x.base() - __y.base()); #else template <class _Iter1, class _Iter2> _LIBCPP_INLINE_VISIBILITY typename __wrap_iter<_Iter1>::difference_type -operator-(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT; +operator-(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT_DEBUG; #endif template <class _Iter> _LIBCPP_INLINE_VISIBILITY __wrap_iter<_Iter> -operator+(typename __wrap_iter<_Iter>::difference_type, __wrap_iter<_Iter>) _NOEXCEPT; +operator+(typename __wrap_iter<_Iter>::difference_type, __wrap_iter<_Iter>) _NOEXCEPT_DEBUG; template <class _Ip, class _Op> _Op _LIBCPP_INLINE_VISIBILITY copy(_Ip, _Ip, _Op); template <class _B1, class _B2> _B2 _LIBCPP_INLINE_VISIBILITY copy_backward(_B1, _B1, _B2); template <class _Ip, class _Op> _Op _LIBCPP_INLINE_VISIBILITY move(_Ip, _Ip, _Op); template <class _B1, class _B2> _B2 _LIBCPP_INLINE_VISIBILITY move_backward(_B1, _B1, _B2); +#if _LIBCPP_DEBUG_LEVEL < 2 + template <class _Tp> _LIBCPP_INLINE_VISIBILITY typename enable_if @@ -1218,6 +1241,19 @@ typename enable_if >::type __unwrap_iter(__wrap_iter<_Tp*>); +#else + +template <class _Tp> +inline _LIBCPP_INLINE_VISIBILITY +typename enable_if +< + is_trivially_copy_assignable<_Tp>::value, + __wrap_iter<_Tp*> +>::type +__unwrap_iter(__wrap_iter<_Tp*> __i); + +#endif + template <class _Iter> class __wrap_iter { @@ -1231,7 +1267,7 @@ public: private: iterator_type __i; public: - _LIBCPP_INLINE_VISIBILITY __wrap_iter() _NOEXCEPT + _LIBCPP_INLINE_VISIBILITY __wrap_iter() _NOEXCEPT_DEBUG #if _LIBCPP_STD_VER > 11 : __i{} #endif @@ -1241,7 +1277,7 @@ public: #endif } template <class _Up> _LIBCPP_INLINE_VISIBILITY __wrap_iter(const __wrap_iter<_Up>& __u, - typename enable_if<is_convertible<_Up, iterator_type>::value>::type* = 0) _NOEXCEPT + typename enable_if<is_convertible<_Up, iterator_type>::value>::type* = 0) _NOEXCEPT_DEBUG : __i(__u.base()) { #if _LIBCPP_DEBUG_LEVEL >= 2 @@ -1271,7 +1307,7 @@ public: __get_db()->__erase_i(this); } #endif - _LIBCPP_INLINE_VISIBILITY reference operator*() const _NOEXCEPT + _LIBCPP_INLINE_VISIBILITY reference operator*() const _NOEXCEPT_DEBUG { #if _LIBCPP_DEBUG_LEVEL >= 2 _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this), @@ -1279,7 +1315,7 @@ public: #endif return *__i; } - _LIBCPP_INLINE_VISIBILITY pointer operator->() const _NOEXCEPT + _LIBCPP_INLINE_VISIBILITY pointer operator->() const _NOEXCEPT_DEBUG { #if _LIBCPP_DEBUG_LEVEL >= 2 _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this), @@ -1287,7 +1323,7 @@ public: #endif return (pointer)_VSTD::addressof(*__i); } - _LIBCPP_INLINE_VISIBILITY __wrap_iter& operator++() _NOEXCEPT + _LIBCPP_INLINE_VISIBILITY __wrap_iter& operator++() _NOEXCEPT_DEBUG { #if _LIBCPP_DEBUG_LEVEL >= 2 _LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this), @@ -1296,9 +1332,9 @@ public: ++__i; return *this; } - _LIBCPP_INLINE_VISIBILITY __wrap_iter operator++(int) _NOEXCEPT + _LIBCPP_INLINE_VISIBILITY __wrap_iter operator++(int) _NOEXCEPT_DEBUG {__wrap_iter __tmp(*this); ++(*this); return __tmp;} - _LIBCPP_INLINE_VISIBILITY __wrap_iter& operator--() _NOEXCEPT + _LIBCPP_INLINE_VISIBILITY __wrap_iter& operator--() _NOEXCEPT_DEBUG { #if _LIBCPP_DEBUG_LEVEL >= 2 _LIBCPP_ASSERT(__get_const_db()->__decrementable(this), @@ -1307,11 +1343,11 @@ public: --__i; return *this; } - _LIBCPP_INLINE_VISIBILITY __wrap_iter operator--(int) _NOEXCEPT + _LIBCPP_INLINE_VISIBILITY __wrap_iter operator--(int) _NOEXCEPT_DEBUG {__wrap_iter __tmp(*this); --(*this); return __tmp;} - _LIBCPP_INLINE_VISIBILITY __wrap_iter operator+ (difference_type __n) const _NOEXCEPT + _LIBCPP_INLINE_VISIBILITY __wrap_iter operator+ (difference_type __n) const _NOEXCEPT_DEBUG {__wrap_iter __w(*this); __w += __n; return __w;} - _LIBCPP_INLINE_VISIBILITY __wrap_iter& operator+=(difference_type __n) _NOEXCEPT + _LIBCPP_INLINE_VISIBILITY __wrap_iter& operator+=(difference_type __n) _NOEXCEPT_DEBUG { #if _LIBCPP_DEBUG_LEVEL >= 2 _LIBCPP_ASSERT(__get_const_db()->__addable(this, __n), @@ -1320,11 +1356,11 @@ public: __i += __n; return *this; } - _LIBCPP_INLINE_VISIBILITY __wrap_iter operator- (difference_type __n) const _NOEXCEPT + _LIBCPP_INLINE_VISIBILITY __wrap_iter operator- (difference_type __n) const _NOEXCEPT_DEBUG {return *this + (-__n);} - _LIBCPP_INLINE_VISIBILITY __wrap_iter& operator-=(difference_type __n) _NOEXCEPT + _LIBCPP_INLINE_VISIBILITY __wrap_iter& operator-=(difference_type __n) _NOEXCEPT_DEBUG {*this += -__n; return *this;} - _LIBCPP_INLINE_VISIBILITY reference operator[](difference_type __n) const _NOEXCEPT + _LIBCPP_INLINE_VISIBILITY reference operator[](difference_type __n) const _NOEXCEPT_DEBUG { #if _LIBCPP_DEBUG_LEVEL >= 2 _LIBCPP_ASSERT(__get_const_db()->__subscriptable(this, __n), @@ -1333,7 +1369,7 @@ public: return __i[__n]; } - _LIBCPP_INLINE_VISIBILITY iterator_type base() const _NOEXCEPT {return __i;} + _LIBCPP_INLINE_VISIBILITY iterator_type base() const _NOEXCEPT_DEBUG {return __i;} private: #if _LIBCPP_DEBUG_LEVEL >= 2 @@ -1342,66 +1378,67 @@ private: __get_db()->__insert_ic(this, __p); } #else - _LIBCPP_INLINE_VISIBILITY __wrap_iter(iterator_type __x) _NOEXCEPT : __i(__x) {} + _LIBCPP_INLINE_VISIBILITY __wrap_iter(iterator_type __x) _NOEXCEPT_DEBUG : __i(__x) {} #endif template <class _Up> friend class __wrap_iter; template <class _CharT, class _Traits, class _Alloc> friend class basic_string; - template <class _Tp, class _Alloc> friend class _LIBCPP_TYPE_VIS_ONLY vector; + template <class _Tp, class _Alloc> friend class _LIBCPP_TEMPLATE_VIS vector; template <class _Iter1, class _Iter2> friend bool - operator==(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT; + operator==(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT_DEBUG; template <class _Iter1, class _Iter2> friend bool - operator<(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT; + operator<(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT_DEBUG; template <class _Iter1, class _Iter2> friend bool - operator!=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT; + operator!=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT_DEBUG; template <class _Iter1, class _Iter2> friend bool - operator>(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT; + operator>(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT_DEBUG; template <class _Iter1, class _Iter2> friend bool - operator>=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT; + operator>=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT_DEBUG; template <class _Iter1, class _Iter2> friend bool - operator<=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT; + operator<=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT_DEBUG; #ifndef _LIBCPP_CXX03_LANG template <class _Iter1, class _Iter2> friend auto - operator-(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT + operator-(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT_DEBUG -> decltype(__x.base() - __y.base()); #else template <class _Iter1, class _Iter2> friend typename __wrap_iter<_Iter1>::difference_type - operator-(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT; + operator-(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT_DEBUG; #endif template <class _Iter1> friend __wrap_iter<_Iter1> - operator+(typename __wrap_iter<_Iter1>::difference_type, __wrap_iter<_Iter1>) _NOEXCEPT; + operator+(typename __wrap_iter<_Iter1>::difference_type, __wrap_iter<_Iter1>) _NOEXCEPT_DEBUG; template <class _Ip, class _Op> friend _Op copy(_Ip, _Ip, _Op); template <class _B1, class _B2> friend _B2 copy_backward(_B1, _B1, _B2); template <class _Ip, class _Op> friend _Op move(_Ip, _Ip, _Op); template <class _B1, class _B2> friend _B2 move_backward(_B1, _B1, _B2); +#if _LIBCPP_DEBUG_LEVEL < 2 template <class _Tp> friend typename enable_if @@ -1410,12 +1447,22 @@ private: _Tp* >::type __unwrap_iter(__wrap_iter<_Tp*>); +#else + template <class _Tp> + inline _LIBCPP_INLINE_VISIBILITY + typename enable_if + < + is_trivially_copy_assignable<_Tp>::value, + __wrap_iter<_Tp*> + >::type + __unwrap_iter(__wrap_iter<_Tp*> __i); +#endif }; template <class _Iter1, class _Iter2> inline _LIBCPP_INLINE_VISIBILITY bool -operator==(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT +operator==(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT_DEBUG { return __x.base() == __y.base(); } @@ -1423,7 +1470,7 @@ operator==(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEX template <class _Iter1, class _Iter2> inline _LIBCPP_INLINE_VISIBILITY bool -operator<(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT +operator<(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT_DEBUG { #if _LIBCPP_DEBUG_LEVEL >= 2 _LIBCPP_ASSERT(__get_const_db()->__less_than_comparable(&__x, &__y), @@ -1435,7 +1482,7 @@ operator<(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXC template <class _Iter1, class _Iter2> inline _LIBCPP_INLINE_VISIBILITY bool -operator!=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT +operator!=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT_DEBUG { return !(__x == __y); } @@ -1443,7 +1490,7 @@ operator!=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEX template <class _Iter1, class _Iter2> inline _LIBCPP_INLINE_VISIBILITY bool -operator>(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT +operator>(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT_DEBUG { return __y < __x; } @@ -1451,7 +1498,7 @@ operator>(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXC template <class _Iter1, class _Iter2> inline _LIBCPP_INLINE_VISIBILITY bool -operator>=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT +operator>=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT_DEBUG { return !(__x < __y); } @@ -1459,7 +1506,7 @@ operator>=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEX template <class _Iter1, class _Iter2> inline _LIBCPP_INLINE_VISIBILITY bool -operator<=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT +operator<=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT_DEBUG { return !(__y < __x); } @@ -1467,7 +1514,7 @@ operator<=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEX template <class _Iter1> inline _LIBCPP_INLINE_VISIBILITY bool -operator!=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT +operator!=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT_DEBUG { return !(__x == __y); } @@ -1475,7 +1522,7 @@ operator!=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEX template <class _Iter1> inline _LIBCPP_INLINE_VISIBILITY bool -operator>(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT +operator>(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT_DEBUG { return __y < __x; } @@ -1483,7 +1530,7 @@ operator>(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXC template <class _Iter1> inline _LIBCPP_INLINE_VISIBILITY bool -operator>=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT +operator>=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT_DEBUG { return !(__x < __y); } @@ -1491,7 +1538,7 @@ operator>=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEX template <class _Iter1> inline _LIBCPP_INLINE_VISIBILITY bool -operator<=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT +operator<=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT_DEBUG { return !(__y < __x); } @@ -1500,7 +1547,7 @@ operator<=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEX template <class _Iter1, class _Iter2> inline _LIBCPP_INLINE_VISIBILITY auto -operator-(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT +operator-(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT_DEBUG -> decltype(__x.base() - __y.base()) { #if _LIBCPP_DEBUG_LEVEL >= 2 @@ -1513,7 +1560,7 @@ operator-(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXC template <class _Iter1, class _Iter2> inline _LIBCPP_INLINE_VISIBILITY typename __wrap_iter<_Iter1>::difference_type -operator-(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT +operator-(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT_DEBUG { #if _LIBCPP_DEBUG_LEVEL >= 2 _LIBCPP_ASSERT(__get_const_db()->__less_than_comparable(&__x, &__y), @@ -1527,7 +1574,7 @@ template <class _Iter> inline _LIBCPP_INLINE_VISIBILITY __wrap_iter<_Iter> operator+(typename __wrap_iter<_Iter>::difference_type __n, - __wrap_iter<_Iter> __x) _NOEXCEPT + __wrap_iter<_Iter> __x) _NOEXCEPT_DEBUG { __x += __n; return __x; @@ -1535,19 +1582,19 @@ operator+(typename __wrap_iter<_Iter>::difference_type __n, template <class _Iter> struct __libcpp_is_trivial_iterator - : public _LIBCPP_BOOL_CONSTANT(is_pointer<_Iter>::value) {}; - + : public _LIBCPP_BOOL_CONSTANT(is_pointer<_Iter>::value) {}; + template <class _Iter> struct __libcpp_is_trivial_iterator<move_iterator<_Iter> > - : public _LIBCPP_BOOL_CONSTANT(__libcpp_is_trivial_iterator<_Iter>::value) {}; + : public _LIBCPP_BOOL_CONSTANT(__libcpp_is_trivial_iterator<_Iter>::value) {}; template <class _Iter> struct __libcpp_is_trivial_iterator<reverse_iterator<_Iter> > - : public _LIBCPP_BOOL_CONSTANT(__libcpp_is_trivial_iterator<_Iter>::value) {}; + : public _LIBCPP_BOOL_CONSTANT(__libcpp_is_trivial_iterator<_Iter>::value) {}; template <class _Iter> struct __libcpp_is_trivial_iterator<__wrap_iter<_Iter> > - : public _LIBCPP_BOOL_CONSTANT(__libcpp_is_trivial_iterator<_Iter>::value) {}; + : public _LIBCPP_BOOL_CONSTANT(__libcpp_is_trivial_iterator<_Iter>::value) {}; template <class _Tp, size_t _Np> @@ -1566,10 +1613,10 @@ end(_Tp (&__array)[_Np]) return __array + _Np; } -#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_TRAILING_RETURN) +#if !defined(_LIBCPP_CXX03_LANG) template <class _Cp> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 auto begin(_Cp& __c) -> decltype(__c.begin()) { @@ -1577,7 +1624,7 @@ begin(_Cp& __c) -> decltype(__c.begin()) } template <class _Cp> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 auto begin(const _Cp& __c) -> decltype(__c.begin()) { @@ -1585,7 +1632,7 @@ begin(const _Cp& __c) -> decltype(__c.begin()) } template <class _Cp> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 auto end(_Cp& __c) -> decltype(__c.end()) { @@ -1593,7 +1640,7 @@ end(_Cp& __c) -> decltype(__c.end()) } template <class _Cp> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 auto end(const _Cp& __c) -> decltype(__c.end()) { @@ -1603,28 +1650,28 @@ end(const _Cp& __c) -> decltype(__c.end()) #if _LIBCPP_STD_VER > 11 template <class _Tp, size_t _Np> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 reverse_iterator<_Tp*> rbegin(_Tp (&__array)[_Np]) { return reverse_iterator<_Tp*>(__array + _Np); } template <class _Tp, size_t _Np> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 reverse_iterator<_Tp*> rend(_Tp (&__array)[_Np]) { return reverse_iterator<_Tp*>(__array); } template <class _Ep> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 reverse_iterator<const _Ep*> rbegin(initializer_list<_Ep> __il) { return reverse_iterator<const _Ep*>(__il.end()); } template <class _Ep> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 reverse_iterator<const _Ep*> rend(initializer_list<_Ep> __il) { return reverse_iterator<const _Ep*>(__il.begin()); @@ -1645,42 +1692,42 @@ auto cend(const _Cp& __c) -> decltype(_VSTD::end(__c)) } template <class _Cp> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 auto rbegin(_Cp& __c) -> decltype(__c.rbegin()) { return __c.rbegin(); } template <class _Cp> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 auto rbegin(const _Cp& __c) -> decltype(__c.rbegin()) { return __c.rbegin(); } template <class _Cp> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 auto rend(_Cp& __c) -> decltype(__c.rend()) { return __c.rend(); } template <class _Cp> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 auto rend(const _Cp& __c) -> decltype(__c.rend()) { return __c.rend(); } template <class _Cp> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 auto crbegin(const _Cp& __c) -> decltype(_VSTD::rbegin(__c)) { return _VSTD::rbegin(__c); } template <class _Cp> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 auto crend(const _Cp& __c) -> decltype(_VSTD::rend(__c)) { return _VSTD::rend(__c); @@ -1689,7 +1736,7 @@ auto crend(const _Cp& __c) -> decltype(_VSTD::rend(__c)) #endif -#else // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_TRAILING_RETURN) +#else // defined(_LIBCPP_CXX03_LANG) template <class _Cp> inline _LIBCPP_INLINE_VISIBILITY @@ -1723,20 +1770,20 @@ end(const _Cp& __c) return __c.end(); } -#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_TRAILING_RETURN) +#endif // !defined(_LIBCPP_CXX03_LANG) #if _LIBCPP_STD_VER > 14 template <class _Cont> constexpr auto size(const _Cont& __c) -> decltype(__c.size()) { return __c.size(); } template <class _Tp, size_t _Sz> -constexpr size_t size(const _Tp (&__array)[_Sz]) noexcept { return _Sz; } +constexpr size_t size(const _Tp (&)[_Sz]) noexcept { return _Sz; } template <class _Cont> constexpr auto empty(const _Cont& __c) -> decltype(__c.empty()) { return __c.empty(); } template <class _Tp, size_t _Sz> -constexpr bool empty(const _Tp (&__array)[_Sz]) noexcept { return false; } +constexpr bool empty(const _Tp (&)[_Sz]) noexcept { return false; } template <class _Ep> constexpr bool empty(initializer_list<_Ep> __il) noexcept { return __il.size() == 0; } |