diff options
author | Bill Wendling <isanbard@gmail.com> | 2013-12-12 11:06:59 +0400 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2013-12-12 11:06:59 +0400 |
commit | 9fb5fc9684e96c9a795c1dcf128d306d12ecc63d (patch) | |
tree | 6efaf60df40cc0d8250f86425b803cc6788ab673 /libcxx/include/iterator | |
parent | 26d28e51b8a176e5d4b3716772ac9cb29e65f2e9 (diff) |
Merging r196058:
------------------------------------------------------------------------
r196058 | marshall | 2013-12-01 19:24:33 -0800 (Sun, 01 Dec 2013) | 1 line
Fix for PRPR17934; based on a fix suggested by Peter Sommerlad
------------------------------------------------------------------------
llvm-svn: 197133
Diffstat (limited to 'libcxx/include/iterator')
-rw-r--r-- | libcxx/include/iterator | 95 |
1 files changed, 46 insertions, 49 deletions
diff --git a/libcxx/include/iterator b/libcxx/include/iterator index d16aa2aa95fb..1c59919ebe88 100644 --- a/libcxx/include/iterator +++ b/libcxx/include/iterator @@ -1387,6 +1387,22 @@ operator+(typename __wrap_iter<_Iter>::difference_type __n, #if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_TRAILING_RETURN) +template <class _Tp, size_t _Np> +inline _LIBCPP_INLINE_VISIBILITY +_Tp* +begin(_Tp (&__array)[_Np]) +{ + return __array; +} + +template <class _Tp, size_t _Np> +inline _LIBCPP_INLINE_VISIBILITY +_Tp* +end(_Tp (&__array)[_Np]) +{ + return __array + _Np; +} + template <class _Cp> inline _LIBCPP_INLINE_VISIBILITY auto @@ -1421,18 +1437,46 @@ end(const _Cp& __c) -> decltype(__c.end()) #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()); +} + template <class _Cp> inline _LIBCPP_INLINE_VISIBILITY auto cbegin(const _Cp& __c) -> decltype(begin(__c)) { - return __c.begin(); + return _VSTD::begin(__c); } template <class _Cp> inline _LIBCPP_INLINE_VISIBILITY auto cend(const _Cp& __c) -> decltype(end(__c)) { - return __c.end(); + return _VSTD::end(__c); } template <class _Cp> @@ -1516,53 +1560,6 @@ end(const _Cp& __c) #endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_TRAILING_RETURN) -template <class _Tp, size_t _Np> -inline _LIBCPP_INLINE_VISIBILITY -_Tp* -begin(_Tp (&__array)[_Np]) -{ - return __array; -} - -template <class _Tp, size_t _Np> -inline _LIBCPP_INLINE_VISIBILITY -_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 |