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.133.124]) by sourceware.org (Postfix) with ESMTPS id 558E53858D3C for ; Tue, 23 Aug 2022 09:15:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 558E53858D3C Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-522-qxHGd5FwMH2Hqn5uzn24cg-1; Tue, 23 Aug 2022 05:15:20 -0400 X-MC-Unique: qxHGd5FwMH2Hqn5uzn24cg-1 Received: by mail-qk1-f197.google.com with SMTP id h8-20020a05620a284800b006b5c98f09fbso11738460qkp.21 for ; Tue, 23 Aug 2022 02:15:20 -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; bh=oLKUDMXD/21lCsytkIcKTiaL7kW6e1h5XAO89Di/ZEM=; b=ZH4PDtwmn6FpcYul0Zbi70N0DWIrNtRBymnHQloZ/4JqSmzKQfasGfetDvCOY9IQyT JLrlhoFyOCIUOi44ZqcQyVRdkQJkXjygHm0Qqm2q100aH0U0oQo+tRIhrKDa8EMfzTZt Y9CpVfe0rgNDuu5h5KMAL6v3VZdKFGX2rNztzv5Fq72ilkqeKQmYo4GlIWR8ooO0OBpw xlKqcXYQGAeuTtek4UfjTmGDZ3Vq4o1nX74qFESa18OrE6QvgY6tCe/B7bi1D89eF1Iw 3OzfBpqf49FM/0igpvdQ8U2UWgVdRgk/T9GOH9qZo1YBtKju1Gs6qidHRtZtxtMUuzkn 7I6Q== X-Gm-Message-State: ACgBeo1hwV53Gzyu0dVPyXEIOn5dYw62VYQKh9Jo/aV35fKtHubA33Sk pmW75kFCh1ZFtVFADrX/cEHxke6IKwfe0A0VAy7u5yJ6xopaxaS7oeJxHgzBbmbzdAG0SKKwMKz S6q5+8iBoO5iu6y5bGyUAdiljNxwuEQM= X-Received: by 2002:a05:620a:884:b0:6bc:2056:1005 with SMTP id b4-20020a05620a088400b006bc20561005mr4835755qka.293.1661246120290; Tue, 23 Aug 2022 02:15:20 -0700 (PDT) X-Google-Smtp-Source: AA6agR5ulzKe9AE4dcGjsQ52EHH1OWEz6TOwfifaCBNpk7UPSH91W6+1zOKdqKsLy2FYBjEB7NlXUdECgYJ5nAILHco= X-Received: by 2002:a05:620a:884:b0:6bc:2056:1005 with SMTP id b4-20020a05620a088400b006bc20561005mr4835749qka.293.1661246120083; Tue, 23 Aug 2022 02:15:20 -0700 (PDT) MIME-Version: 1.0 References: <20220823013500.1756466-1-ppalka@redhat.com> In-Reply-To: <20220823013500.1756466-1-ppalka@redhat.com> From: Jonathan Wakely Date: Tue, 23 Aug 2022 10:15:09 +0100 Message-ID: Subject: Re: [PATCH 1/3] libstdc++: Separate construct/convertibility tests for std::tuple 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=-6.7 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libstdc++@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++ mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Aug 2022 09:15:23 -0000 On Tue, 23 Aug 2022 at 02:35, Patrick Palka via Libstdc++ wrote: > > P2321R2 adds new conditionally explicit constructors to std::tuple which > we'll concisely implement in a subsequent patch using explicit(bool), like > in our C++20 std::pair implementation. But before we can do that, this > patch first adds members to _TupleConstraints that test for constructibility > and convertibility separately; we'll use the first in the new constructors' > constraints, and the second in their explicit specifier. > > In passing, this patch also redefines the existing predicates > __is_ex/implicitly_constructible in terms of these new members. This > seems to reduce compile time and memory usage by about 10% for large Nice. > tuples when using the relevant constructors constrained by > _Explicit/_ImplicitCtor (since we no longer have to redundantly expand > and process is_constructible<_Types, _UTypes>... twice for each pair of > such constructors). In order to retain maximal short circuiting, do > this only when constexpr if is available. Would we get similar benefits for C++11 and C++14 by doing: return __and_<__and_...>, __and_...> >::value; This is slightly more work in total, but if we have __and_ and __and_> then the A and B instantiations will be cached and can be reused. > Tested on x86_64-pc-linux-gnu, does this look OK for trunk? Yes, thanks.