From a0ac7738c98f6e938d0ce7f8b2efa91bcd55b046 Mon Sep 17 00:00:00 2001 From: redi Date: Tue, 4 Nov 2014 02:49:20 +0000 Subject: [PATCH] Use aliases for type traits in C++14 mode. * include/bits/unique_ptr.h (make_unique): Use alias for trait. * include/experimental/optional (__constexpr_addressof): Likewise. (_Optional_base, optional, make_optional): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@217064 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 6 ++++ libstdc++-v3/include/bits/unique_ptr.h | 2 +- libstdc++-v3/include/experimental/optional | 48 ++++++++++++------------------ 3 files changed, 26 insertions(+), 30 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index c3545bf7d65..88e93524d2b 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,9 @@ +2014-11-04 Jonathan Wakely + + * include/bits/unique_ptr.h (make_unique): Use alias for trait. + * include/experimental/optional (__constexpr_addressof): Likewise. + (_Optional_base, optional, make_optional): Likewise. + 2014-11-03 Paolo Carlini * include/parallel/algo.h: Do not use default arguments in function diff --git a/libstdc++-v3/include/bits/unique_ptr.h b/libstdc++-v3/include/bits/unique_ptr.h index ce38c5a7733..5c2c534911d 100644 --- a/libstdc++-v3/include/bits/unique_ptr.h +++ b/libstdc++-v3/include/bits/unique_ptr.h @@ -768,7 +768,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template inline typename _MakeUniq<_Tp>::__array make_unique(size_t __num) - { return unique_ptr<_Tp>(new typename remove_extent<_Tp>::type[__num]()); } + { return unique_ptr<_Tp>(new remove_extent_t<_Tp>[__num]()); } /// Disable std::make_unique for arrays of known bound template diff --git a/libstdc++-v3/include/experimental/optional b/libstdc++-v3/include/experimental/optional index 973775bd925..7e01abedb76 100644 --- a/libstdc++-v3/include/experimental/optional +++ b/libstdc++-v3/include/experimental/optional @@ -151,16 +151,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION * overloaded addressof operator (unary operator&), in which case the call * will not be a constant expression. */ - template::value, - int>::type...> + template::value, int>...> constexpr _Tp* __constexpr_addressof(_Tp& __t) { return &__t; } /** * @brief Fallback overload that defers to __addressof. */ - template::value, - int>::type...> + template::value, int>...> inline _Tp* __constexpr_addressof(_Tp& __t) { return std::__addressof(__t); } @@ -184,7 +182,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // Remove const to avoid prohibition of reusing object storage for // const-qualified types in [3.8/9]. This is strictly internal // and even optional itself is oblivious to it. - using _Stored_type = typename remove_const<_Tp>::type; + using _Stored_type = remove_const_t<_Tp>; public: // [X.Y.4.1] Constructors. @@ -208,10 +206,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION : _M_payload(std::forward<_Args>(__args)...), _M_engaged(true) { } template&, - _Args&&...>::value, - int>::type...> + enable_if_t&, + _Args&&...>::value, + int>...> constexpr explicit _Optional_base(in_place_t, initializer_list<_Up> __il, _Args&&... __args) @@ -330,7 +328,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION class _Optional_base<_Tp, false> { private: - using _Stored_type = typename remove_const<_Tp>::type; + using _Stored_type = remove_const_t<_Tp>; public: constexpr _Optional_base() noexcept @@ -350,10 +348,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION : _M_payload(std::forward<_Args>(__args)...), _M_engaged(true) { } template&, - _Args&&...>::value, - int>::type...> + enable_if_t&, + _Args&&...>::value, + int>...> constexpr explicit _Optional_base(in_place_t, initializer_list<_Up> __il, _Args&&... __args) @@ -472,10 +470,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // Unique tag type. optional<_Tp>> { - static_assert(__and_<__not_::type, - nullopt_t>>, - __not_::type, - in_place_t>>, + static_assert(__and_<__not_, nullopt_t>>, + __not_, in_place_t>>, __not_>>(), "Invalid instantiation of optional"); @@ -497,10 +493,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } template - typename enable_if< - is_same<_Tp, typename decay<_Up>::type>::value, - optional& - >::type + enable_if_t>::value, optional&> operator=(_Up&& __u) { static_assert(__and_, @@ -527,11 +520,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } template - typename enable_if< - is_constructible<_Tp, - initializer_list<_Up>&, - _Args&&...>::value - >::type + enable_if_t&, + _Args&&...>::value> emplace(initializer_list<_Up> __il, _Args&&... __args) { this->_M_reset(); @@ -795,9 +785,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { __lhs.swap(__rhs); } template - constexpr optional::type> + constexpr optional> make_optional(_Tp&& __t) - { return optional::type> { std::forward<_Tp>(__t) }; } + { return optional> { std::forward<_Tp>(__t) }; } // @} group optional _GLIBCXX_END_NAMESPACE_VERSION -- 2.11.4.GIT