From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id A793E3858D39 for ; Fri, 2 Sep 2022 18:10:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A793E3858D39 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1662142230; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=+QvfsgVhxz3OAoa5+zdIDKV5ZJGgwpMLIjST0152Jl0=; b=FS2vw6+Lg2OowBhgd5yFnZmfZB7iyoyPkknWoZ/Q41vYmzrSnqswb51KrSGU/3PWslx7iR Vmo3l6F6zSkfoHySGeZaljFSd7bK6lsuAevA/CJRNLkR4ZaCf62RAitxWX2GJ/43qA+SwJ w2uvpbUWCWFAXHb2cZT+6wc8zq80XuA= Received: from mail-qv1-f69.google.com (mail-qv1-f69.google.com [209.85.219.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-67-uiKrcr29NFalvf_IbXFJvA-1; Fri, 02 Sep 2022 14:10:28 -0400 X-MC-Unique: uiKrcr29NFalvf_IbXFJvA-1 Received: by mail-qv1-f69.google.com with SMTP id ls9-20020a0562145f8900b004990aeb7bd6so1761218qvb.4 for ; Fri, 02 Sep 2022 11:10:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date; bh=+QvfsgVhxz3OAoa5+zdIDKV5ZJGgwpMLIjST0152Jl0=; b=sS2kTs7oqzwYTqDjuR3STDtd+sU38LdEKn1vqxvMv+2x5M9CrX8nz/hPELVXPdWr0p 1MPE3gn3tXYWL7pnK5YFMMiBYYMJBl3S5P5dC4Xdt8thU5ZaAZMpoGWC/fAMgPMY4LHd kiSGs9kCAhzmpgX1Tt3NAKdqWrGny7XAn0dz3lPwIhcaedPr2RsFIYZ0CFKLixMYRWMm go9Gx+jjZ5nyaimCEhA8EJtpYg5J7n1QR3XcJTqreolZyfBkH3Hgp6RS1G87juFKYs3Q 1RVTF3JHDBZzJiM0tXXLWdEN6oVxCd6B8xSZzcFSSVLU2LrTIgak3Ml1x2Om+ZzQVEvF AFbg== X-Gm-Message-State: ACgBeo0yN2+pqSSlt/6ur9ty4CxySsTbIqKBGBu3+W3/HoMuxYgVm/IG LjtWjOd9zVt9EklbZLwpFSVX1EpHDR4YIHwHcLM6LC7w+Qq1DQFObUpF76bK/JWgdCzlPLPFR3y h2GycEJfeKRcgrrejpggJbaTk+UVc/Pw= X-Received: by 2002:a05:620a:884:b0:6bc:2056:1005 with SMTP id b4-20020a05620a088400b006bc20561005mr24135644qka.293.1662142228161; Fri, 02 Sep 2022 11:10:28 -0700 (PDT) X-Google-Smtp-Source: AA6agR6WAg+j2+lzVG/REQzPmjzkXXg9Sr3ZxwXwMYWdhWtWXW8ipjuNoMMH9NE9Nb75xQac/WuyUDECz7A/2deYe7w= X-Received: by 2002:a05:620a:884:b0:6bc:2056:1005 with SMTP id b4-20020a05620a088400b006bc20561005mr24135622qka.293.1662142227935; Fri, 02 Sep 2022 11:10:27 -0700 (PDT) MIME-Version: 1.0 References: <20220902163816.748210-1-ppalka@redhat.com> In-Reply-To: <20220902163816.748210-1-ppalka@redhat.com> From: Jonathan Wakely Date: Fri, 2 Sep 2022 19:10:17 +0100 Message-ID: Subject: Re: [PATCH] libstdc++: Consistently use ::type when deriving from __and/or/not_ To: Patrick Palka Cc: gcc-patches@gcc.gnu.org, libstdc++@gcc.gnu.org X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-14.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Fri, 2 Sept 2022 at 17:39, Patrick Palka via Libstdc++ wrote: > > Now that these internal type traits are again class templates, it's > better to derive from the trait's ::type (which is either false_type or > true_type) instead of from the trait itself, for sake of a shallower > inheritance chain. We usually do this but not always; this patch makes > us consistently do so. > > Tested on x86_64-pc-lnux-gnu, does this look OK for trunk? (Compile > time for join.cc decreases by about 0.5% with this, avg of 10 runs.) OK, thanks. > > libstdc++-v3/ChangeLog: > > * include/std/tuple (tuple::_UseOtherCtor): Do ::type when > deriving from __and_, __or_ or __not_. > * include/std/type_traits (negation): Likewise. > (is_unsigned): Likewise. > (__is_implicitly_default_constructible): Likewise. > (is_trivially_destructible): Likewise. > (__is_nt_invocable_impl): Likewise. > --- > libstdc++-v3/include/std/tuple | 2 +- > libstdc++-v3/include/std/type_traits | 10 +++++----- > 2 files changed, 6 insertions(+), 6 deletions(-) > > diff --git a/libstdc++-v3/include/std/tuple b/libstdc++-v3/include/std/tuple > index ddd7c226d80..26e248431ec 100644 > --- a/libstdc++-v3/include/std/tuple > +++ b/libstdc++-v3/include/std/tuple > @@ -826,7 +826,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION > // then TUPLE should match tuple(UTypes&&...) instead. > template > struct _UseOtherCtor<_Tuple, tuple<_Tp>, tuple<_Up>> > - : __or_, is_constructible<_Tp, _Tuple>> > + : __or_, is_constructible<_Tp, _Tuple>>::type > { }; > // If TUPLE and *this each have a single element of the same type, > // then TUPLE should match a copy/move constructor instead. > diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits > index be9f2955539..c0bb1cf64e3 100644 > --- a/libstdc++-v3/include/std/type_traits > +++ b/libstdc++-v3/include/std/type_traits > @@ -235,7 +235,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION > > template > struct negation > - : __not_<_Pp> > + : __not_<_Pp>::type > { }; > > /** @ingroup variable_templates > @@ -845,7 +845,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION > /// is_unsigned > template > struct is_unsigned > - : public __and_, __not_>> > + : public __and_, __not_>>::type > { }; > > /// @cond undocumented > @@ -1222,7 +1222,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION > template > struct __is_implicitly_default_constructible > : public __and_<__is_constructible_impl<_Tp>, > - __is_implicitly_default_constructible_safe<_Tp>> > + __is_implicitly_default_constructible_safe<_Tp>>::type > { }; > > /// is_trivially_copy_constructible > @@ -1282,7 +1282,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION > template > struct is_trivially_destructible > : public __and_<__is_destructible_safe<_Tp>, > - __bool_constant<__has_trivial_destructor(_Tp)>> > + __bool_constant<__has_trivial_destructor(_Tp)>>::type > { > static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}), > "template argument must be a complete class or an unbounded array"); > @@ -2975,7 +2975,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION > struct __is_nt_invocable_impl<_Result, _Ret, > __void_t> > : __or_, > - __is_nothrow_convertible> > + __is_nothrow_convertible>::type > { }; > /// @endcond > > -- > 2.37.2.490.g6c8e4ee870 >