Index: include/__tuple =================================================================== --- include/__tuple +++ include/__tuple @@ -19,40 +19,9 @@ #pragma GCC system_header #endif -#ifdef _LIBCPP_HAS_NO_VARIADICS - -#include <__tuple_03> - -#else // _LIBCPP_HAS_NO_VARIADICS _LIBCPP_BEGIN_NAMESPACE_STD -// __lazy_and - -template -struct __lazy_and_impl; - -template -struct __lazy_and_impl : false_type {}; - -template <> -struct __lazy_and_impl : true_type {}; - -template -struct __lazy_and_impl : integral_constant {}; - -template -struct __lazy_and_impl : __lazy_and_impl<_Hp::type::value, _Tp...> {}; - -template -struct __lazy_and : __lazy_and_impl<_P1::type::value, _Pr...> {}; - -// __lazy_not - -template -struct __lazy_not : integral_constant {}; - - template class _LIBCPP_TYPE_VIS_ONLY tuple_size; template @@ -90,19 +59,18 @@ typedef typename add_cv::type>::type type; }; -template class _LIBCPP_TYPE_VIS_ONLY tuple; -template struct _LIBCPP_TYPE_VIS_ONLY pair; -template struct _LIBCPP_TYPE_VIS_ONLY array; - template struct __tuple_like : false_type {}; template struct __tuple_like : public __tuple_like<_Tp> {}; template struct __tuple_like : public __tuple_like<_Tp> {}; template struct __tuple_like : public __tuple_like<_Tp> {}; +// tuple specializations + +#if !defined(_LIBCPP_HAS_NO_VARIADICS) +template class _LIBCPP_TYPE_VIS_ONLY tuple; + template struct __tuple_like > : true_type {}; -template struct __tuple_like > : true_type {}; -template struct __tuple_like > : true_type {}; template _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 @@ -118,6 +86,13 @@ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 typename tuple_element<_Ip, tuple<_Tp...> >::type&& get(tuple<_Tp...>&&) _NOEXCEPT; +#endif + +// pair specializations + +template struct _LIBCPP_TYPE_VIS_ONLY pair; + +template struct __tuple_like > : true_type {}; template _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 @@ -129,10 +104,18 @@ const typename tuple_element<_Ip, pair<_T1, _T2> >::type& get(const pair<_T1, _T2>&) _NOEXCEPT; +#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) template _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 typename tuple_element<_Ip, pair<_T1, _T2> >::type&& get(pair<_T1, _T2>&&) _NOEXCEPT; +#endif + +// array specializations + +template struct _LIBCPP_TYPE_VIS_ONLY array; + +template struct __tuple_like > : true_type {}; template _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 @@ -144,10 +127,39 @@ const _Tp& get(const array<_Tp, _Size>&) _NOEXCEPT; +#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) template _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 _Tp&& get(array<_Tp, _Size>&&) _NOEXCEPT; +#endif + +#if !defined(_LIBCPP_HAS_NO_VARIADICS) + +// __lazy_and + +template +struct __lazy_and_impl; + +template +struct __lazy_and_impl : false_type {}; + +template <> +struct __lazy_and_impl : true_type {}; + +template +struct __lazy_and_impl : integral_constant {}; + +template +struct __lazy_and_impl : __lazy_and_impl<_Hp::type::value, _Tp...> {}; + +template +struct __lazy_and : __lazy_and_impl<_P1::type::value, _Pr...> {}; + +// __lazy_not + +template +struct __lazy_not : integral_constant {}; // __make_tuple_indices @@ -354,8 +366,8 @@ tuple_size<_Up>::value, _Tp, _Up> {}; -_LIBCPP_END_NAMESPACE_STD - #endif // _LIBCPP_HAS_NO_VARIADICS +_LIBCPP_END_NAMESPACE_STD + #endif // _LIBCPP___TUPLE Index: include/__tuple_03 =================================================================== --- include/__tuple_03 +++ /dev/null @@ -1,27 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP___TUPLE_03 -#define _LIBCPP___TUPLE_03 - -#include <__config> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -#pragma GCC system_header -#endif - -_LIBCPP_BEGIN_NAMESPACE_STD - -template class _LIBCPP_TYPE_VIS_ONLY tuple_size; -template class _LIBCPP_TYPE_VIS_ONLY tuple_element; - -_LIBCPP_END_NAMESPACE_STD - -#endif // _LIBCPP___TUPLE_03 Index: include/array =================================================================== --- include/array +++ include/array @@ -288,10 +288,6 @@ class _LIBCPP_TYPE_VIS_ONLY tuple_size > : public integral_constant {}; -template -class _LIBCPP_TYPE_VIS_ONLY tuple_size > - : public integral_constant {}; - template class _LIBCPP_TYPE_VIS_ONLY tuple_element<_Ip, array<_Tp, _Size> > { @@ -300,13 +296,6 @@ }; template -class _LIBCPP_TYPE_VIS_ONLY tuple_element<_Ip, const array<_Tp, _Size> > -{ -public: - typedef const _Tp type; -}; - -template inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 _Tp& get(array<_Tp, _Size>& __a) _NOEXCEPT Index: include/utility =================================================================== --- include/utility +++ include/utility @@ -512,10 +512,6 @@ : public integral_constant {}; template - class _LIBCPP_TYPE_VIS_ONLY tuple_size > - : public integral_constant {}; - -template class _LIBCPP_TYPE_VIS_ONLY tuple_element<0, pair<_T1, _T2> > { public: @@ -529,20 +525,6 @@ typedef _T2 type; }; -template -class _LIBCPP_TYPE_VIS_ONLY tuple_element<0, const pair<_T1, _T2> > -{ -public: - typedef const _T1 type; -}; - -template -class _LIBCPP_TYPE_VIS_ONLY tuple_element<1, const pair<_T1, _T2> > -{ -public: - typedef const _T2 type; -}; - template struct __get_pair; template <> Index: test/std/containers/sequences/array/array.tuple/tuple_element.pass.cpp =================================================================== --- test/std/containers/sequences/array/array.tuple/tuple_element.pass.cpp +++ test/std/containers/sequences/array/array.tuple/tuple_element.pass.cpp @@ -14,20 +14,41 @@ #include #include -int main() +template +void test() { { - typedef double T; - typedef std::array C; - static_assert((std::is_same::type, T>::value), ""); - static_assert((std::is_same::type, T>::value), ""); - static_assert((std::is_same::type, T>::value), ""); + typedef T Exp; + typedef std::array C; + static_assert((std::is_same::type, Exp>::value), ""); + static_assert((std::is_same::type, Exp>::value), ""); + static_assert((std::is_same::type, Exp>::value), ""); + } + { + typedef T const Exp; + typedef std::array const C; + static_assert((std::is_same::type, Exp>::value), ""); + static_assert((std::is_same::type, Exp>::value), ""); + static_assert((std::is_same::type, Exp>::value), ""); + } + { + typedef T volatile Exp; + typedef std::array volatile C; + static_assert((std::is_same::type, Exp>::value), ""); + static_assert((std::is_same::type, Exp>::value), ""); + static_assert((std::is_same::type, Exp>::value), ""); } { - typedef int T; - typedef std::array C; - static_assert((std::is_same::type, T>::value), ""); - static_assert((std::is_same::type, T>::value), ""); - static_assert((std::is_same::type, T>::value), ""); + typedef T const volatile Exp; + typedef std::array const volatile C; + static_assert((std::is_same::type, Exp>::value), ""); + static_assert((std::is_same::type, Exp>::value), ""); + static_assert((std::is_same::type, Exp>::value), ""); } } + +int main() +{ + test(); + test(); +} Index: test/std/containers/sequences/array/array.tuple/tuple_size.pass.cpp =================================================================== --- test/std/containers/sequences/array/array.tuple/tuple_size.pass.cpp +++ test/std/containers/sequences/array/array.tuple/tuple_size.pass.cpp @@ -13,16 +13,30 @@ #include -int main() +template +void test() { { - typedef double T; - typedef std::array C; - static_assert((std::tuple_size::value == 3), ""); + typedef std::array C; + static_assert((std::tuple_size::value == N), ""); + } + { + typedef std::array C; + static_assert((std::tuple_size::value == N), ""); + } + { + typedef std::array C; + static_assert((std::tuple_size::value == N), ""); } { - typedef double T; - typedef std::array C; - static_assert((std::tuple_size::value == 0), ""); + typedef std::array C; + static_assert((std::tuple_size::value == N), ""); } } + +int main() +{ + test(); + test(); + test(); +} Index: test/std/utilities/utility/pairs/pair.astuple/tuple_element.pass.cpp =================================================================== --- test/std/utilities/utility/pairs/pair.astuple/tuple_element.pass.cpp +++ test/std/utilities/utility/pairs/pair.astuple/tuple_element.pass.cpp @@ -15,16 +15,41 @@ #include -int main() +template +void test() { { - typedef std::pair P1; - static_assert((std::is_same::type, int>::value), ""); - static_assert((std::is_same::type, short>::value), ""); + typedef T1 Exp1; + typedef T2 Exp2; + typedef std::pair P; + static_assert((std::is_same::type, Exp1>::value), ""); + static_assert((std::is_same::type, Exp2>::value), ""); + } + { + typedef T1 const Exp1; + typedef T2 const Exp2; + typedef std::pair const P; + static_assert((std::is_same::type, Exp1>::value), ""); + static_assert((std::is_same::type, Exp2>::value), ""); + } + { + typedef T1 volatile Exp1; + typedef T2 volatile Exp2; + typedef std::pair volatile P; + static_assert((std::is_same::type, Exp1>::value), ""); + static_assert((std::is_same::type, Exp2>::value), ""); } { - typedef std::pair P1; - static_assert((std::is_same::type, int*>::value), ""); - static_assert((std::is_same::type, char>::value), ""); + typedef T1 const volatile Exp1; + typedef T2 const volatile Exp2; + typedef std::pair const volatile P; + static_assert((std::is_same::type, Exp1>::value), ""); + static_assert((std::is_same::type, Exp2>::value), ""); } } + +int main() +{ + test(); + test(); +} Index: test/std/utilities/utility/pairs/pair.astuple/tuple_size.pass.cpp =================================================================== --- test/std/utilities/utility/pairs/pair.astuple/tuple_size.pass.cpp +++ test/std/utilities/utility/pairs/pair.astuple/tuple_size.pass.cpp @@ -21,4 +21,16 @@ typedef std::pair P1; static_assert((std::tuple_size::value == 2), ""); } + { + typedef std::pair const P1; + static_assert((std::tuple_size::value == 2), ""); + } + { + typedef std::pair volatile P1; + static_assert((std::tuple_size::value == 2), ""); + } + { + typedef std::pair const volatile P1; + static_assert((std::tuple_size::value == 2), ""); + } }