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: 188674 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:42cf:b0:101:a8e8:374 with SMTP id q15csp675059dye; Tue, 16 Jan 2024 19:41:22 -0800 (PST) X-Google-Smtp-Source: AGHT+IE/d+emgz1hWLFoR+pvHTC6HmhSf31hjw+UDxiwA8lSYRdHXNpBt0TpPDS7VIRbKDVxC8p4 X-Received: by 2002:a05:622a:4cf:b0:429:a3df:a315 with SMTP id q15-20020a05622a04cf00b00429a3dfa315mr10576309qtx.107.1705462881996; Tue, 16 Jan 2024 19:41:21 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705462881; cv=pass; d=google.com; s=arc-20160816; b=VleSkMlLucOh9ynqv8yt0mFd/ipS57eoEF53r6ypYEoSpG9I7NBAzYN0AFg9HYThBY VBMq/HFUo1fyu9IpxQ+VHKAmNq07Zt8DNjUg9dPGWmWf4kholCz1BZp64hAUOAjJkrcj tEyYctp3X7C2dOEXs80Bb80EGNyEbbJOyABtlwFCOJqf0aDpBqfxBynebZGXUhyCtvrf j6phHqOES7eOpLiaTaMKdSsYYTraEWpREDQkVGlV4Ha/NEI7ke51lYzBfA53BejGWIDH k9YwU8EzUKVBrjlN1wjWlzLJO8gomI9jICuHWyoPClKA4QHsBsRiJ8nbclYoQhYXf8A+ YBCw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature :arc-filter:dmarc-filter:delivered-to; bh=pd+LtgSHv22EY0sYoNZhbLwEdoEw7x2JW08Tcc/NJJg=; fh=EVSvWd94bH3+6DLHxQIQnUkCnGLOu/mRCJOpcO366zA=; b=qthq5xX/damzZjoDy8M06llTISG7FWeFHsnCsmvc1H3TGJMz/bCyFRr2IeeUk2auNc vQpPzm0Hq4V7kE8hsKp95xZpe6M/nNcys4r+YpQLqLeefZ9hqb6ObS4WU2I39baD0mao wnIVyR7ubEuDXnD6tG7VJ8P6IkpvnuwfhisqFTsdqtr05LTXu92hdN24qSZs15RSH8uN Dj0zPS1kzcMcfJ3dnO0FGG0/viaTU2XuiTwPOtKB7erYNMiJwdYriCd5rFCOhtdSq+r4 YxvP0wsy5PreTq9wP2j84CXmeHLVCnlOPiVtEtqkC6uRlGAEz5qS1DhR2pKouQGwsQXP jn4g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=heWrZvV7; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id d22-20020ac85ad6000000b0042a0a088e0fsi1604049qtd.281.2024.01.16.19.41.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jan 2024 19:41:21 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=heWrZvV7; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 87C5B3858035 for ; Wed, 17 Jan 2024 02:38:10 +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-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+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788307447158553318 X-GMAIL-MSGID: 1788307447158553318 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;