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 [216.145.221.124]) by sourceware.org (Postfix) with ESMTPS id 22E553858CDA for ; Wed, 31 Aug 2022 10:26:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 22E553858CDA Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1661941611; 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=JWRtKmAfZTPdfS4uod1tGdwlp2y/mInBL+aIcCNKZn5VYS7hqbi0BfD8F/2SOuw3wzkoM1 +ACaISSAZiKOrj5OARLglrdKP+1vUpPkTf7BhwNegMLgLc7O1/K2qpJad0k076qYpK7cyR nCu+B+MLqfXgHaY2oA9yG9EzThoHOHs= Received: from mail-qv1-f72.google.com (mail-qv1-f72.google.com [209.85.219.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-2-Z0cYOjt8OpK0mlzZB5V_Zw-1; Wed, 31 Aug 2022 06:26:48 -0400 X-MC-Unique: Z0cYOjt8OpK0mlzZB5V_Zw-1 Received: by mail-qv1-f72.google.com with SMTP id ls9-20020a0562145f8900b004990aeb7bd6so4140725qvb.4 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=NjTMWlQXEPSdeyGTYypbAd5b9L8kv3uigWO3r1G76Jsmn4noujtCOTeYy2nNc8AItq HjmcsATIE8IeyM8eJtx35nN0a4DbjM5qk0Ab3W47pbxgVUhUHKVa3Py/VFEjtT605UvG V9XpP3nZD3OOMkevFE+NGPCymNoWjlJVedSqCEzEf5tT/iw0Jzv9D2pwEEnc0DKF9USX F2RMWdQM91CS8a1FYXviwFR6TbfGtzMWJo/ixVDnypbSVjvFfaHYZdPph3/JvfL+2x8u MGOrBpIpmd5AGArfraFsihJ4VV7ljZnJsrh7UaZKC0hYc/IKvVECIQL1FsH1G8zk0PZc ylNA== X-Gm-Message-State: ACgBeo1dPagaoEy2qslP1bqYMrWtc5F1gCPqTAyw4CKC/GXdqCRHsnWW 3bIa2fV8AsU2fFKwR6xYk+469+xeS6hMNTS7I9QHaeYCbBwOu0FMEqv16P3q0hwXpg4NseScZgi SgvVfqkWMLalAgNQWh0p06FFin63SecdiNg== X-Received: by 2002:a05:620a:688:b0:6bb:29aa:4ce4 with SMTP id f8-20020a05620a068800b006bb29aa4ce4mr14942141qkh.18.1661941608044; 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.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,KAM_NUMSUBJECT,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.