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 F0CC63857814 for ; Tue, 23 Aug 2022 15:14:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org F0CC63857814 Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-669-jpVbqBWIPim4WCE0oADEjA-1; Tue, 23 Aug 2022 11:14:12 -0400 X-MC-Unique: jpVbqBWIPim4WCE0oADEjA-1 Received: by mail-qk1-f199.google.com with SMTP id bj2-20020a05620a190200b006bba055ab6eso12284476qkb.12 for ; Tue, 23 Aug 2022 08:14:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:references:message-id:in-reply-to:subject:cc:to:date :from:x-gm-message-state:from:to:cc; bh=QNXiyVoxR9NALyDFnbwas4k2SCxSVQMETenVN2/RRYg=; b=43eR+AMu+UN1smA8oMjn0RjG9Tic/Hriz8VnDMPr26QazjVxFHwSADin9Ex/t6L/Mg R6TGflVjl9XbGzOTnDiixqVJaPoDAeYOm2Gh5tmI4Q88gE+Wjl0WS6FbIUNXVfu2//DU CsP6ITuGA8XWjxb0V7yPvekyUURsF9goYLYZASHzOY2Wzia8dbtrJCtx2A70/U0u6t9s PYiZX20MdQ/WQVLzJ1Hk4mI6H78F1XMnJT+E6sZhWPrcmDMjqGgOP4mxzjnqWvnLgxVX iW3OjArbZTLu1mrXldR+0fDGorMmYIszYkbehZg/JC93BKNlgrMYtki5CHzD+HW1ADZc FyXw== X-Gm-Message-State: ACgBeo34k/ZGgr7bntSqVdsGwlmNioFc2Dt8Gud6DfwRlAqKkL7LaCRk yILrIEyzOBYQxASDj9fTbw8p8DWk/ItLQJLrexnEKt9Xj3euTsZvZzQzEWCMfNDxEjWtzXmxr4e fOxcLI2JPCLifI83MIw== X-Received: by 2002:ac8:578f:0:b0:344:6aee:a465 with SMTP id v15-20020ac8578f000000b003446aeea465mr19256699qta.360.1661267652497; Tue, 23 Aug 2022 08:14:12 -0700 (PDT) X-Google-Smtp-Source: AA6agR68nhKMJKGpi+B92Un1wL53R8vKPXzEIosHkjHgyMHGnUZmHARdKLPTNI9L+WbUz4iZnDogFQ== X-Received: by 2002:ac8:578f:0:b0:344:6aee:a465 with SMTP id v15-20020ac8578f000000b003446aeea465mr19256675qta.360.1661267652250; Tue, 23 Aug 2022 08:14:12 -0700 (PDT) Received: from [192.168.1.130] (ool-457670bb.dyn.optonline.net. [69.118.112.187]) by smtp.gmail.com with ESMTPSA id s21-20020ac85295000000b00343028a9425sm10797836qtn.16.2022.08.23.08.14.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Aug 2022 08:14:11 -0700 (PDT) From: Patrick Palka X-Google-Original-From: Patrick Palka Date: Tue, 23 Aug 2022 11:14:11 -0400 (EDT) To: Jonathan Wakely cc: Patrick Palka , gcc-patches@gcc.gnu.org, libstdc++@gcc.gnu.org Subject: Re: [PATCH 2/3] libstdc++: Implement std::pair/tuple/misc enhancements from P2321R2 In-Reply-To: Message-ID: References: <20220823013500.1756466-1-ppalka@redhat.com> <20220823013500.1756466-2-ppalka@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, KAM_NUMSUBJECT, RCVD_IN_DNSWL_LOW, 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: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Aug 2022 15:14:19 -0000 On Tue, 23 Aug 2022, Jonathan Wakely wrote: > On Tue, 23 Aug 2022 at 02:36, Patrick Palka via Libstdc++ > wrote: > > --- a/libstdc++-v3/include/bits/stl_pair.h > > +++ b/libstdc++-v3/include/bits/stl_pair.h > > @@ -212,6 +212,19 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION > > swap(second, __p.second); > > } > > > > +#if __cplusplus > 202002L > > + /// Swap the first members and then the second members. > > + constexpr void > > + swap(const pair& __p) const > > + noexcept(__and_<__is_nothrow_swappable, > > + __is_nothrow_swappable>::value) > > This could use __and_v (which is just __and_::value today, but could > theoretically be optimized to use a requires expression and avoid > instantiating __and_ one day). > > Is consistency with the C++11 overload more important? I *hope* we > won't need to make many changes to these noexcept-specifiers, so the > maintenance burden of using __ad_::value in one and __and_v in the > other shouldn't be too high. Makes sense. > > > @@ -710,6 +792,15 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION > > noexcept(noexcept(__x.swap(__y))) > > { __x.swap(__y); } > > > > +#if __cplusplus > 202002L > > + template > > + requires is_swappable::value && is_swappable::value > > is_swappable_v instead of ::value here ... this is already using a > requires-clause and so is substantially different to the old overload > anyway. > > > > > + > > // tuple swap > > _GLIBCXX20_CONSTEXPR > > void > > swap(tuple& __in) > > noexcept(__and_<__is_nothrow_swappable<_Elements>...>::value) > > { _Inherited::_M_swap(__in); } > > + > > +#if __cplusplus > 202002L > > + constexpr void > > + swap(const tuple& __in) const > > + noexcept(__and_<__is_nothrow_swappable...>::value) > > __and_v ? > > > > > > _GLIBCXX20_CONSTEXPR > > void > > swap(tuple& __in) > > noexcept(__and_<__is_nothrow_swappable<_T1>, > > __is_nothrow_swappable<_T2>>::value) > > { _Inherited::_M_swap(__in); } > > + > > +#if __cplusplus > 202002L > > + constexpr void > > + swap(const tuple& __in) const > > + noexcept(__and_<__is_nothrow_swappable, > > + __is_nothrow_swappable>::value) > > __and_v ? > > > Thanks for doing this, those changes looked tedious to implement and test! > > If you agree with the suggestions to use _v variable templates, this > is OK for trunk with those changes. I am willing to be persuaded to > not use the variable templates if there's a good reason I've missed. Agreed on all points! Thanks a lot.