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 ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/libcxx/branches/release_34@196077 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
		@@ -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)
 | 
					#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>
 | 
					template <class _Cp>
 | 
				
			||||||
inline _LIBCPP_INLINE_VISIBILITY
 | 
					inline _LIBCPP_INLINE_VISIBILITY
 | 
				
			||||||
auto
 | 
					auto
 | 
				
			||||||
@@ -1421,18 +1437,46 @@ end(const _Cp& __c) -> decltype(__c.end())
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#if _LIBCPP_STD_VER > 11
 | 
					#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>
 | 
					template <class _Cp>
 | 
				
			||||||
inline _LIBCPP_INLINE_VISIBILITY
 | 
					inline _LIBCPP_INLINE_VISIBILITY
 | 
				
			||||||
auto cbegin(const _Cp& __c) -> decltype(begin(__c))
 | 
					auto cbegin(const _Cp& __c) -> decltype(begin(__c))
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    return __c.begin();
 | 
					    return _VSTD::begin(__c);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
template <class _Cp>
 | 
					template <class _Cp>
 | 
				
			||||||
inline _LIBCPP_INLINE_VISIBILITY
 | 
					inline _LIBCPP_INLINE_VISIBILITY
 | 
				
			||||||
auto cend(const _Cp& __c) -> decltype(end(__c))
 | 
					auto cend(const _Cp& __c) -> decltype(end(__c))
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    return __c.end();
 | 
					    return _VSTD::end(__c);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
template <class _Cp>
 | 
					template <class _Cp>
 | 
				
			||||||
@@ -1516,53 +1560,6 @@ end(const _Cp& __c)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#endif  // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_TRAILING_RETURN)
 | 
					#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
 | 
					_LIBCPP_END_NAMESPACE_STD
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif  // _LIBCPP_ITERATOR
 | 
					#endif  // _LIBCPP_ITERATOR
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -50,11 +50,20 @@ int main()
 | 
				
			|||||||
        assert ( !(ii1 != ii2 ));
 | 
					        assert ( !(ii1 != ii2 ));
 | 
				
			||||||
        assert ( !(ii1 != cii ));
 | 
					        assert ( !(ii1 != cii ));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//         C c;
 | 
					        C c;
 | 
				
			||||||
//         assert ( ii1 != c.cbegin());
 | 
					        assert ( c.begin()   == std::begin(c));
 | 
				
			||||||
//         assert ( cii != c.begin());
 | 
					        assert ( c.cbegin()  == std::cbegin(c));
 | 
				
			||||||
//         assert ( cii != c.cend());
 | 
					        assert ( c.rbegin()  == std::rbegin(c));
 | 
				
			||||||
//         assert ( ii1 != c.end());
 | 
					        assert ( c.crbegin() == std::crbegin(c));
 | 
				
			||||||
 | 
					        assert ( c.end()     == std::end(c));
 | 
				
			||||||
 | 
					        assert ( c.cend()    == std::cend(c));
 | 
				
			||||||
 | 
					        assert ( c.rend()    == std::rend(c));
 | 
				
			||||||
 | 
					        assert ( c.crend()   == std::crend(c));
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					        assert ( std::begin(c)   != std::end(c));
 | 
				
			||||||
 | 
					        assert ( std::rbegin(c)  != std::rend(c));
 | 
				
			||||||
 | 
					        assert ( std::cbegin(c)  != std::cend(c));
 | 
				
			||||||
 | 
					        assert ( std::crbegin(c) != std::crend(c));
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
        typedef std::array<int, 0> C;
 | 
					        typedef std::array<int, 0> C;
 | 
				
			||||||
@@ -68,11 +77,20 @@ int main()
 | 
				
			|||||||
        assert ( !(ii1 != ii2 ));
 | 
					        assert ( !(ii1 != ii2 ));
 | 
				
			||||||
        assert ( !(ii1 != cii ));
 | 
					        assert ( !(ii1 != cii ));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//         C c;
 | 
					        C c;
 | 
				
			||||||
//         assert ( ii1 != c.cbegin());
 | 
					        assert ( c.begin()   == std::begin(c));
 | 
				
			||||||
//         assert ( cii != c.begin());
 | 
					        assert ( c.cbegin()  == std::cbegin(c));
 | 
				
			||||||
//         assert ( cii != c.cend());
 | 
					        assert ( c.rbegin()  == std::rbegin(c));
 | 
				
			||||||
//         assert ( ii1 != c.end());
 | 
					        assert ( c.crbegin() == std::crbegin(c));
 | 
				
			||||||
 | 
					        assert ( c.end()     == std::end(c));
 | 
				
			||||||
 | 
					        assert ( c.cend()    == std::cend(c));
 | 
				
			||||||
 | 
					        assert ( c.rend()    == std::rend(c));
 | 
				
			||||||
 | 
					        assert ( c.crend()   == std::crend(c));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        assert ( std::begin(c)   == std::end(c));
 | 
				
			||||||
 | 
					        assert ( std::rbegin(c)  == std::rend(c));
 | 
				
			||||||
 | 
					        assert ( std::cbegin(c)  == std::cend(c));
 | 
				
			||||||
 | 
					        assert ( std::crbegin(c) == std::crend(c));
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -52,6 +52,7 @@ void test_const_container( const std::initializer_list<T> & c, T val ) {
 | 
				
			|||||||
    assert ( std::end(c)     == c.end());
 | 
					    assert ( std::end(c)     == c.end());
 | 
				
			||||||
#if _LIBCPP_STD_VER > 11
 | 
					#if _LIBCPP_STD_VER > 11
 | 
				
			||||||
//  initializer_list doesn't have cbegin/cend/rbegin/rend
 | 
					//  initializer_list doesn't have cbegin/cend/rbegin/rend
 | 
				
			||||||
 | 
					//	but std::cbegin(),etc work (b/c they're general fn templates)
 | 
				
			||||||
//     assert ( std::cbegin(c)  == c.cbegin());
 | 
					//     assert ( std::cbegin(c)  == c.cbegin());
 | 
				
			||||||
//     assert ( std::cbegin(c)  != c.cend());
 | 
					//     assert ( std::cbegin(c)  != c.cend());
 | 
				
			||||||
//     assert ( std::cend(c)    == c.cend());
 | 
					//     assert ( std::cend(c)    == c.cend());
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user