From patchwork Wed Jan 17 02:36:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Palka X-Patchwork-Id: 84223 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id CA56138582AC for ; Wed, 17 Jan 2024 02:37:55 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org 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 C5000385842D for ; Wed, 17 Jan 2024 02:36:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C5000385842D Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org C5000385842D Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705459013; cv=none; b=gJmNoFlUrjdjPi1lqVCo0//11pIlq1Je79HZuXMtDzcdPb4KU7mWbO+85Vj9uQVGJWzyW/+rHaj9D0A5hKNFJDKIJBiuAhKIfLmXreOXndXmlRTFBLLgtErZu9fHXJ4IIIMPbdEoGz4qulmq1VBQTdCrWroMLA/1RKE28mDi1WM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705459013; c=relaxed/simple; bh=g1j4a+cyBaUpdSXaBgz7TNIS3hs6FLvFKOGwmr5Az10=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=O9/+nDDe1iM9717pTXOma9SSDhyG+boW/YTvUqjBI+QTiSbR3HSExURL4hIepQu00Tu/C1998jXMgv4fMSlCxVq1b/V7pHXPPzTZe/BLRiJS3Cy0vsCI/rfRrfhkjUFx0rG5bzWgMn867DFW3qUtiDDmYlmEid/iC7pgeemA6Oo= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1705459011; 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=pd+LtgSHv22EY0sYoNZhbLwEdoEw7x2JW08Tcc/NJJg=; b=heWrZvV7eyK7XAG22GteI8BInXnsHLEmqXJkZq1v5Oy8lHXKMJruKqS9/jZYN7ZVotU4VS wFHMySOJhCX8Rctdx9ZmUIaGc5E2+Y7gEBKX8b6JTaA9eLO2d2QBfkQzdjicZ5WjVeIWBZ wZH0JKWJ7f2wMk6YWHZax4h8NVqj54E= 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_256_GCM_SHA384) id us-mta-354-4cmGvCugNEeNdW71Zd1Qtw-1; Tue, 16 Jan 2024 21:36:45 -0500 X-MC-Unique: 4cmGvCugNEeNdW71Zd1Qtw-1 Received: by mail-qk1-f197.google.com with SMTP id af79cd13be357-78333746457so946374185a.2 for ; Tue, 16 Jan 2024 18:36:44 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705459004; x=1706063804; 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=pd+LtgSHv22EY0sYoNZhbLwEdoEw7x2JW08Tcc/NJJg=; b=k6CKri4vzOKCp4qsZxGPVam/Ky9snRkQ1Gil49xXZ8jM6Yx67+5hpzbQgntE0IgE/4 xJzpFYwYffMLOfHtEwvJYni3JvhYf2vloipeAX4Pp63cFg5OJ/zKXv5Nv6X49FkM8JVf 15GeCTveHppGPd4MBSV+3X+877qk40gn5N8bzUmg1X77E32eac/QWsfHmbjY+S2dgiio vsfO/rjgvASxE4ZZh14jbpcVEtKGf/opUxeEKWmbaINqt8QQRD54/LBZifZWxbch7a3B ufqWQjRGsre06VVXYsXMrAANUfO8gE1vi8qebfNaWoYLS8wOc+F2908/Qb+MM3Z4Y53z 0p6g== X-Gm-Message-State: AOJu0YxTd7nS9up3Aowbw3A/u21pMm7TJ0vUEdG7qcfSpjfYMEJmQ8jz RwwJAnDQM26fY3od3GlWHvbGA1mZ76hEgV4cp+JiS+wdP1byNj3oQmdZRxz3eo2I/uTabY9YhIJ 9nDr0utNQHn5SDL5uYD4gFzmzAOVlf3ZBOLfGrfBzgWBDTJafRRh8vDzAVyXvQd4vnxMQzyN5D7 UgEwuuZIk= X-Received: by 2002:a05:620a:2096:b0:783:22b2:7bcc with SMTP id e22-20020a05620a209600b0078322b27bccmr7664316qka.21.1705459004072; Tue, 16 Jan 2024 18:36:44 -0800 (PST) X-Google-Smtp-Source: AGHT+IENXhdAM8WQCMG44Ys1G40T0Yf3NyLFMf564jUFtlEvWceH/DxHKxGFn33twSAjkc8vD03tBA== X-Received: by 2002:a05:620a:2096:b0:783:22b2:7bcc with SMTP id e22-20020a05620a209600b0078322b27bccmr7664307qka.21.1705459003772; Tue, 16 Jan 2024 18:36:43 -0800 (PST) Received: from localhost.localdomain (ool-457670bb.dyn.optonline.net. [69.118.112.187]) by smtp.gmail.com with ESMTPSA id j22-20020a05620a147600b007832104bba9sm4198401qkl.23.2024.01.16.18.36.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jan 2024 18:36:43 -0800 (PST) From: Patrick Palka To: gcc-patches@gcc.gnu.org Cc: libstdc++@gcc.gnu.org, Patrick Palka Subject: [PATCH] libstdc++/ranges: Define _S_has_simple_call_op on newer adaptors Date: Tue, 16 Jan 2024 21:36:41 -0500 Message-ID: <20240117023641.3389770-1-ppalka@redhat.com> X-Mailer: git-send-email 2.43.0.367.g186b115d30 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-14.5 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_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=unavailable 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.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Tested on x86_64-pc-linux-gnu, does this look OK for trunk? -- >8 -- This compile-time and diagnostic improvement[1] is less important in C++23 mode where deducing this is available and used in _Pipe, but for benefit of C++20 mode and for consistency let's set the flag on the most recently added range adaptors which lack it. [1]: Defining _S_has_simple_call_op=true for a range adaptor closure object signals that the adaptor has an operator() that's not overloaded according to the constness/value category of the object, which in turn allows us to implement the operator() of the composition of such adaptors in a simpler way. libstdc++-v3/ChangeLog: * include/std/ranges (views::_Adjacent::_S_has_simple_call_op): Define to true. (views::_AsRvalue::_S_has_simple_call_op): Likewise. (views::_Enumerate::_S_has_simple_call_op): Likewise. (views::_AsConst::_S_has_simple_call_op): Likewise. --- libstdc++-v3/include/std/ranges | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libstdc++-v3/include/std/ranges b/libstdc++-v3/include/std/ranges index 7ef835f486a..66502cc1da4 100644 --- a/libstdc++-v3/include/std/ranges +++ b/libstdc++-v3/include/std/ranges @@ -5669,6 +5669,8 @@ namespace views::__adaptor else return adjacent_view, _Nm>(std::forward<_Range>(__r)); } + + static constexpr bool _S_has_simple_call_op = true; }; template @@ -8844,6 +8846,8 @@ namespace views::__adaptor else return as_rvalue_view(std::forward<_Range>(__r)); } + + static constexpr bool _S_has_simple_call_op = true; }; inline constexpr _AsRvalue as_rvalue; @@ -9147,6 +9151,8 @@ namespace views::__adaptor constexpr auto operator() [[nodiscard]] (_Range&& __r) const { return enumerate_view>(std::forward<_Range>(__r)); } + + static constexpr bool _S_has_simple_call_op = true; }; inline constexpr _Enumerate enumerate; @@ -9253,6 +9259,8 @@ namespace views::__adaptor else return as_const_view(std::forward<_Range>(__r)); } + + static constexpr bool _S_has_simple_call_op = true; }; inline constexpr _AsConst as_const;