From patchwork Tue Nov 4 02:51:27 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 406430 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id ABAB41400EA for ; Tue, 4 Nov 2014 16:18:53 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; q=dns; s= default; b=msGAo6NqZHtcMdSxVa77kslBoBNwmnEBbziRADTiSkTOD45WOzJ9O 4XtglNK3OaKaxl9kLA3MwSnE2axoOXBm9FioCGwP9xJanbGj+qFOkXIIw7Ca8ULv G012qWOrBAUJBcGOAbocx/wC0nU5KiR+eFJOU11OTWVsy2r5kpQ/yU= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; s= default; bh=V9kGzBhFOa1CUDnmDBDb7pgu2zs=; b=VHTFdKntxyxU7VLbYw96 X3wcefiX5ExbxZuJwlDuGbxM/5JQPVBTq76U2xGz8Zthw6k6Gdb6YIYKsA0pUurS DSFNA3STD0cmGXA+4wmQmPGevCC/OPaPIDGgObS2AMBhsYwhHo58aDFnRpZb/9yS ZQi/0RZEESdJM7oeNB5ZrXs= Received: (qmail 21141 invoked by alias); 4 Nov 2014 02:51:33 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 21114 invoked by uid 89); 4 Nov 2014 02:51:32 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 X-Spam-User: qpsmtpd, 2 recipients X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Tue, 04 Nov 2014 02:51:31 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id sA42pTDc000540 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 3 Nov 2014 21:51:29 -0500 Received: from localhost (ovpn-116-19.ams2.redhat.com [10.36.116.19]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id sA42pSh5020206; Mon, 3 Nov 2014 21:51:29 -0500 Date: Tue, 4 Nov 2014 02:51:27 +0000 From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [patch] Use aliases for type traits in C++14 mode. Message-ID: <20141104025127.GB3961@redhat.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) commit cdb81d65750569f86a526856c99c2ef3c5266d11 Author: Jonathan Wakely Date: Tue Nov 5 23:21:01 2013 +0000 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. diff --git a/libstdc++-v3/include/bits/unique_ptr.h b/libstdc++-v3/include/bits/unique_ptr.h index ce38c5a..5c2c534 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 973775b..7e01abe 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 For C++14-only components we can use the aliases for type traits. Tested x86_64-linux, committed to trunk.