220 40085 <5e6ffea4-4c7b-4da1-9602-bbd670ce1f8a@isocpp.org> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Phil Bouchard <philippeb8@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: for loops w/ reverse iteration
Date: Tue, 28 Aug 2018 15:28:49 -0700 (PDT)
Lines: 119
Approved: news@gmane.org
Message-ID: <5e6ffea4-4c7b-4da1-9602-bbd670ce1f8a@isocpp.org>
References: <f96b3ed7-06a7-497a-b3e3-831495ae9b2f@isocpp.org>
 <CAGg_6+PEv86Keu6bjCcer2T8xn77vunuTjvFFqHi2zhO84mV+g@mail.gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_1741_281447288.1535495329880"
X-Trace: blaine.gmane.org 1535495205 7938 195.159.176.226 (28 Aug 2018 22:26:45 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Tue, 28 Aug 2018 22:26:45 +0000 (UTC)
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBCAYTFXFZMBBBIUZS7OAKGQE7YTE54I@isocpp.org Wed Aug 29 00:26:41 2018
Return-path: <std-proposals+bncBCAYTFXFZMBBBIUZS7OAKGQE7YTE54I@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-yw1-f72.google.com ([209.85.161.72])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCAYTFXFZMBBBIUZS7OAKGQE7YTE54I@isocpp.org>)
	id 1fumRd-0001xl-NY
	for gclcip-std-proposals@m.gmane.org; Wed, 29 Aug 2018 00:26:41 +0200
Original-Received: by mail-yw1-f72.google.com with SMTP id t10-v6sf1445984ywc.7
        for <gclcip-std-proposals@m.gmane.org>; Tue, 28 Aug 2018 15:28:52 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=date:from:to:message-id:in-reply-to:references:subject:mime-version
         :x-original-sender:reply-to:precedence:mailing-list:list-id
         :list-post:list-help:list-archive:list-subscribe:list-unsubscribe;
        bh=foOq3hrsT1BfqitCGmBwalVUhx7nS58ihem5BQQOdqM=;
        b=R7iUYq2RaBK8mutbqPF5RIso2JEsV9J+GqnbxnXN3IUawaV3h9JLDAZUyx//uAgUan
         iFuynpuYXEokJKvKlpRj6LkGHtqzU1oRHHviwZ5HqhQYo/bzhZyWejYPNFO6hObwle0q
         4hXi7qTs8nou6HZXRUleoe6zYrJMhXYiyXvpLfigS/4FJY8/sar9sV2PC1IZzyLo/xFY
         //i4i9E7Ws7MbUNN4I2AGEUq6v1KJrj9rWaY4f3IEeAolSLqx5r/FA0nUIfrOa0qc1Ee
         VyZBp8wuFsknCZ6kp4qYmh3/lceQ2bCCVZKreWHYvBcOLqXvfBt7XjOLUXyxQyZ2fmye
         D2zA==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=date:from:to:message-id:in-reply-to:references:subject:mime-version
         :x-original-sender:reply-to:precedence:mailing-list:list-id
         :list-post:list-help:list-archive:list-subscribe:list-unsubscribe;
        bh=foOq3hrsT1BfqitCGmBwalVUhx7nS58ihem5BQQOdqM=;
        b=fayrMMzVgpT8rJa2TM9rWU7e/wopMCrDhNNUjLeEfMu8b0iXuKav6HzGZ//XdPV3qz
         iX5DAzhW4eWie9rI4YyaE9A/dM41iQcHE5CY65d281yj0XdExqTKfUk8tWFkerK3rpsP
         GbuDHV2jYkBtsA2/xLPCBt2vIFJY7/mJe4di57zE8rtmPA37QqWDM9icv+UmL+PCsL3Y
         cRRTxQ4oK85OAk8jcGZrKRRRwMRXBXRm4k3HOZufY3iW/vXUJzYZqFF8DyWXiNVpuiB8
         mxhOQaU5aN6m6aAJcdBh5HtGGO9YzRk6bzKWR6PVrIBMWrCU6KJ2X6SY7FD0T1LPWN0z
         bNTg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:date:from:to:message-id:in-reply-to:references
         :subject:mime-version:x-original-sender:reply-to:precedence
         :mailing-list:list-id:x-spam-checked-in-group:list-post:list-help
         :list-archive:list-subscribe:list-unsubscribe;
        bh=foOq3hrsT1BfqitCGmBwalVUhx7nS58ihem5BQQOdqM=;
        b=JR06RsK4b/wp0ZAZdQYH1XoCqehOKKH9DfRM8jHXvVTrxyCAXL+g7jVZQwhsKY5D0N
         lmcRTm2hs/OzvmsnAkLxj3fc8GRlpPHzwlCae+3+TK5daglBEHuRwfzyCUx482TnnY2l
         +EUyMqje+OTsPmmjmDjeKixJQ3D4rsityGcjWqMfvBVnds7PlkdJTyfoJi0fkCokwzaQ
         XOkpoZjGtAeZBz5qC6bzvRbW4IYITWcY1Jt1VuhARlTVgifn/apf5JL8Ldv5/woZvuI9
         roIC8mMbSSAIImZM5DGLOkMa8jUDpe840eYpwChUAVl3nUcA2R0mBuyYCdWnMPGaomgp
         +Hjw==
X-Gm-Message-State: APzg51DGyYbDOdJsjctptZrU3HzeNVVYWNlaC/9fZZ+5rO8rSl6wBvCn
	u8aEzD8r6UMp7W1Ty0yt0zzqVA==
X-Google-Smtp-Source: ANB0VdYB3AvLEIXicBS2wOFaIr/cMm1qmiRKFEeLKh5bPw/d5Vw3bImYW/E0ONax5lHEmluOqPIqYg==
X-Received: by 2002:a0d:c386:: with SMTP id f128-v6mr1095192ywd.45.1535495331735;
        Tue, 28 Aug 2018 15:28:51 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 2002:a81:a28c:: with SMTP id z134-v6ls365083ywg.28.gmail; Tue, 28
 Aug 2018 15:28:50 -0700 (PDT)
X-Received: by 2002:a81:78c6:: with SMTP id t189-v6mr40633ywc.7.1535495330466;
        Tue, 28 Aug 2018 15:28:50 -0700 (PDT)
In-Reply-To: <CAGg_6+PEv86Keu6bjCcer2T8xn77vunuTjvFFqHi2zhO84mV+g@mail.gmail.com>
X-Original-Sender: philippeb8@gmail.com
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:40085
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/40085>

------=_Part_1741_281447288.1535495329880
Content-Type: multipart/alternative; 
	boundary="----=_Part_1742_459365959.1535495329880"

------=_Part_1742_459365959.1535495329880
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable



On Tuesday, August 28, 2018 at 5:17:47 PM UTC-4, Nevin ":-)" Liber wrote:
>
> On Tue, Aug 28, 2018 at 4:06 PM Phil Bouchard <phili...@gmail.com=20
> <javascript:>> wrote:
>
>> Regarding the for loops with implicit iteration:
>>
>> list<string> cars;
>>
>> for (auto const & i : cars)
>>     ...
>>
>> How about reverse iteration for consistency?
>>
>> for (auto const & i !: cars)
>>     ...
>>
>> Or a better syntax.
>
>
> reverse_view in The One Ranges Proposal p0896 <http://wg21.link/p0896> sh=
ould=20
> address that.
>
>
Ok. If it can be an elegant one-liner like the following then it's all good=
=20
with me:

vector is {0,1,2,3,4};=20
=20
for (int i : reverse_view{is})=20
    cout << i << =E2=80=99 =E2=80=99; // prints: 4 3 2 1 0


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 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/5e6ffea4-4c7b-4da1-9602-bbd670ce1f8a%40isocpp.or=
g.

------=_Part_1742_459365959.1535495329880
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><br>On Tuesday, August 28, 2018 at 5:17:47 PM UTC-4, N=
evin &quot;:-)&quot; Liber wrote:<blockquote class=3D"gmail_quote" style=3D=
"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex=
;"><div dir=3D"ltr">On Tue, Aug 28, 2018 at 4:06 PM Phil Bouchard &lt;<a hr=
ef=3D"javascript:" target=3D"_blank" gdf-obfuscated-mailto=3D"0cAhbDnfBwAJ"=
 rel=3D"nofollow" onmousedown=3D"this.href=3D&#39;javascript:&#39;;return t=
rue;" onclick=3D"this.href=3D&#39;javascript:&#39;;return true;">phili...@g=
mail.com</a>&gt; wrote:<br><div class=3D"gmail_quote"><blockquote class=3D"=
gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-=
left:1ex">Regarding the for loops with implicit iteration:<br>
<br>
list&lt;string&gt; cars;<br>
<br>
for (auto const &amp; i : cars)<br>
=C2=A0 =C2=A0 ...<br>
<br>
How about reverse iteration for consistency?<br>
<br>
for (auto const &amp; i !: cars)<br>
=C2=A0 =C2=A0 ...<br>
<br>
Or a better syntax.</blockquote><div><br></div><div>reverse_view in The One=
 Ranges Proposal <a href=3D"http://wg21.link/p0896" target=3D"_blank" rel=
=3D"nofollow" onmousedown=3D"this.href=3D&#39;http://www.google.com/url?q\x=
3dhttp%3A%2F%2Fwg21.link%2Fp0896\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNH0=
4um2BjvBbCfTEtSxRU84z5AsQA&#39;;return true;" onclick=3D"this.href=3D&#39;h=
ttp://www.google.com/url?q\x3dhttp%3A%2F%2Fwg21.link%2Fp0896\x26sa\x3dD\x26=
sntz\x3d1\x26usg\x3dAFQjCNH04um2BjvBbCfTEtSxRU84z5AsQA&#39;;return true;">p=
0896</a>=C2=A0should address that.<br></div></div><br></div></blockquote><d=
iv><br></div><div>Ok. If it can be an elegant one-liner like the following =
then it&#39;s all good with me:</div><div><br></div><div>vector<int> is {0,=
1,2,3,4};=C2=A0</int></div><div><int>=C2=A0</int></div><div><int>for (int i=
 :=C2=A0</int>reverse_view{is})=C2=A0</div><div><int>=C2=A0 =C2=A0 cout &lt=
;&lt; i &lt;&lt; =E2=80=99 =E2=80=99; // prints: 4 3 2 1 0</int></div><div>=
<int><br></int></div><div><int><br></int></div><div><int>Thanks,</int></div=
><div><int>-Phil</int></div></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/5e6ffea4-4c7b-4da1-9602-bbd670ce1f8a%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/5e6ffea4-4c7b-4da1-9602-bbd670ce1f8a=
%40isocpp.org</a>.<br />

------=_Part_1742_459365959.1535495329880--

------=_Part_1741_281447288.1535495329880--

.
