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 1450C3858D38 for ; Tue, 12 Sep 2023 01:08:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1450C3858D38 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=1694480936; 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: content-transfer-encoding:content-transfer-encoding; bh=e0YlesQ3ZxaqHOAlXms/MG1J4jazQRoN4Q81MHMbw3Y=; b=MI+MsYRNl9Jodd8oaaklPPeeXLzSPpZZw03EJrT+kbnCP9UteDjrQVSYrbGJCPy/idFmIB p5Br9/VDsJOOW9GtrwucOppemwv6HC1MAmVXWg6ia0ofBt2Edq/a+GDztqwzQw+V0eebOy hMo9A22OrD/GDrSj/EDmfh4Q41YFJms= Received: from mail-vs1-f70.google.com (mail-vs1-f70.google.com [209.85.217.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-683-voeanfSXMv6zLzDjf7dsHA-1; Mon, 11 Sep 2023 21:08:55 -0400 X-MC-Unique: voeanfSXMv6zLzDjf7dsHA-1 Received: by mail-vs1-f70.google.com with SMTP id ada2fe7eead31-44d46b22ee9so1692875137.0 for ; Mon, 11 Sep 2023 18:08:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694480935; x=1695085735; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=e0YlesQ3ZxaqHOAlXms/MG1J4jazQRoN4Q81MHMbw3Y=; b=ofSYTjgWS1NyfIJWiHtHqllNlWEbo6bGOClkcbbpgDX3LQHueIOr0vbsFwr5OVorRe AC6YO2dFubzFDZP9/E5bQb9i3sS/VyYnkNQsunF64M3wfXpuDPa75nJp/YPAFX0cdz8b WzyKLw+RN4YV/SQGfNY3m+uw+4pk0HFyaZHduYvO3HWORx1xPuJkjxP4kkuTLmWp9qTZ q1595mpcXGKVxCs6KTBBkWUMSLUTESe76g098rIms3xONrMWELkzrExpD4+8N9qfjv+v 5R/hB4w7nYLK0eXO5MZ6shsITHDbz5yjHrGlwkC6tZiTbtuV9mmPObNb5HP+GL1yONe6 m/3A== X-Gm-Message-State: AOJu0Yy8R5GQ59+QtOVSPLRqYNavhdKkKGyiKqFmFKfGvNoctsVOSF3a 66D9F+rajt61lWgjUQsKgDIAmam1fWApOhOaPsqjGk4BQu3oPtgbvTyTcF5L4OzpKb3gYatd7QE qsPJ7oUoP2rM/rHo= X-Received: by 2002:a67:f594:0:b0:44d:40b1:9273 with SMTP id i20-20020a67f594000000b0044d40b19273mr8447008vso.4.1694480934973; Mon, 11 Sep 2023 18:08:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGG9rywF8Bdx4bQmmY98ImS6YyreAmm8LN5TWxYJmLwEDsnJ0jn5kly84kPnF4zFY7PSwtu/w== X-Received: by 2002:a67:f594:0:b0:44d:40b1:9273 with SMTP id i20-20020a67f594000000b0044d40b19273mr8447003vso.4.1694480934672; Mon, 11 Sep 2023 18:08:54 -0700 (PDT) Received: from localhost.localdomain (ool-457670bb.dyn.optonline.net. [69.118.112.187]) by smtp.gmail.com with ESMTPSA id qj10-20020a056214320a00b00655f35dcbcasm877643qvb.75.2023.09.11.18.08.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Sep 2023 18:08:54 -0700 (PDT) From: Patrick Palka To: gcc-patches@gcc.gnu.org Cc: libstdc++@gcc.gnu.org, Patrick Palka Subject: [PATCH 1/3] libstdc++: Remove std::bind_front specialization for no bound args Date: Mon, 11 Sep 2023 21:08:50 -0400 Message-ID: <20230912010852.1027184-1-ppalka@redhat.com> X-Mailer: git-send-email 2.42.0.158.g94e83dcf5b MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-Spam-Status: No, score=-13.9 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=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: 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. 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