220 40109 <2b61d38aa27b27cdd8d87983ae0d56ed@example.net> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Andreas Fertig <src@andyf.de>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: for loops w/ reverse iteration
Date: Fri, 31 Aug 2018 09:32:20 +0200
Lines: 80
Approved: news@gmane.org
Message-ID: <2b61d38aa27b27cdd8d87983ae0d56ed@example.net>
References: <f96b3ed7-06a7-497a-b3e3-831495ae9b2f@isocpp.org>
 <CAGg_6+PEv86Keu6bjCcer2T8xn77vunuTjvFFqHi2zhO84mV+g@mail.gmail.com>
 <5e6ffea4-4c7b-4da1-9602-bbd670ce1f8a@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"; format=flowed
Content-Transfer-Encoding: quoted-printable
X-Trace: blaine.gmane.org 1535700618 18936 195.159.176.226 (31 Aug 2018 07:30:18 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Fri, 31 Aug 2018 07:30:18 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBC73HFG7UEARBB66UPOAKGQE3KEHK6A@isocpp.org Fri Aug 31 09:30:14 2018
Return-path: <std-proposals+bncBC73HFG7UEARBB66UPOAKGQE3KEHK6A@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-wr1-f71.google.com ([209.85.221.71])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBC73HFG7UEARBB66UPOAKGQE3KEHK6A@isocpp.org>)
	id 1fvdsj-0004pt-RR
	for gclcip-std-proposals@m.gmane.org; Fri, 31 Aug 2018 09:30:13 +0200
Original-Received: by mail-wr1-f71.google.com with SMTP id u12-v6sf7892611wrc.1
        for <gclcip-std-proposals@m.gmane.org>; Fri, 31 Aug 2018 00:32:24 -0700 (PDT)
ARC-Seal: i=2; a=rsa-sha256; t=1535700744; cv=pass;
        d=google.com; s=arc-20160816;
        b=IHjTbSx4OlnTjOifAz4Bj3JXnPnHonubeKIVriDjfDkWB4OzosUtt0RYo67CYgFj7E
         sqy8FoBeL8XgLEjkcRI0ITkfNJ5HKViyWbb7BWhHDdlR8Wno0rnLXwiUF+hyAu2YZ619
         LgSmGdLXT7QVLestSBLma7hUf9DFteNgGq1hccVQZRah855bar1s7fFBJx+wVfjMwVOK
         PR8Bx+K65yo//QqL1bdStxeXK75U4O3D3xwILokhFW2iVnp87TPDLILcvbTcNtg+WCcf
         B9le/5GQfKQJ6uQbxk27GcUrRyY0eGqEBirScQ6qc0UKIDBQxEe7vh8BghUTuvfVWvXw
         XOkw==
ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post
         :list-id:mailing-list:precedence:content-transfer-encoding
         :message-id:references:in-reply-to:mail-reply-to:reply-to:from:date
         :mime-version:subject:to:arc-authentication-results
         :arc-message-signature:dkim-signature:arc-authentication-results;
        bh=vx1zEsbucdczhh6T/1fXcr9Fph4k3yQpY9qaPTVgq94=;
        b=Yf0WT8vxh3Nh6E17vsJ0+1JSkAlpIyGzQ8X4aA5vwrIE3mI54u5rn6FbUuYUbENRiV
         yeuFJ0pHXdcGe4j3EHhCZOJAxfxO1hNK2tFU4CLEtv0uMqbtye5wEnoEXoRET5qksI49
         6XcN1YegEgUU4Pf9OF+LhPRxOiNSyOB3qB//tCZMIHLVIgKybtPAkyAHX+DuehPs51l/
         oSrlR/LMAcuxCFyhbgNEVLUiOgnna0SVcbf++ZLB/PYRefB0SnVlxyq8HnGRDrzsN1fW
         dsbYeEARes0F8/0N7SNRu43VBpIIfKxPwPvJeLFsMgBsi02a+0XQLPUrKYTobRpu3Mam
        
ARC-Authentication-Results: i=2; mx.google.com;
       spf=neutral (google.com: 212.227.17.24 is neither permitted nor denied by best guess record for domain of src@andyf.de) smtp.mailfrom=src@andyf.de
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=to:subject:mime-version:date:from:reply-to:mail-reply-to
         :in-reply-to:references:message-id:content-transfer-encoding
         :x-original-sender:x-original-authentication-results:precedence
         :mailing-list:list-id:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=vx1zEsbucdczhh6T/1fXcr9Fph4k3yQpY9qaPTVgq94=;
        b=v7A4/rmdnFfvIb2el4qytnnWtOpbeTMclTT0zGVZzp+W3LbncwdYxLUg60WsXSSgS3
         MFmr50crrzTFyolGKsMp8eIZRwR3CMJCgfyy12tmxC4A1Cujj8zcI0y9bb7rRDC0bQje
         0g+JBulFGIu8qIuYpnrUr8q8cgMCGPEkKw/xMEI/3VVbuBsrx5zgSk97jzXrG3EBEJI+
         Vg8cuS2+NGN/Yyk294XoNEbOw4Almihq4zL41gbLoDFgFg3RbzXHkZbgDqCZucwXNMMi
         gR+4HfHZkLW0hH+q0tLdDNg5RaV9d4vwZsasOgQ5sd3uYKAuK6Pjai3yp8099Qi7+7un
         Pp6w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:to:subject:mime-version:date:from:reply-to
         :mail-reply-to:in-reply-to:references:message-id
         :content-transfer-encoding:x-original-sender
         :x-original-authentication-results:precedence:mailing-list:list-id
         :x-spam-checked-in-group:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=vx1zEsbucdczhh6T/1fXcr9Fph4k3yQpY9qaPTVgq94=;
        b=f6pd+XYjhtIt+bAvO+FcZkeL0TUYu3QF/rMb8AbPu20z1XCrXGglUxT1SRk4ns35jB
         OjuN8TKO9cQoJsy5hk2YZxaMRxLxwh3iWnZGE+LE4eKpwgxTjW3fYfK/qTlZXJNCiafR
         lphcv29TZKs2jKEDfPngyQDIS4B33v+rFMJba+qHlNPWyOU+JsFyLcmdOYJtbXbP8dbO
         1zXjLSvnfEcUyW3Qj1odRIeQVW14C/mFjeTVXQPPoSnWUeAZgejeR0vZYu+hYg0IUy/h
         ntBQrmwbA6kE7Nlh2Dbt0oMG3GaYvlxnZVV+dQqtCjlhsVxFfSHxjwtMC 
X-Gm-Message-State: APzg51DAgGYOPonVtMBWrm5Ykt7e6hPMyEohpxWTfT6HMUHt5NJuBkmY
	s2ThKG/lBHGsuK02n6zcQz4=
X-Google-Smtp-Source: ANB0Vdbgz8dy0VM+YX3KuFeE8GLslJSNJdYRhbARMYh047fI0c9t0x0Br/dSS+wc12jjNM6ORKWhUA==
X-Received: by 2002:a1c:13d3:: with SMTP id 202-v6mr536002wmt.1.1535700744183;
        Fri, 31 Aug 2018 00:32:24 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 2002:a1c:650b:: with SMTP id z11-v6ls803285wmb.10.canary-gmail;
 Fri, 31 Aug 2018 00:32:23 -0700 (PDT)
X-Received: by 2002:a1c:3545:: with SMTP id c66-v6mr3941408wma.120.1535700743125;
        Fri, 31 Aug 2018 00:32:23 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1535700743; cv=none;
        d=google.com; s=arc-20160816;
        b=0SIBPAfoNqB10ad+klO6FhaQec0upW7UuZ9BCo01cctwoms2/L2MLTYxGCE45Eic/+
         XyZ/TJUaeB+Q6IqK07zK0W/YoYxJVhjWStTSgqGa820VlZUBo+CvqMmzQ0xwODceyCNd
         M0lxsRrf4hbAxWTB1lYpV2MLfabiBNOjLfWnc0NqFyPM7btSYBF1EuOmiAsnlxQSaIGy
         Ow/d7aM5G85JVzXBSPBr2i5dtqqWy7sv4poTU4+zMcBl0aHik4+CU1Zlnk/frc2E57VQ
         jLYMEd2q5iGRU5DCDDJcOZhk/vnB7TCn47CoWTC4WeZ8w0v4kY5/NVlL82CsNgFLc3Sm
         UK3A==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=content-transfer-encoding:message-id:references:in-reply-to
         :mail-reply-to:reply-to:from:date:mime-version:subject:to
         :arc-authentication-results;
        bh=JycLcLLKuqBEnAzTKFG81BkkvwbQdex8bAagBW9nqlY=;
        b=Bg9l4GvEN+0v0azfqEWQMEouP9h4dHF1kbT4ZHKOKgBhf8TDdWQHY3XBmmR7XXa6a6
         DekrYE4KpnraNeAruo+U4sTzp55/h5ntQdC0TrPTcGfPv8R577xc+SqTEm3ImtTZ/WSY
         D1syLRNATt8CRyzmXzfR/jFP5rb/52HcX4yaeIOYH5et67flaNzmH7N6ej77VkfheIlp
         rfmiUvptIGxQia8OX4uJRWvUzNnpHaB14TO2jpb8oJzRdoLU3CpBI5x10ZlCSxBY0fa+
         o9FjT8FYpdNlQ+j/1RJ8EqCBcVwYA3Ccf/+OCKkiRcyYHVGlBz+NhHqjvq2bHwRlxoHw
         N/5w==
ARC-Authentication-Results: i=1; mx.google.com;
       spf=neutral (google.com: 212.227.17.24 is neither permitted nor denied by best guess record for domain of src@andyf.de) smtp.mailfrom=src@andyf.de
Original-Received: from mout.kundenserver.de (mout.kundenserver.de. [212.227.17.24])
        by mx.google.com with ESMTPS id r15-v6si8191471wrm.102.2018.08.31.00.32.22
        for <std-proposals@isocpp.org>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Fri, 31 Aug 2018 00:32:23 -0700 (PDT)
Received-SPF: neutral (google.com: 212.227.17.24 is neither permitted nor denied by best guess record for domain of src@andyf.de) client-ip=212.227.17.24;
Original-Received: from lins.andyf.de ([92.116.146.206]) by mrelayeu.kundenserver.de
 (mreue103 [212.227.15.183]) with ESMTPSA (Nemesis) id
 0LfGuG-1fXHXK15FA-00orxW for <std-proposals@isocpp.org>; Fri, 31 Aug 2018
 09:32:22 +0200
X-PHP-Originating-Script: 1000:rcmail.php
Mail-Reply-To: src@andyf.de
In-Reply-To: <5e6ffea4-4c7b-4da1-9602-bbd670ce1f8a@isocpp.org>
X-Sender: src@andyf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X-Original-Sender: src@andyf.de
X-Original-Authentication-Results: mx.google.com;       spf=neutral
 (google.com: 212.227.17.24 is neither permitted nor denied by best guess
 record for domain of src@andyf.de) smtp.mailfrom=src@andyf.de
Precedence: list
Mailing-list: list std-proposals@isocpp.org; contact std-proposals+owners@isocpp.org
List-ID: <std-proposals.isocpp.org>
X-Spam-Checked-In-Group: std-proposals@isocpp.org
X-Google-Group-Id: 399137483710
List-Post: <https://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <https://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <https://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:std-proposals+subscribe@isocpp.org>
List-Unsubscribe: <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>,
 <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:40109
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/40109>

Have a look at Peter Sommerlads work:=20
https://github.com/PeterSommerlad/ReverseAdapter

#include "reverse.h"
#include <iostream>
int main(){
	using ::adapter::reverse;
	for(auto const &i : reverse({0,1,2,3,4,5})) {
         std::cout << i << '\n';
     }
}

--
Andreas


On 2018-08-29 00:28, Phil Bouchard wrote:
> On Tuesday, August 28, 2018 at 5:17:47 PM UTC-4, Nevin ":-)" Liber
> wrote:
>=20
>> On Tue, Aug 28, 2018 at 4:06 PM Phil Bouchard <phili...@gmail.com>
>> wrote:
>>=20
>>> Regarding the for loops with implicit iteration:
>>>=20
>>> list<string> cars;
>>>=20
>>> for (auto const & i : cars)
>>> =C2=A0 =C2=A0 ...
>>>=20
>>> How about reverse iteration for consistency?
>>>=20
>>> for (auto const & i !: cars)
>>> =C2=A0 =C2=A0 ...
>>>=20
>>> Or a better syntax.
>>=20
>> reverse_view in The One Ranges Proposal p0896 [1]=C2=A0should address
>> that.
>=20
> Ok. If it can be an elegant one-liner like the following then it's all
> good with me:
>=20
> vector is {0,1,2,3,4};=C2=A0
> =C2=A0
> for (int i :=C2=A0reverse_view{is})=C2=A0
> =C2=A0 =C2=A0 cout << i << =E2=80=99 =E2=80=99; // prints: 4 3 2 1 0
>=20
> Thanks,
> -Phil
>=20
>  --
>  You received this message because you are subscribed to the Google
> Groups "ISO C++ Standard - Future Proposals" group.
>  To unsubscribe from this group and stop receiving emails from it,
> send an email to std-proposals+unsubscribe@isocpp.org.
>  To post to this group, send email to std-proposals@isocpp.org.
>  To view this discussion on the web visit
> https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/5e6ffea4-4c7=
b-4da1-9602-bbd670ce1f8a%40isocpp.org
> [2].
>=20
>=20
> Links:
> ------
> [1] http://wg21.link/p0896
> [2]
> https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/5e6ffea4-4c7=
b-4da1-9602-bbd670ce1f8a%40isocpp.org?utm_medium=3Demail&utm_source=3Dfoote=
r

--=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/2b61d38aa27b27cdd8d87983ae0d56ed%40example.net.

.
