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 000153858D39 for ; Wed, 31 Aug 2022 10:26:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 000153858D39 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=1661941609; 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=XGC+sBvxvWqjOY7KPVQoJe23nsvA7fRqvszYmwBICno=; b=PhgnsdDCYgv1Pyw3mgCdpH3rPjLtf3YaC+OPaLEeLxJdzHFS2bV5FXw0TgRYCmQiy1ZFJv jz/yPV/J6VpHYb8vFtGiQchT/yCvnZgCvBsYWCQmuYWX3+9r7Gy76QislrF1TT2NS37q7A wiDtBJsDmcq/XSuEw+SX+ESa4rmduAU= Received: from mail-qt1-f198.google.com (mail-qt1-f198.google.com [209.85.160.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-32-9An_D7b2NyKgT0SdM7D5jg-1; Wed, 31 Aug 2022 06:26:48 -0400 X-MC-Unique: 9An_D7b2NyKgT0SdM7D5jg-1 Received: by mail-qt1-f198.google.com with SMTP id ff27-20020a05622a4d9b00b0034306b77c08so10824622qtb.6 for ; Wed, 31 Aug 2022 03:26:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc; bh=XGC+sBvxvWqjOY7KPVQoJe23nsvA7fRqvszYmwBICno=; b=ASIqgIo+zcZPZ/LWiRJJHc1FM3/s2ILB2URkxfltMnaz9vIeNGvG6B0nfRqYkMNAHE 98LoGuh6vdo49bmo+7xtXaYKCEVi4QSE8w4v+QgxXmFjpTZGQNvNn4zMZXD9c3zb9uFe h2Akb2WIZ5ToQgh0iQ1GCj435irZsKXXbUgacD2/56fmCqvs6amAguTevZvpL4HStgM8 dosA+fqNAnlhO8ho39NUlqejI227n4Pl3l61DsbiGyphiwVqZHGcU10mLZF4bPW245xB /s1W7oLtmoUkt6g6INowxL9qc0qALl8VmhaZEimZxhS2pR1ERYA5WzZ7IPjsGkpDZliK HS9g== X-Gm-Message-State: ACgBeo2W8lv8dktL1/zIW0t/EEIsf58MvyZtAfDN9P4HrLCXCCARKZ3Q yUU+/7FGW+kyh2WvtB5XdeLDH2sRBe0OiFohEdvOXO+N3pCvXcKplYm+lCwVJzNcQ9OqLfjDUfl ofXDvjo19As6jOTWKC5E/jOVZ/gbaeCM= X-Received: by 2002:a05:620a:688:b0:6bb:29aa:4ce4 with SMTP id f8-20020a05620a068800b006bb29aa4ce4mr14942140qkh.18.1661941608043; Wed, 31 Aug 2022 03:26:48 -0700 (PDT) X-Google-Smtp-Source: AA6agR7IUFgH6vaAU0UliJDoEohM/2q+yVcoi9ShiQIWx6BhrhmsgMxugdvD57fn64AorRe8U/nmxC1CLlz/OuUFCrg= X-Received: by 2002:a05:620a:688:b0:6bb:29aa:4ce4 with SMTP id f8-20020a05620a068800b006bb29aa4ce4mr14942132qkh.18.1661941607826; Wed, 31 Aug 2022 03:26:47 -0700 (PDT) MIME-Version: 1.0 References: <20220830171335.54110-1-ppalka@redhat.com> In-Reply-To: <20220830171335.54110-1-ppalka@redhat.com> From: Jonathan Wakely Date: Wed, 31 Aug 2022 11:26:37 +0100 Message-ID: Subject: Re: [PATCH 1/2] libstdc++: Implement ranges::adjacent_view from P2321R2 To: Patrick Palka Cc: gcc-patches@gcc.gnu.org, libstdc++@gcc.gnu.org X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-6.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,KAM_NUMSUBJECT,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=no 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 Tue, 30 Aug 2022 at 18:14, Patrick Palka via Libstdc++ wrote: > > Tested on x86_64-pc-linux-gnu, does this look OK for trunk? > + constexpr > + _Iterator(__as_sentinel, iterator_t<_Base> __first, iterator_t<_Base> __last) > + { > + if constexpr (!bidirectional_range<_Base>) > + for (auto& __it : _M_current) > + __it = __last; > + else > + for (ssize_t __i = _Nm-1; __i >= 0; --__i) ssize_t is defined by POSIX in but isn't in ISO C or C++. It looks like MinGW defines it to ... something ... sometimes, but I don't think we can rely on it for non-POSIX targets. > + template > + struct _Adjacent : __adaptor::_RangeAdaptorClosure > + { > + template > + requires (_Nm == 0) || __detail::__can_adjacent_view<_Nm, _Range> > + [[nodiscard]] > + constexpr auto > + operator()(_Range&& __r) const Does this attribute actually work here? I thought we needed to use `operator() [[nodiscard]]` for functions with a requires-clause, because otherwise the attribute gives a parse error. Maybe I've misremembered the problem, and it just doesn't give a -Wunused-result warning. The decl above is setting off my spidey sense for some reason though.