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 CFCCC385780D for ; Tue, 23 Aug 2022 15:14:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org CFCCC385780D Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-302-q1f6lTlcOjO1RT3uWbodHA-1; Tue, 23 Aug 2022 11:14:12 -0400 X-MC-Unique: q1f6lTlcOjO1RT3uWbodHA-1 Received: by mail-qk1-f200.google.com with SMTP id x22-20020a05620a259600b006b552a69231so12280710qko.18 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=aroJeQQd1mkoJp1AFtQtFgU19xYHurmWTLDETS7d34KF97DOXyK3LRQ21e+i31XVth lkBOYjsknabpv0VxcE0dIBIKkZw19LjPyhOm/pTXu6AoSmPEsHDLYWEwxSYV0EQ7g8It fW0MgpJrQbsZKZeW0hW7bPHGXvHCk0B/LyQ2FomOF0S2sEyWJdpwwm8ScrjIsJ7qkzq7 uTLBziUBH3vC9gksjtf89bWzXy6Qr96w9G42iFjs0YwcgyclsN+SmUoE2/u3A2P3lcOe ihkoHrfu7LfC6rGvJ3fjTj9CMcCyT3DkdhhWPEFyh68Nfx097RXPBxBBt1ue8EITduQ3 jhpQ== X-Gm-Message-State: ACgBeo3w9sOli/9DxS6vdCUtGmcI9G6E2p1fZSrdO0gaaIlFvXrFBAvs ts89Epj31GMzQ6TEiRIg6/vzQrSmd5PPCqkQ+1uTWfRn2liaKlO1gTqV/PvFJMHqRk0Wn2PwI/H DCPxWZCsdxQkrZho= X-Received: by 2002:ac8:578f:0:b0:344:6aee:a465 with SMTP id v15-20020ac8578f000000b003446aeea465mr19256697qta.360.1661267652479; 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=-7.9 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=no 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 15:14:16 -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.