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 B77AB3858C1F for ; Tue, 12 Sep 2023 12:46:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B77AB3858C1F 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=1694522781; 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=EEna0gk5YHvPeLyVvsflYFG9PgFsJmVrEvZ8x0Uw7SQ=; b=YSO8H0aURy3JwACmxDCeJ/+ZNlkmrhlNgNPePgk5i8t4NAkjMhfx/hdhY7qUjb2dUfrPL9 +zl0LbsGLxxiUQEWTnJdEM1tGI42fnjDCpOHImaEp+sj1qLQkpkyOi3ul2QSIisPh3GvJU lIJawNNu72AW8mbfMouX9w8FjIDfSOw= Received: from mail-qv1-f72.google.com (mail-qv1-f72.google.com [209.85.219.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-661-TQKp_SiXMEW0Nm2OCa2EiQ-1; Tue, 12 Sep 2023 08:46:19 -0400 X-MC-Unique: TQKp_SiXMEW0Nm2OCa2EiQ-1 Received: by mail-qv1-f72.google.com with SMTP id 6a1803df08f44-64a5f9a165aso62861086d6.1 for ; Tue, 12 Sep 2023 05:46:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694522779; x=1695127579; h=mime-version:references:message-id:in-reply-to:subject:cc:to:date :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=EEna0gk5YHvPeLyVvsflYFG9PgFsJmVrEvZ8x0Uw7SQ=; b=EhcJEb5wMoBx1sTfnpZxDkd8sLyAERMjuvJbOII9jxbRFfTiDZYVgur96R5Lqw6Iaj IuTRvnV7wP9RjLnJpnOK1EvHHJqy5+jDHax714RS1EXZzi+Zi0fGUUNDknPzKUOrJ1ND uhflirEAoUwlOU9tEskdtEfS2u1LsISsfxBlpMN2mmA4L538WEg+FIgpJRT/8VmWfNL2 UnkZcrmL/awGwHGjx82zjmwtN5leJCc98oTf9EfyXX5VMvE5Nqc5PsUpeuPJu/4jkDJU 9YHDx8zigsOlB/yMguO5wJHQX81csdDJW6txQu8h9m4yTFr3o4mgVDEQdKMSW9JcXHWT rwOg== X-Gm-Message-State: AOJu0Yxs1qKsCBUxyVW1FCHEvMbJDDEQQmYEzh9BNRJ4osHvRyfS5nOY P3MG5QZl2DoSH26lSpu7wSTDey7p3/j0kUepIf0jiCxlxe+bpNjF1BQqSkAYgVtqqdmVxKSfwqB 5+C3VNAszVMbzj9Y= X-Received: by 2002:a05:6214:1772:b0:647:42ac:d7f2 with SMTP id et18-20020a056214177200b0064742acd7f2mr10227957qvb.63.1694522779389; Tue, 12 Sep 2023 05:46:19 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHfyEvQsjkRuYRxHPKXsVlfYVrqB1UpF/XpyX4f261TmVOs56KFYugjaXPEKJm4E3I36+i9lw== X-Received: by 2002:a05:6214:1772:b0:647:42ac:d7f2 with SMTP id et18-20020a056214177200b0064742acd7f2mr10227938qvb.63.1694522778985; Tue, 12 Sep 2023 05:46:18 -0700 (PDT) Received: from [192.168.1.130] (ool-457670bb.dyn.optonline.net. [69.118.112.187]) by smtp.gmail.com with ESMTPSA id s3-20020a0ce303000000b0064f4f9ddc72sm3623692qvl.21.2023.09.12.05.46.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Sep 2023 05:46:18 -0700 (PDT) From: Patrick Palka X-Google-Original-From: Patrick Palka Date: Tue, 12 Sep 2023 08:46:17 -0400 (EDT) To: Patrick Palka cc: gcc-patches@gcc.gnu.org, libstdc++@gcc.gnu.org Subject: Re: [PATCH 1/3] libstdc++: Remove std::bind_front specialization for no bound args In-Reply-To: <20230912010852.1027184-1-ppalka@redhat.com> Message-ID: <7975a204-228b-d2ef-cb9b-5ab4e71f1efe@idea> References: <20230912010852.1027184-1-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=-13.8 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_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham 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 Mon, 11 Sep 2023, Patrick Palka wrote: > This specialization for the case of no bound args, added by > r13-4214-gcbd05ca5ab1231, seems to be mostly obsoleted by > r13-5033-ge2eab3c4edb6aa which added [[no_unique_address]] to the > main template's data members. And the compile time advantage of > avoiding an empty tuple and index_sequence seems minimal. Removing this > specialization also means we don't have to fix the PR111327 bug in > another place. FWIW I don't feel strongly about removing this specialization. If we keep it We'd at least be able to reuse it for std::bind_back, and it wouldn't be hard to fix the PR111327 bug in its implementation. > > PR libstdc++/111327 > > libstdc++-v3/ChangeLog: > > * include/std/functional (_Bind_front0): Remove. > (_Bind_front_t): Adjust. > --- > libstdc++-v3/include/std/functional | 63 +---------------------------- > 1 file changed, 1 insertion(+), 62 deletions(-) > > diff --git a/libstdc++-v3/include/std/functional b/libstdc++-v3/include/std/functional > index 60d4d1f3dd2..7d1b890bb4e 100644 > --- a/libstdc++-v3/include/std/functional > +++ b/libstdc++-v3/include/std/functional > @@ -996,69 +996,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION > [[no_unique_address]] std::tuple<_BoundArgs...> _M_bound_args; > }; > > - // Avoid the overhead of an empty tuple<> if there are no bound args. > - template > - struct _Bind_front0 > - { > - static_assert(is_move_constructible_v<_Fd>); > - > - // First parameter is to ensure this constructor is never used > - // instead of the copy/move constructor. > - template > - explicit constexpr > - _Bind_front0(int, _Fn&& __fn) > - noexcept(is_nothrow_constructible_v<_Fd, _Fn>) > - : _M_fd(std::forward<_Fn>(__fn)) > - { } > - > - _Bind_front0(const _Bind_front0&) = default; > - _Bind_front0(_Bind_front0&&) = default; > - _Bind_front0& operator=(const _Bind_front0&) = default; > - _Bind_front0& operator=(_Bind_front0&&) = default; > - ~_Bind_front0() = default; > - > - template > - constexpr > - invoke_result_t<_Fd&, _CallArgs...> > - operator()(_CallArgs&&... __call_args) & > - noexcept(is_nothrow_invocable_v<_Fd&, _CallArgs...>) > - { return std::invoke(_M_fd, std::forward<_CallArgs>(__call_args)...); } > - > - template > - constexpr > - invoke_result_t > - operator()(_CallArgs&&... __call_args) const & > - noexcept(is_nothrow_invocable_v) > - { return std::invoke(_M_fd, std::forward<_CallArgs>(__call_args)...); } > - > - template > - constexpr > - invoke_result_t<_Fd, _CallArgs...> > - operator()(_CallArgs&&... __call_args) && > - noexcept(is_nothrow_invocable_v<_Fd, _CallArgs...>) > - { > - return std::invoke(std::move(_M_fd), > - std::forward<_CallArgs>(__call_args)...); > - } > - > - template > - constexpr > - invoke_result_t > - operator()(_CallArgs&&... __call_args) const && > - noexcept(is_nothrow_invocable_v) > - { > - return std::invoke(std::move(_M_fd), > - std::forward<_CallArgs>(__call_args)...); > - } > - > - private: > - [[no_unique_address]] _Fd _M_fd; > - }; > - > template > - using _Bind_front_t > - = __conditional_t>, > - _Bind_front, decay_t<_Args>...>>; > + using _Bind_front_t = _Bind_front, decay_t<_Args>...>; > > /** Create call wrapper by partial application of arguments to function. > * > -- > 2.42.0.158.g94e83dcf5b > >