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 65DC23858C60 for ; Wed, 17 Jan 2024 02:36:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 65DC23858C60 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 65DC23858C60 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=1705459007; cv=none; b=O9R4/MnYSUZ+SgGbwIoTIKs4n3LuNq3V9IVeETWz/1hiZJHyt6QkF9BOXKjt47FUNz7umJ7SCy5bM759sZFaLr3XKDsk+j61a0eGyH7IFFWq8H30DvzBhFCKEVRYMoziDd4df+SI1nIzMBh3X1PVQTlXFa7pbdk7g/TYei2o1yc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705459007; c=relaxed/simple; bh=g1j4a+cyBaUpdSXaBgz7TNIS3hs6FLvFKOGwmr5Az10=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=shz7MhQXzDMT8Xz+pKde4+9FHgcBELpYhAQsTh+V2QWDGwHdPdKA7q6tIs9jlMdg2oYBP/4JNbZDI8qzZfwkDYaQUOVzW9bWN63wMc5aSiL5Vo3ipDfoHTL/ASbwiUoS2R8rrHTWpvJNNvStUIVLlcOsDz9nePpxIOqKElyu6o0= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1705459006; 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=OvJgEHSkSs4Th+nSiZvFlN9b/cwoYXLtdQv1AMOwDB7Z2DBqJ1fXEUDGUNCzYz1Okd+Rol 02N+Sfb8gK3rBDAZOPdARq4/gcdrmorPMx+YP8aUm7eNqtmy0nPNNmfnPhoQhPbkzc2MR9 GTVPDF11R/TUzj0psIr/q2cuXuL4eDI= 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-332-c_ZSYLa2NE6mZl7wYhpYfQ-1; Tue, 16 Jan 2024 21:36:44 -0500 X-MC-Unique: c_ZSYLa2NE6mZl7wYhpYfQ-1 Received: by mail-qk1-f197.google.com with SMTP id af79cd13be357-7831f409539so1442136885a.0 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=ZhAO8iULjUCZue8k1+pi1ca1Xis6nIs6+ITLUZY2giX9WgQZyQgTCFMagkJncxe4vg TLy/Wa40bYF2lZMTWImZqLMSSHYpGJCGKn8TOaE3N59S49zbceCYoR2/YSQVJ5FCqIMP Q0imS6Rq4KXI6Re5bDAO8StxL49IaXApYOHoSPZpYY03WOLTe3SiUVN9FmKPE99Y7xJg yeWF03vxIxIAWVWDtNJgj4uucdEt47XoM9K6AW8akj2uLfaQKXi7bjAh3OPXdTPR0mqb TpYGMRQR1I7dES2izb6Do72WsAxEAtfdExqc81hjFGBtsiuOd0Y+Y73KUJTYQ8MOSZjN OgaA== X-Gm-Message-State: AOJu0Yy1KkwddzbWQyf5Ct/9WR4wc2IM32xm9s+yhWMas2lkoZ2DT+ba VKyxfP/cneDSqvSp2o0ooHWYZudBns/XnYgXBev3jCQKtnpX0PS4jx7VAICQhN55Kqalrl83oqY WLmQRzg8ZoUkhyf+xvAHPZHI= X-Received: by 2002:a05:620a:2096:b0:783:22b2:7bcc with SMTP id e22-20020a05620a209600b0078322b27bccmr7664311qka.21.1705459004009; 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 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true 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=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: 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; -- 2.43.0.367.g186b115d30