modules/emscripten/system/include/libcxx/iterator in webruby-0.2.2 vs modules/emscripten/system/include/libcxx/iterator in webruby-0.2.4
- old
+ new
@@ -307,23 +307,37 @@
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
+
} // std
*/
#include <__config>
#include <type_traits>
#include <cstddef>
#include <iosfwd>
+#include <initializer_list>
#ifdef __APPLE__
#include <Availability.h>
#endif
-#ifdef _LIBCPP_DEBUG2
+#ifdef _LIBCPP_DEBUG
# include <__debug>
#else
# define _LIBCPP_ASSERT(x, m) ((void)0)
#endif
@@ -331,15 +345,15 @@
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
-struct _LIBCPP_TYPE_VIS input_iterator_tag {};
-struct _LIBCPP_TYPE_VIS output_iterator_tag {};
-struct _LIBCPP_TYPE_VIS forward_iterator_tag : public input_iterator_tag {};
-struct _LIBCPP_TYPE_VIS bidirectional_iterator_tag : public forward_iterator_tag {};
-struct _LIBCPP_TYPE_VIS random_access_iterator_tag : public bidirectional_iterator_tag {};
+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 {};
template <class _Tp>
struct __has_iterator_category
{
private:
@@ -378,15 +392,15 @@
// exists. Else iterator_traits<Iterator> will be an empty class. This is a
// conforming extension which allows some programs to compile and behave as
// the client expects instead of failing at compile time.
template <class _Iter>
-struct _LIBCPP_TYPE_VIS iterator_traits
+struct _LIBCPP_TYPE_VIS_ONLY iterator_traits
: __iterator_traits<_Iter, __has_iterator_category<_Iter>::value> {};
template<class _Tp>
-struct _LIBCPP_TYPE_VIS iterator_traits<_Tp*>
+struct _LIBCPP_TYPE_VIS_ONLY iterator_traits<_Tp*>
{
typedef ptrdiff_t difference_type;
typedef typename remove_const<_Tp>::type value_type;
typedef _Tp* pointer;
typedef _Tp& reference;
@@ -413,11 +427,11 @@
template <class _Tp>
struct __is_random_access_iterator : public __has_iterator_category_convertible_to<_Tp, random_access_iterator_tag> {};
template<class _Category, class _Tp, class _Distance = ptrdiff_t,
class _Pointer = _Tp*, class _Reference = _Tp&>
-struct _LIBCPP_TYPE_VIS iterator
+struct _LIBCPP_TYPE_VIS_ONLY iterator
{
typedef _Tp value_type;
typedef _Distance difference_type;
typedef _Pointer pointer;
typedef _Reference reference;
@@ -510,11 +524,11 @@
_VSTD::advance(__x, -__n);
return __x;
}
template <class _Iter>
-class _LIBCPP_TYPE_VIS reverse_iterator
+class _LIBCPP_TYPE_VIS_ONLY reverse_iterator
: public iterator<typename iterator_traits<_Iter>::iterator_category,
typename iterator_traits<_Iter>::value_type,
typename iterator_traits<_Iter>::difference_type,
typename iterator_traits<_Iter>::pointer,
typename iterator_traits<_Iter>::reference>
@@ -617,11 +631,11 @@
{
return reverse_iterator<_Iter>(__x.base() - __n);
}
template <class _Container>
-class _LIBCPP_TYPE_VIS back_insert_iterator
+class _LIBCPP_TYPE_VIS_ONLY back_insert_iterator
: public iterator<output_iterator_tag,
void,
void,
void,
back_insert_iterator<_Container>&>
@@ -650,11 +664,11 @@
{
return back_insert_iterator<_Container>(__x);
}
template <class _Container>
-class _LIBCPP_TYPE_VIS front_insert_iterator
+class _LIBCPP_TYPE_VIS_ONLY front_insert_iterator
: public iterator<output_iterator_tag,
void,
void,
void,
front_insert_iterator<_Container>&>
@@ -683,11 +697,11 @@
{
return front_insert_iterator<_Container>(__x);
}
template <class _Container>
-class _LIBCPP_TYPE_VIS insert_iterator
+class _LIBCPP_TYPE_VIS_ONLY insert_iterator
: public iterator<output_iterator_tag,
void,
void,
void,
insert_iterator<_Container>&>
@@ -719,11 +733,11 @@
return insert_iterator<_Container>(__x, __i);
}
template <class _Tp, class _CharT = char,
class _Traits = char_traits<_CharT>, class _Distance = ptrdiff_t>
-class _LIBCPP_TYPE_VIS istream_iterator
+class _LIBCPP_TYPE_VIS_ONLY istream_iterator
: public iterator<input_iterator_tag, _Tp, _Distance, const _Tp*, const _Tp&>
{
public:
typedef _CharT char_type;
typedef _Traits traits_type;
@@ -758,11 +772,11 @@
bool operator!=(const istream_iterator& __x, const istream_iterator& __y)
{return !(__x == __y);}
};
template <class _Tp, class _CharT = char, class _Traits = char_traits<_CharT> >
-class _LIBCPP_TYPE_VIS ostream_iterator
+class _LIBCPP_TYPE_VIS_ONLY ostream_iterator
: public iterator<output_iterator_tag, void, void, void, void>
{
public:
typedef _CharT char_type;
typedef _Traits traits_type;
@@ -787,11 +801,11 @@
_LIBCPP_INLINE_VISIBILITY ostream_iterator& operator++() {return *this;}
_LIBCPP_INLINE_VISIBILITY ostream_iterator& operator++(int) {return *this;}
};
template<class _CharT, class _Traits>
-class _LIBCPP_TYPE_VIS istreambuf_iterator
+class _LIBCPP_TYPE_VIS_ONLY istreambuf_iterator
: public iterator<input_iterator_tag, _CharT,
typename _Traits::off_type, _CharT*,
_CharT>
{
public:
@@ -858,11 +872,11 @@
bool operator!=(const istreambuf_iterator<_CharT,_Traits>& __a,
const istreambuf_iterator<_CharT,_Traits>& __b)
{return !__a.equal(__b);}
template <class _CharT, class _Traits>
-class _LIBCPP_TYPE_VIS ostreambuf_iterator
+class _LIBCPP_TYPE_VIS_ONLY ostreambuf_iterator
: public iterator<output_iterator_tag, void, void, void, void>
{
public:
typedef _CharT char_type;
typedef _Traits traits_type;
@@ -899,11 +913,11 @@
ios_base& __iob, _Ch __fl);
#endif
};
template <class _Iter>
-class _LIBCPP_TYPE_VIS move_iterator
+class _LIBCPP_TYPE_VIS_ONLY move_iterator
{
private:
_Iter __i;
public:
typedef _Iter iterator_type;
@@ -1014,11 +1028,11 @@
}
template <class _Iter>
inline _LIBCPP_INLINE_VISIBILITY
move_iterator<_Iter>
-make_move_iterator(const _Iter& __i)
+make_move_iterator(_Iter __i)
{
return move_iterator<_Iter>(__i);
}
// __wrap_iter
@@ -1195,16 +1209,17 @@
}
_LIBCPP_INLINE_VISIBILITY iterator_type base() const _NOEXCEPT {return __i;}
private:
- _LIBCPP_INLINE_VISIBILITY __wrap_iter(iterator_type __x) _NOEXCEPT : __i(__x) {}
#if _LIBCPP_DEBUG_LEVEL >= 2
_LIBCPP_INLINE_VISIBILITY __wrap_iter(const void* __p, iterator_type __x) : __i(__x)
{
__get_db()->__insert_ic(this, __p);
}
+#else
+ _LIBCPP_INLINE_VISIBILITY __wrap_iter(iterator_type __x) _NOEXCEPT : __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 vector;
@@ -1368,460 +1383,105 @@
{
__x += __n;
return __x;
}
-#ifdef _LIBCPP_DEBUG
+#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_TRAILING_RETURN)
-// __debug_iter
-
-template <class _Container, class _Iter> class __debug_iter;
-
-template <class _Container, class _Iter1, class _Iter2>
-_LIBCPP_INLINE_VISIBILITY
-bool
-operator==(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&);
-
-template <class _Container, class _Iter1, class _Iter2>
-_LIBCPP_INLINE_VISIBILITY
-bool
-operator<(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&);
-
-template <class _Container, class _Iter1, class _Iter2>
-_LIBCPP_INLINE_VISIBILITY
-bool
-operator!=(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&);
-
-template <class _Container, class _Iter1, class _Iter2>
-_LIBCPP_INLINE_VISIBILITY
-bool
-operator>(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&);
-
-template <class _Container, class _Iter1, class _Iter2>
-_LIBCPP_INLINE_VISIBILITY
-bool
-operator>=(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&);
-
-template <class _Container, class _Iter1, class _Iter2>
-_LIBCPP_INLINE_VISIBILITY
-bool
-operator<=(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&);
-
-template <class _Container, class _Iter1, class _Iter2>
-_LIBCPP_INLINE_VISIBILITY
-typename __debug_iter<_Container, _Iter1>::difference_type
-operator-(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&);
-
-template <class _Container, class _Iter>
-_LIBCPP_INLINE_VISIBILITY
-__debug_iter<_Container, _Iter>
-operator+(typename __debug_iter<_Container, _Iter>::difference_type, const __debug_iter<_Container, _Iter>&);
-
-template <class _Container, class _Iter>
-class __debug_iter
-{
-public:
- typedef _Iter iterator_type;
- typedef _Container __container_type;
- typedef typename iterator_traits<iterator_type>::iterator_category iterator_category;
- typedef typename iterator_traits<iterator_type>::value_type value_type;
- typedef typename iterator_traits<iterator_type>::difference_type difference_type;
- typedef typename iterator_traits<iterator_type>::pointer pointer;
- typedef typename iterator_traits<iterator_type>::reference reference;
-private:
- iterator_type __i;
- __debug_iter* __next;
- __container_type* __cont;
-
-public:
- _LIBCPP_INLINE_VISIBILITY __debug_iter() : __next(0), __cont(0) {}
- _LIBCPP_INLINE_VISIBILITY __debug_iter(const __debug_iter& __x)
- : __i(__x.base()), __next(0), __cont(0) {__set_owner(__x.__cont);}
- __debug_iter& operator=(const __debug_iter& __x);
- template <class _Up> _LIBCPP_INLINE_VISIBILITY __debug_iter(const __debug_iter<_Container, _Up>& __u,
- typename enable_if<is_convertible<_Up, iterator_type>::value>::type* = 0)
- : __i(__u.base()), __next(0), __cont(0) {__set_owner(__u.__cont);}
- _LIBCPP_INLINE_VISIBILITY ~__debug_iter() {__remove_owner();}
- _LIBCPP_INLINE_VISIBILITY reference operator*() const {assert(__is_deref()); return *__i;}
- _LIBCPP_INLINE_VISIBILITY pointer operator->() const {return &(operator*());}
- _LIBCPP_INLINE_VISIBILITY __debug_iter& operator++() {assert(__can_increment()); ++__i; return *this;}
- _LIBCPP_INLINE_VISIBILITY __debug_iter operator++(int)
- {__debug_iter __tmp(*this); operator++(); return __tmp;}
- _LIBCPP_INLINE_VISIBILITY __debug_iter& operator--() {assert(__can_decrement()); --__i; return *this;}
- _LIBCPP_INLINE_VISIBILITY __debug_iter operator--(int)
- {__debug_iter __tmp(*this); operator--(); return __tmp;}
- _LIBCPP_INLINE_VISIBILITY __debug_iter operator+ (difference_type __n) const
- {__debug_iter __t(*this); __t += __n; return __t;}
- __debug_iter& operator+=(difference_type __n);
- _LIBCPP_INLINE_VISIBILITY __debug_iter operator- (difference_type __n) const
- {__debug_iter __t(*this); __t -= __n; return __t;}
- _LIBCPP_INLINE_VISIBILITY __debug_iter& operator-=(difference_type __n)
- {*this += -__n; return *this;}
- _LIBCPP_INLINE_VISIBILITY reference operator[](difference_type __n) const
- {return *(*this + __n);}
-
-private:
- _LIBCPP_INLINE_VISIBILITY __debug_iter(const __container_type* __c, iterator_type __x)
- : __i(__x), __next(0), __cont(0) {__set_owner(__c);}
- _LIBCPP_INLINE_VISIBILITY iterator_type base() const {return __i;}
-
- void __set_owner(const __container_type* __c);
- void __remove_owner();
- static void __remove_all(__container_type* __c);
- static void swap(__container_type* __x, __container_type* __y);
-
- _LIBCPP_INLINE_VISIBILITY bool __is_deref() const
- {return __is_deref(__is_random_access_iterator<iterator_type>());}
- bool __is_deref(false_type) const;
- bool __is_deref(true_type) const;
- _LIBCPP_INLINE_VISIBILITY bool __can_decrement() const
- {return __can_decrement(integral_constant<int, is_pointer<iterator_type>::value ? 2:
- __is_random_access_iterator<iterator_type>::value ? 1 : 0>());}
- bool __can_decrement(integral_constant<int, 0>) const;
- bool __can_decrement(integral_constant<int, 1>) const;
- bool __can_decrement(integral_constant<int, 2>) const;
- _LIBCPP_INLINE_VISIBILITY bool __can_increment() const
- {return __can_increment(integral_constant<int, is_pointer<iterator_type>::value ? 2:
- __is_random_access_iterator<iterator_type>::value ? 1 : 0>());}
- bool __can_increment(integral_constant<int, 0>) const;
- bool __can_increment(integral_constant<int, 1>) const;
- bool __can_increment(integral_constant<int, 2>) const;
-
- _LIBCPP_INLINE_VISIBILITY bool __can_add(difference_type __n) const
- {return __can_add(__n, is_pointer<iterator_type>());}
- bool __can_add(difference_type __n, false_type) const;
- bool __can_add(difference_type __n, true_type) const;
-
- template <class _Cp, class _Up> friend class __debug_iter;
- friend class _Container::__self;
-
- template <class _Cp, class _Iter1, class _Iter2>
- friend
- bool
- operator==(const __debug_iter<_Cp, _Iter1>&, const __debug_iter<_Cp, _Iter2>&);
-
- template <class _Cp, class _Iter1, class _Iter2>
- friend
- bool
- operator<(const __debug_iter<_Cp, _Iter1>&, const __debug_iter<_Cp, _Iter2>&);
-
- template <class _Cp, class _Iter1, class _Iter2>
- friend
- bool
- operator!=(const __debug_iter<_Cp, _Iter1>&, const __debug_iter<_Cp, _Iter2>&);
-
- template <class _Cp, class _Iter1, class _Iter2>
- friend
- bool
- operator>(const __debug_iter<_Cp, _Iter1>&, const __debug_iter<_Cp, _Iter2>&);
-
- template <class _Cp, class _Iter1, class _Iter2>
- friend
- bool
- operator>=(const __debug_iter<_Cp, _Iter1>&, const __debug_iter<_Cp, _Iter2>&);
-
- template <class _Cp, class _Iter1, class _Iter2>
- friend
- bool
- operator<=(const __debug_iter<_Cp, _Iter1>&, const __debug_iter<_Cp, _Iter2>&);
-
- template <class _Cp, class _Iter1, class _Iter2>
- friend
- typename __debug_iter<_Cp, _Iter1>::difference_type
- operator-(const __debug_iter<_Cp, _Iter1>&, const __debug_iter<_Cp, _Iter2>&);
-
- template <class _Cp, class _Iter1>
- friend
- __debug_iter<_Cp, _Iter1>
- operator+(typename __debug_iter<_Cp, _Iter1>::difference_type, const __debug_iter<_Cp, _Iter1>&);
-};
-
-template <class _Container, class _Iter>
-__debug_iter<_Container, _Iter>&
-__debug_iter<_Container, _Iter>::operator=(const __debug_iter& __x)
-{
- if (this != &__x)
- {
- __remove_owner();
- __i = __x.__i;
- __set_owner(__x.__cont);
- }
- return *this;
-}
-
-template <class _Container, class _Iter>
-void
-__debug_iter<_Container, _Iter>::__set_owner(const __container_type* __c)
-{
- __cont = const_cast<__container_type*>(__c);
- __debug_iter*& __head = __cont->__get_iterator_list(this);
- __next = __head;
- __head = this;
-}
-
-template <class _Container, class _Iter>
-void
-__debug_iter<_Container, _Iter>::__remove_owner()
-{
- if (__cont)
- {
- __debug_iter*& __head = __cont->__get_iterator_list(this);
- if (__head == this)
- __head = __next;
- else
- {
- __debug_iter* __prev = __head;
- for (__debug_iter* __p = __head->__next; __p != this; __p = __p->__next)
- __prev = __p;
- __prev->__next = __next;
- }
- __cont = 0;
- }
-}
-
-template <class _Container, class _Iter>
-void
-__debug_iter<_Container, _Iter>::__remove_all(__container_type* __c)
-{
- __debug_iter*& __head = __c->__get_iterator_list((__debug_iter*)0);
- __debug_iter* __p = __head;
- __head = 0;
- while (__p)
- {
- __p->__cont = 0;
- __debug_iter* __n = __p->__next;
- __p->__next = 0;
- __p = __n;
- }
-}
-
-template <class _Container, class _Iter>
-void
-__debug_iter<_Container, _Iter>::swap(__container_type* __x, __container_type* __y)
-{
- __debug_iter*& __head_x = __x->__get_iterator_list((__debug_iter*)0);
- __debug_iter*& __head_y = __y->__get_iterator_list((__debug_iter*)0);
- __debug_iter* __p = __head_x;
- __head_x = __head_y;
- __head_y = __p;
- for (__p = __head_x; __p; __p = __p->__next)
- __p->__cont = __x;
- for (__p = __head_y; __p; __p = __p->__next)
- __p->__cont = __y;
-}
-
-template <class _Container, class _Iter>
-bool
-__debug_iter<_Container, _Iter>::__is_deref(false_type) const
-{
- if (__cont == 0)
- return false;
- return __i != __cont->end().base();
-}
-
-template <class _Container, class _Iter>
-bool
-__debug_iter<_Container, _Iter>::__is_deref(true_type) const
-{
- if (__cont == 0)
- return false;
- return __i < __cont->end().base();
-}
-
-template <class _Container, class _Iter>
-bool
-__debug_iter<_Container, _Iter>::__can_decrement(integral_constant<int, 0>) const
-{
- if (__cont == 0)
- return false;
- return __i != __cont->begin().base();
-}
-
-template <class _Container, class _Iter>
-bool
-__debug_iter<_Container, _Iter>::__can_decrement(integral_constant<int, 1>) const
-{
- if (__cont == 0)
- return false;
- iterator_type __b = __cont->begin().base();
- return __b < __i && __i <= __b + __cont->size();
-}
-
-template <class _Container, class _Iter>
-bool
-__debug_iter<_Container, _Iter>::__can_decrement(integral_constant<int, 2>) const
-{
- if (__cont == 0)
- return false;
- iterator_type __b = __cont->begin().base();
- return __b < __i && __i <= __b + __cont->size();
-}
-
-template <class _Container, class _Iter>
-bool
-__debug_iter<_Container, _Iter>::__can_increment(integral_constant<int, 0>) const
-{
- if (__cont == 0)
- return false;
- return __i != __cont->end().base();
-}
-
-template <class _Container, class _Iter>
-bool
-__debug_iter<_Container, _Iter>::__can_increment(integral_constant<int, 1>) const
-{
- if (__cont == 0)
- return false;
- iterator_type __b = __cont->begin().base();
- return __b <= __i && __i < __b + __cont->size();
-}
-
-template <class _Container, class _Iter>
-bool
-__debug_iter<_Container, _Iter>::__can_increment(integral_constant<int, 2>) const
-{
- if (__cont == 0)
- return false;
- iterator_type __b = __cont->begin().base();
- return __b <= __i && __i < __b + __cont->size();
-}
-
-template <class _Container, class _Iter>
-bool
-__debug_iter<_Container, _Iter>::__can_add(difference_type __n, false_type) const
-{
- if (__cont == 0)
- return false;
- iterator_type __b = __cont->begin().base();
- iterator_type __j = __i + __n;
- return __b <= __j && __j <= __b + __cont->size();
-}
-
-template <class _Container, class _Iter>
-bool
-__debug_iter<_Container, _Iter>::__can_add(difference_type __n, true_type) const
-{
- if (__cont == 0)
- return false;
- iterator_type __b = __cont->begin().base();
- iterator_type __j = __i + __n;
- return __b <= __j && __j <= __b + __cont->size();
-}
-
-template <class _Container, class _Iter>
-__debug_iter<_Container, _Iter>&
-__debug_iter<_Container, _Iter>::operator+=(difference_type __n)
-{
- assert(__can_add(__n));
- __i += __n;
- return *this;
-}
-
-template <class _Container, class _Iter1, class _Iter2>
+template <class _Cp>
inline _LIBCPP_INLINE_VISIBILITY
-bool
-operator==(const __debug_iter<_Container, _Iter1>& __x, const __debug_iter<_Container, _Iter2>& __y)
+auto
+begin(_Cp& __c) -> decltype(__c.begin())
{
- assert(__x.__cont && __x.__cont == __y.__cont);
- return __x.base() == __y.base();
+ return __c.begin();
}
-template <class _Container, class _Iter1, class _Iter2>
+template <class _Cp>
inline _LIBCPP_INLINE_VISIBILITY
-bool
-operator!=(const __debug_iter<_Container, _Iter1>& __x, const __debug_iter<_Container, _Iter2>& __y)
+auto
+begin(const _Cp& __c) -> decltype(__c.begin())
{
- return !(__x == __y);
+ return __c.begin();
}
-template <class _Container, class _Iter1, class _Iter2>
+template <class _Cp>
inline _LIBCPP_INLINE_VISIBILITY
-bool
-operator<(const __debug_iter<_Container, _Iter1>& __x, const __debug_iter<_Container, _Iter2>& __y)
+auto
+end(_Cp& __c) -> decltype(__c.end())
{
- assert(__x.__cont && __x.__cont == __y.__cont);
- return __x.base() < __y.base();
+ return __c.end();
}
-template <class _Container, class _Iter1, class _Iter2>
+template <class _Cp>
inline _LIBCPP_INLINE_VISIBILITY
-bool
-operator>(const __debug_iter<_Container, _Iter1>& __x, const __debug_iter<_Container, _Iter2>& __y)
+auto
+end(const _Cp& __c) -> decltype(__c.end())
{
- return __y < __x;
+ return __c.end();
}
-template <class _Container, class _Iter1, class _Iter2>
+#if _LIBCPP_STD_VER > 11
+
+template <class _Cp>
inline _LIBCPP_INLINE_VISIBILITY
-bool
-operator>=(const __debug_iter<_Container, _Iter1>& __x, const __debug_iter<_Container, _Iter2>& __y)
+auto cbegin(const _Cp& __c) -> decltype(begin(__c))
{
- return !(__x < __y);
+ return __c.begin();
}
-template <class _Container, class _Iter1, class _Iter2>
+template <class _Cp>
inline _LIBCPP_INLINE_VISIBILITY
-bool
-operator<=(const __debug_iter<_Container, _Iter1>& __x, const __debug_iter<_Container, _Iter2>& __y)
+auto cend(const _Cp& __c) -> decltype(end(__c))
{
- return !(__y < __x);
+ return __c.end();
}
-template <class _Container, class _Iter1, class _Iter2>
+template <class _Cp>
inline _LIBCPP_INLINE_VISIBILITY
-typename __debug_iter<_Container, _Iter1>::difference_type
-operator-(const __debug_iter<_Container, _Iter1>& __x, const __debug_iter<_Container, _Iter2>& __y)
+auto rbegin(_Cp& __c) -> decltype(__c.rbegin())
{
- assert(__x.__cont && __x.__cont == __y.__cont);
- return __x.base() - __y.base();
+ return __c.rbegin();
}
-template <class _Container, class _Iter>
+template <class _Cp>
inline _LIBCPP_INLINE_VISIBILITY
-__debug_iter<_Container, _Iter>
-operator+(typename __debug_iter<_Container, _Iter>::difference_type __n,
- const __debug_iter<_Container, _Iter>& __x)
+auto rbegin(const _Cp& __c) -> decltype(__c.rbegin())
{
- return __x + __n;
+ return __c.rbegin();
}
-#endif // _LIBCPP_DEBUG
-
-#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_TRAILING_RETURN)
-
template <class _Cp>
inline _LIBCPP_INLINE_VISIBILITY
-auto
-begin(_Cp& __c) -> decltype(__c.begin())
+auto rend(_Cp& __c) -> decltype(__c.rend())
{
- return __c.begin();
+ return __c.rend();
}
template <class _Cp>
inline _LIBCPP_INLINE_VISIBILITY
-auto
-begin(const _Cp& __c) -> decltype(__c.begin())
+auto rend(const _Cp& __c) -> decltype(__c.rend())
{
- return __c.begin();
+ return __c.rend();
}
template <class _Cp>
inline _LIBCPP_INLINE_VISIBILITY
-auto
-end(_Cp& __c) -> decltype(__c.end())
+auto crbegin(const _Cp& __c) -> decltype(rbegin(__c))
{
- return __c.end();
+ return rbegin(__c);
}
template <class _Cp>
inline _LIBCPP_INLINE_VISIBILITY
-auto
-end(const _Cp& __c) -> decltype(__c.end())
+auto crend(const _Cp& __c) -> decltype(rend(__c))
{
- return __c.end();
+ return rend(__c);
}
+#endif
+
+
#else // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_TRAILING_RETURN)
template <class _Cp>
inline _LIBCPP_INLINE_VISIBILITY
typename _Cp::iterator
@@ -1869,9 +1529,40 @@
_Tp*
end(_Tp (&__array)[_Np])
{
return __array + _Np;
}
+
+#if _LIBCPP_STD_VER > 11
+template <class _Tp, size_t _Np>
+inline _LIBCPP_INLINE_VISIBILITY
+reverse_iterator<_Tp*> rbegin(_Tp (&__array)[_Np])
+{
+ return reverse_iterator<_Tp*>(__array + _Np);
+}
+
+template <class _Tp, size_t _Np>
+inline _LIBCPP_INLINE_VISIBILITY
+reverse_iterator<_Tp*> rend(_Tp (&__array)[_Np])
+{
+ return reverse_iterator<_Tp*>(__array);
+}
+
+template <class _Ep>
+inline _LIBCPP_INLINE_VISIBILITY
+reverse_iterator<const _Ep*> rbegin(initializer_list<_Ep> __il)
+{
+ return reverse_iterator<const _Ep*>(__il.end());
+}
+
+template <class _Ep>
+inline _LIBCPP_INLINE_VISIBILITY
+reverse_iterator<const _Ep*> rend(initializer_list<_Ep> __il)
+{
+ return reverse_iterator<const _Ep*>(__il.begin());
+}
+
+#endif
_LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP_ITERATOR