EricWF created this revision. EricWF added a subscriber: cfe-commits. http://reviews.llvm.org/D19006
Files: include/tuple test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_UTypes.pass.cpp Index: test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_UTypes.pass.cpp =================================================================== --- test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_UTypes.pass.cpp +++ test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_UTypes.pass.cpp @@ -30,7 +30,7 @@ // are not explicitly initialized are not all default constructible. // Otherwise, std::is_constructible would return true but instantiating // the constructor would fail. -void test_default_constructible_extension_sfinae() +void test_default_constructible_sfinae() { { typedef std::tuple<MoveOnly, NoDefault> Tuple; @@ -120,22 +120,7 @@ assert(alloc_last::allocator_constructed); assert(std::get<2>(t) == alloc_last(3)); } - // extensions - { - std::tuple<MoveOnly, MoveOnly, MoveOnly> t(std::allocator_arg, A1<int>(), - 0, 1); - assert(std::get<0>(t) == 0); - assert(std::get<1>(t) == 1); - assert(std::get<2>(t) == MoveOnly()); - } - { - std::tuple<MoveOnly, MoveOnly, MoveOnly> t(std::allocator_arg, A1<int>(), - 0); - assert(std::get<0>(t) == 0); - assert(std::get<1>(t) == MoveOnly()); - assert(std::get<2>(t) == MoveOnly()); - } // Check that SFINAE is properly applied with the default reduced arity // constructor extensions. - test_default_constructible_extension_sfinae(); + test_default_constructible_sfinae(); } Index: include/tuple =================================================================== --- include/tuple +++ include/tuple @@ -523,6 +523,16 @@ _LIBCPP_CONSTEXPR tuple() _NOEXCEPT_(__all<is_nothrow_default_constructible<_Tp>::value...>::value) {} + template <class _Alloc, bool _Dummy = true, class = typename enable_if< + __all<__dependent_type<is_default_constructible<_Tp>, _Dummy>::value...>::value + >::type> + _LIBCPP_INLINE_VISIBILITY + tuple(allocator_arg_t, _Alloc const& __a) + : base_(allocator_arg_t(), __a, + __tuple_indices<>(), __tuple_types<>(), + typename __make_tuple_indices<sizeof...(_Tp), 0>::type(), + __tuple_types<_Tp...>()) {} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 explicit tuple(const _Tp& ... __t) _NOEXCEPT_((__all<is_nothrow_copy_constructible<_Tp>::value...>::value)) : base_(typename __make_tuple_indices<sizeof...(_Tp)>::type(), @@ -631,21 +641,8 @@ template <class _Alloc, class ..._Up, class = typename enable_if < - sizeof...(_Up) <= sizeof...(_Tp) && - __tuple_convertible - < - tuple<_Up...>, - typename __make_tuple_types<tuple, - sizeof...(_Up) < sizeof...(_Tp) ? - sizeof...(_Up) : - sizeof...(_Tp)>::type - >::value && - __all_default_constructible< - typename __make_tuple_types<tuple, sizeof...(_Tp), - sizeof...(_Up) < sizeof...(_Tp) ? - sizeof...(_Up) : - sizeof...(_Tp)>::type - >::value + sizeof...(_Up) == sizeof...(_Tp) && + __tuple_convertible<tuple<_Up...>, tuple>::value >::type > _LIBCPP_INLINE_VISIBILITY
Index: test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_UTypes.pass.cpp =================================================================== --- test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_UTypes.pass.cpp +++ test/std/utilities/tuple/tuple.tuple/tuple.cnstr/alloc_UTypes.pass.cpp @@ -30,7 +30,7 @@ // are not explicitly initialized are not all default constructible. // Otherwise, std::is_constructible would return true but instantiating // the constructor would fail. -void test_default_constructible_extension_sfinae() +void test_default_constructible_sfinae() { { typedef std::tuple<MoveOnly, NoDefault> Tuple; @@ -120,22 +120,7 @@ assert(alloc_last::allocator_constructed); assert(std::get<2>(t) == alloc_last(3)); } - // extensions - { - std::tuple<MoveOnly, MoveOnly, MoveOnly> t(std::allocator_arg, A1<int>(), - 0, 1); - assert(std::get<0>(t) == 0); - assert(std::get<1>(t) == 1); - assert(std::get<2>(t) == MoveOnly()); - } - { - std::tuple<MoveOnly, MoveOnly, MoveOnly> t(std::allocator_arg, A1<int>(), - 0); - assert(std::get<0>(t) == 0); - assert(std::get<1>(t) == MoveOnly()); - assert(std::get<2>(t) == MoveOnly()); - } // Check that SFINAE is properly applied with the default reduced arity // constructor extensions. - test_default_constructible_extension_sfinae(); + test_default_constructible_sfinae(); } Index: include/tuple =================================================================== --- include/tuple +++ include/tuple @@ -523,6 +523,16 @@ _LIBCPP_CONSTEXPR tuple() _NOEXCEPT_(__all<is_nothrow_default_constructible<_Tp>::value...>::value) {} + template <class _Alloc, bool _Dummy = true, class = typename enable_if< + __all<__dependent_type<is_default_constructible<_Tp>, _Dummy>::value...>::value + >::type> + _LIBCPP_INLINE_VISIBILITY + tuple(allocator_arg_t, _Alloc const& __a) + : base_(allocator_arg_t(), __a, + __tuple_indices<>(), __tuple_types<>(), + typename __make_tuple_indices<sizeof...(_Tp), 0>::type(), + __tuple_types<_Tp...>()) {} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 explicit tuple(const _Tp& ... __t) _NOEXCEPT_((__all<is_nothrow_copy_constructible<_Tp>::value...>::value)) : base_(typename __make_tuple_indices<sizeof...(_Tp)>::type(), @@ -631,21 +641,8 @@ template <class _Alloc, class ..._Up, class = typename enable_if < - sizeof...(_Up) <= sizeof...(_Tp) && - __tuple_convertible - < - tuple<_Up...>, - typename __make_tuple_types<tuple, - sizeof...(_Up) < sizeof...(_Tp) ? - sizeof...(_Up) : - sizeof...(_Tp)>::type - >::value && - __all_default_constructible< - typename __make_tuple_types<tuple, sizeof...(_Tp), - sizeof...(_Up) < sizeof...(_Tp) ? - sizeof...(_Up) : - sizeof...(_Tp)>::type - >::value + sizeof...(_Up) == sizeof...(_Tp) && + __tuple_convertible<tuple<_Up...>, tuple>::value >::type > _LIBCPP_INLINE_VISIBILITY
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits