220 33200 <b8807f7c-afc7-4e35-9020-98882a5d93bc@isocpp.org> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Alexander Zaitsev <zamazan4ik@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Re: [idea for proposal] Adding std::shift to <algorithm>
Date: Thu, 13 Jul 2017 05:39:20 -0700 (PDT)
Lines: 364
Approved: news@gmane.org
Message-ID: <b8807f7c-afc7-4e35-9020-98882a5d93bc@isocpp.org>
References: <bd1a5d3b-ccc1-44ab-91cc-a4d7195c9dc3@isocpp.org> <68bbd6d3-1578-43e1-b15f-563c9d6fb27c@isocpp.org> <c722a201-5c9c-4ac5-a1bd-e50beb6d7860@isocpp.org>
 <1E3763D6-C8A5-471A-AA44-F5CFDEDD6D9E@gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_404_1005163662.1499949560108"
X-Trace: blaine.gmane.org 1499949566 2900 195.159.176.226 (13 Jul 2017 12:39:26 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Thu, 13 Jul 2017 12:39:26 +0000 (UTC)
Cc: dan@soundradix.com
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBDGLZGV44EEBB6GTTXFQKGQEHIEUX4A@isocpp.org Thu Jul 13 14:39:21 2017
Return-path: <std-proposals+bncBDGLZGV44EEBB6GTTXFQKGQEHIEUX4A@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-yw0-f199.google.com ([209.85.161.199])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBDGLZGV44EEBB6GTTXFQKGQEHIEUX4A@isocpp.org>)
	id 1dVdOn-0000JG-3U
	for gclcip-std-proposals@m.gmane.org; Thu, 13 Jul 2017 14:39:17 +0200
Original-Received: by mail-yw0-f199.google.com with SMTP id k18sf40226688ywe.12
        for <gclcip-std-proposals@m.gmane.org>; Thu, 13 Jul 2017 05:39:22 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=date:from:to:cc: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=7uGs3bseJL+IaxokxgX36Vn7v45IEYd5QA4QbsyQP/I=;
        b=QTom665jYJJpzP+nzudEb3seA4z7IFwfRKXXCgj7mwp/+TRV+PHbVo0+IDrboGVJoG
         AgFGXdJv3loEnO14QaG88iEphGQweazcGIOjNXVtGnOFcMSOfft3kOGogA2vR0v0GyrF
         mVPkhiJFkw9iqhRAMgvJq4XQVolE6hiwMu1TemnIKrlqQiPnAiP+REXsHf62aLiLpXkN
         S2D5SLMD/C0FtgE8K3eE+0JTD4CJGVQAVprXc4+VcbJWs5lNwtuyRKww4e8+Sp3ICbMB
         /fIMNE4vkW2rCGQhrdnsNNkyAzWCPnN/DpOdZxy1mVdPyK/HsGjFVM1mIH5CK7KAlsol
         5GHQ==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=date:from:to:cc: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=7uGs3bseJL+IaxokxgX36Vn7v45IEYd5QA4QbsyQP/I=;
        b=TPq3YlHJkLey7/YXaw0L10f0yASszAKPGrAYlMiGcEoI0iHaviOJiE/Crm/hF3YqEg
         J6O0/i0xKQxMyWpU4Vxj3wN4s21r5XzWsgKVHz0ubZHvIt3Gw+FX47jzRUs7XpUN14tF
         PzbVNsPlgD7wfPrOfkjf/FJ5qHUO5qALxDw57sc0bPaWCWc8A4OppTzZUhUMmJlA9KXt
         T1AJIsRxPmQhqAwKDbA1uOP98rQFTGRnSApCYreurxtKdgcCkMizuFihCDaDWzeaOCtU
         6QMB6F9Wg7Mln76/EOdQwGPFLL3N5Ad9Rijs86zD1fB29P/nrCOi86MD7lo9pxa3f5x3
         zFQQ==
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:cc: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=7uGs3bseJL+IaxokxgX36Vn7v45IEYd5QA4QbsyQP/I=;
        b=pWI+sfR3+ehpptDRnaY1+iFfHbD0kqtATM1TRwBHmk4JHSbmUCyn4lByi8b1N3R4qH
         DkS9IMkxUiCBSymT3lw8BrBT51e9u65Hvmlv1eFYwFaKXGxVbMLHozZjB5gpI+ALTvId
         Ef4+2nckoIBuAjsqChlceH8TGb8qXonmuB4ME5rDAAN2dpgXe3rF0ZSHnDWbVUtGrmf5
         qdjaIOKbro0FTUhh47GncwfAuq/4nv1zenP//FrJTRQYTPwQtbeNacqZiRwLB3YrxywX
         +qBQYyzso6bgtps6xxujb9BAx/8F3njihQ65MAvGc5HWsMv5F2kD+7VKpQSmRpHMLU+h
         T1WA==
X-Gm-Message-State: AIVw1134N5Phts5zIoWBAAgS3OmWBrcBdIFn0hygztku5BV/6TH3ziPt
	dm6vfYyZXXC4ioRb
X-Received: by 10.129.125.194 with SMTP id y185mr1564165ywc.43.1499949562185;
        Thu, 13 Jul 2017 05:39:22 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.36.88.208 with SMTP id f199ls3128030itb.18.canary-gmail; Thu,
 13 Jul 2017 05:39:20 -0700 (PDT)
X-Received: by 10.31.164.12 with SMTP id n12mr10389vke.17.1499949560623;
        Thu, 13 Jul 2017 05:39:20 -0700 (PDT)
In-Reply-To: <1E3763D6-C8A5-471A-AA44-F5CFDEDD6D9E@gmail.com>
X-Original-Sender: zamazan4ik@gmail.com
Precedence: list
Mailing-list: list std-proposals@isocpp.org; contact std-proposals+owners@isocpp.org
List-ID: <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:33200
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/33200>

------=_Part_404_1005163662.1499949560108
Content-Type: multipart/alternative; 
	boundary="----=_Part_405_1637477051.1499949560109"

------=_Part_405_1637477051.1499949560109
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Can you write proposal about std::shift? Need you any help with writing=20
proposal and/or implementation?

=D1=87=D0=B5=D1=82=D0=B2=D0=B5=D1=80=D0=B3, 13 =D0=B8=D1=8E=D0=BB=D1=8F 201=
7 =D0=B3., 14:41:34 UTC+3 =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=
=D1=82=D0=B5=D0=BB=D1=8C Dan Raviv =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=
=BB:
>
> Thanks for phrasing the motivation so well Nicol.
>
> Arthur, regarding specific use cases, any algorithm doing time series=20
> analysis (e.g. temperature the last 20 days) could use this.
>
> (A cyclical buffer is an alternative, but one which isn't always=20
> preferrable.)
>
> On 13 Jul 2017, at 4:43, Nicol Bolas <jmck...@gmail.com <javascript:>>=20
> wrote:
>
> On Wednesday, July 12, 2017 at 7:47:05 PM UTC-4, Arthur O'Dwyer wrote:
>>
>> On Wednesday, July 12, 2017 at 2:53:19 AM UTC-7, d...@soundradix.com=20
>> wrote:
>>>
>>> Hi,
>>>
>>> Would anyone be interested in adding std::shift to <algorithm>?=20
>>>
>>> It would be similar to both:
>>> - std::rotate, but without moving the head elements back to the tail.=
=20
>>> This would allow a more efficient implementation and clearer semantics =
in=20
>>> case rotation is not needed as well as correctness in case rotation is=
=20
>>> undesired.
>>> - <algorithm>'s std::move/std::move_backward (depending on the shift=20
>>> direction).
>>>
>>> std::shift should probably accommodate both left and right shifts by on=
e=20
>>> of:
>>> - giving it either begin() and end(), or rbegin() and rend(), similar t=
o=20
>>> how std::rotate works for both left and right rotations. The advantage =
is=20
>>> compactness of the implementation.
>>> - allowing the shift count parameter to be either positive or negative.=
=20
>>> The advantage is compactness, though it might not be clear which direct=
ion=20
>>> is which - to be consistent with rotate, positive integers should shift=
 to=20
>>> the left.
>>> - having std::shift_right and std::shift_left functions. The advantage=
=20
>>> is clarity when calling the methods, although the same argument could b=
e=20
>>> made for having separate std::rotate_left and std::rotate_right instead=
 of=20
>>> std::rotate, which we don't have.
>>>
>>
>> std::rotate is actually just a rotation; it doesn't need "left" or=20
>> "right" qualification because they're 100% equivalent. Consider a classr=
oom=20
>> globe with London in front, facing you. Now "rotate" the globe until=20
>> Beijing is in front. It doesn't matter if you rotate left or rotate righ=
t;=20
>> the outcome is exactly the same either way.
>> =20
>>
>>> Here's a sample implementation of a shift to the right direction:
>>>
>>> template<class BidirIt>=20
>>> void shift_right(BidirIt first, BidirIt last, unsigned int n =3D 1)=20
>>> {=20
>>>     std::move_backward(first, last - n, last);=20
>>> }
>>>
>>> This demonstrates that while std::shift is implementable with=20
>>> std::move/std::move_backward,
>>> 1) It isn't immediately clear from the code (at least to my eyes) that=
=20
>>> this is a shift right, unless you are intimately familiar with=20
>>> std::move_backward.
>>> 2) Different calls, either to std::move or to std::move_backward, are=
=20
>>> required, depending on the shift direction.
>>>
>>
>> If you're shifting the whole container's contents, you could use either=
=20
>> of these:
>>     std::move(ctr.rbegin() + n, ctr.rend(), ctr.rbegin());
>>     std::move_backward(ctr.begin(), ctr.end() - n, ctr.end())?
>> I don't currently see the use-case for this "shift just a piece of a=20
>> container" algorithm, I mean as distinct from std::move and=20
>> std::move_backward which already exist. Do you have a use-case?
>>
>
> The use-case would be anytime you'd want to use the code you just wrote.=
=20
> When you have a range and N, and you want to do a shift N units in that=
=20
> direction.
>
> The point of having it is one of clarification and user expectations. Yes=
,=20
> you can use `move` and `move_backward` to accomplish a shift. But conside=
r=20
> the two function calls:
>
> //A
> std::shift(rng.begin(), rng.end(), N);
>
> //B
> auto rrng =3D std::make_reverse_range(rng);
> std::move(rrng.begin() + N, rrng.end(), rrng.begin());
>
> A and B both do the same thing. But it's a *lot easier* to figure out=20
> what the code is actually accomplishing from looking at A than B.
>
> B gets even more obtuse confusing in a range-based world:
>
> //A
> std::shift(rng, N);
>
> //B
> auto rrng =3D std::make_reverse_range(rng);
> std::move(std::make_range(rrng.begin + N, rrng.end()), rrng.begin());
>
> --=20
> You received this message because you are subscribed to the Google Groups=
=20
> "ISO C++ Standard - Future Proposals" group.
> To unsubscribe from this group and stop receiving emails from it, send an=
=20
> email to std-proposal...@isocpp.org <javascript:>.
> To post to this group, send email to std-pr...@isocpp.org <javascript:>.
> To view this discussion on the web visit=20
> https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/c722a201-5c9=
c-4ac5-a1bd-e50beb6d7860%40isocpp.org=20
> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/c722a201-5c=
9c-4ac5-a1bd-e50beb6d7860%40isocpp.org?utm_medium=3Demail&utm_source=3Dfoot=
er>
> .
>
>

--=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/b8807f7c-afc7-4e35-9020-98882a5d93bc%40isocpp.or=
g.

------=_Part_405_1637477051.1499949560109
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Can you write proposal about std::shift? Need you any help=
 with writing proposal and/or implementation?<br><br>=D1=87=D0=B5=D1=82=D0=
=B2=D0=B5=D1=80=D0=B3, 13 =D0=B8=D1=8E=D0=BB=D1=8F 2017 =D0=B3., 14:41:34 U=
TC+3 =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=82=D0=B5=D0=BB=D1=
=8C Dan Raviv =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB:<blockquote class=
=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #cc=
c solid;padding-left: 1ex;"><div dir=3D"auto"><div></div><div>Thanks for ph=
rasing the motivation so well Nicol.</div><div><br></div><div>Arthur, regar=
ding specific use cases, any algorithm doing time series analysis (e.g. tem=
perature the last 20 days) could use this.</div><div><br></div><div>(A cycl=
ical buffer is an alternative, but one which isn&#39;t always preferrable.)=
</div><div><br>On 13 Jul 2017, at 4:43, Nicol Bolas &lt;<a href=3D"javascri=
pt:" target=3D"_blank" gdf-obfuscated-mailto=3D"ZSNIAKlbBgAJ" rel=3D"nofoll=
ow" onmousedown=3D"this.href=3D&#39;javascript:&#39;;return true;" onclick=
=3D"this.href=3D&#39;javascript:&#39;;return true;">jmck...@gmail.com</a>&g=
t; wrote:<br><br></div><blockquote type=3D"cite"><div><div dir=3D"ltr">On W=
ednesday, July 12, 2017 at 7:47:05 PM UTC-4, Arthur O&#39;Dwyer wrote:<bloc=
kquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-lef=
t:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr">On Wednesday, July 12, =
2017 at 2:53:19 AM UTC-7, <a>d...@soundradix.com</a> wrote:<blockquote clas=
s=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc =
solid;padding-left:1ex"><div dir=3D"ltr">Hi,<div><br></div><div>Would anyon=
e be interested in adding std::shift to &lt;algorithm&gt;?=C2=A0</div><div>=
<br></div><div>It would be similar to both:</div><div>- std::rotate, but wi=
thout moving the head elements back to the tail. This would allow a more ef=
ficient implementation and clearer semantics in case rotation is not needed=
 as well as correctness in case rotation is undesired.</div><div>- &lt;algo=
rithm&gt;&#39;s std::move/std::move_backward (depending on the shift direct=
ion).</div><div><br></div><div>std::shift should probably accommodate both =
left and right shifts by one of:</div><div>- giving it either begin() and e=
nd(), or rbegin() and rend(), similar to how std::rotate works for both lef=
t and right rotations. The advantage is compactness of the implementation.<=
/div><div>- allowing the shift count parameter to be either positive or neg=
ative. The advantage is compactness, though it might not be clear which dir=
ection is which - to be consistent with rotate, positive integers should sh=
ift to the left.<br></div><div><div>- having std::shift_right and std::shif=
t_left functions. The advantage is clarity when calling the methods, althou=
gh the same argument could be made for having separate std::rotate_left and=
 std::rotate_right instead of std::rotate, which we don&#39;t have.</div></=
div></div></blockquote><div><br></div><div>std::rotate is actually just a r=
otation; it doesn&#39;t need &quot;left&quot; or &quot;right&quot; qualific=
ation because they&#39;re 100% equivalent. Consider a classroom globe with =
London in front, facing you. Now &quot;rotate&quot; the globe until Beijing=
 is in front. It doesn&#39;t matter if you rotate left or rotate right; the=
 outcome is exactly the same either way.</div><div>=C2=A0</div><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"><div>Here&#39;s a sample imple=
mentation of a shift to the right direction:<br></div><br><div style=3D"bac=
kground-color:rgb(250,250,250);border:1px solid rgb(187,187,187);word-wrap:=
break-word"><code><div><span style=3D"color:#008">template</span><span styl=
e=3D"color:#660">&lt;</span><span style=3D"color:#008">class</span><span st=
yle=3D"color:#000"> </span><span style=3D"color:#606">BidirIt</span><span s=
tyle=3D"color:#660">&gt;</span><span style=3D"color:#000"> <br></span><span=
 style=3D"color:#008">void</span><span style=3D"color:#000"> shift_right</s=
pan><span style=3D"color:#660">(</span><span style=3D"color:#606">BidirIt</=
span><span style=3D"color:#000"> first</span><span style=3D"color:#660">,</=
span><span style=3D"color:#000"> </span><span style=3D"color:#606">BidirIt<=
/span><span style=3D"color:#000"> </span><span style=3D"color:#008">last</s=
pan><span style=3D"color:#660">,</span><span style=3D"color:#000"> </span><=
span style=3D"color:#008">unsigned</span><span style=3D"color:#000"> </span=
><span style=3D"color:#008">int</span><span style=3D"color:#000"> n </span>=
<span style=3D"color:#660">=3D</span><span style=3D"color:#000"> </span><sp=
an style=3D"color:#066">1</span><span style=3D"color:#660">)</span><span st=
yle=3D"color:#000"> <br></span><span style=3D"color:#660">{</span><span sty=
le=3D"color:#000"> <br>=C2=A0 =C2=A0 std</span><span style=3D"color:#660">:=
:</span><span style=3D"color:#000">move_backward</span><span style=3D"color=
:#660">(</span><span style=3D"color:#000">first</span><span style=3D"color:=
#660">,</span><span style=3D"color:#000"> </span><span style=3D"color:#008"=
>last</span><span style=3D"color:#000"> </span><span style=3D"color:#660">-=
</span><span style=3D"color:#000"> n</span><span style=3D"color:#660">,</sp=
an><span style=3D"color:#000"> </span><span style=3D"color:#008">last</span=
><span style=3D"color:#660">);</span><span style=3D"color:#000"> <br></span=
><span style=3D"color:#660">}</span><span style=3D"color:#000"><br></span><=
/div></code></div><div><br></div><div>This demonstrates that while std::shi=
ft is implementable with std::move/std::move_backward,</div><div>1) It isn&=
#39;t immediately clear from the code (at least to my eyes) that this is a =
shift right, unless you are intimately familiar with std::move_backward.</d=
iv><div>2) Different calls, either to std::move or to std::move_backward, a=
re required, depending on the shift direction.</div></div></blockquote><div=
><br></div><div>If you&#39;re shifting the whole container&#39;s contents, =
you could use either of these:</div><div>=C2=A0 =C2=A0 std::move(ctr.rbegin=
() + n, ctr.rend(), ctr.rbegin());</div><div>=C2=A0 =C2=A0 std::move_backwa=
rd(ctr.begin()<wbr>, ctr.end() - n, ctr.end())?</div><div>I don&#39;t curre=
ntly see the use-case for this &quot;shift just a piece of a container&quot=
; algorithm, I mean as distinct from std::move and std::move_backward which=
 already exist. Do you have a use-case?</div></div></blockquote><div><br>Th=
e use-case would be anytime you&#39;d want to use the code you just wrote. =
When you have a range and N, and you want to do a shift N units in that dir=
ection.<br><br>The point of having it is one of clarification and user expe=
ctations. Yes, you can use `move` and `move_backward` to accomplish a shift=
.. But consider the two function calls:<br><br><div style=3D"background-colo=
r:rgb(250,250,250);border-color:rgb(187,187,187);border-style:solid;border-=
width:1px"><code><div><span style=3D"color:#800">//A</span><span style=3D"c=
olor:#000"><br>std</span><span style=3D"color:#660">::</span><span style=3D=
"color:#000">shift</span><span style=3D"color:#660">(</span><span style=3D"=
color:#000">rng</span><span style=3D"color:#660">.</span><span style=3D"col=
or:#008">begin</span><span style=3D"color:#660">(),</span><span style=3D"co=
lor:#000"> rng</span><span style=3D"color:#660">.</span><span style=3D"colo=
r:#008">end</span><span style=3D"color:#660">(),</span><span style=3D"color=
:#000"> N</span><span style=3D"color:#660">);</span><span style=3D"color:#0=
00"><br><br></span><span style=3D"color:#800">//B</span><span style=3D"colo=
r:#000"><br></span><span style=3D"color:#008">auto</span><span style=3D"col=
or:#000"> rrng </span><span style=3D"color:#660">=3D</span><span style=3D"c=
olor:#000"> std</span><span style=3D"color:#660">::</span><span style=3D"co=
lor:#000">make_reverse_range</span><span style=3D"color:#660">(</span><span=
 style=3D"color:#000">rng</span><span style=3D"color:#660">);</span><span s=
tyle=3D"color:#000"><br>std</span><span style=3D"color:#660">::</span><span=
 style=3D"color:#000">move</span><span style=3D"color:#660">(</span><span s=
tyle=3D"color:#000">rrng</span><span style=3D"color:#660">.</span><span sty=
le=3D"color:#008">begin</span><span style=3D"color:#660">()</span><span sty=
le=3D"color:#000"> </span><span style=3D"color:#660">+</span><span style=3D=
"color:#000"> N</span><span style=3D"color:#660">,</span><span style=3D"col=
or:#000"> rrng</span><span style=3D"color:#660">.</span><span style=3D"colo=
r:#008">end</span><span style=3D"color:#660">(),</span><span style=3D"color=
:#000"> rrng</span><span style=3D"color:#660">.</span><span style=3D"color:=
#008">begin</span><span style=3D"color:#660">());</span></div></code></div>=
<br>A and B both do the same thing. But it&#39;s a <i>lot easier</i> to fig=
ure out what the code is actually accomplishing from looking at A than B.<b=
r><br>B gets even more obtuse confusing in a range-based world:<br><br><div=
 style=3D"background-color:rgb(250,250,250);border-color:rgb(187,187,187);b=
order-style:solid;border-width:1px"><code><div><span style=3D"color:#800">/=
/A</span><span style=3D"color:#000"><br>std</span><span style=3D"color:#660=
">::</span><span style=3D"color:#000">shift</span><span style=3D"color:#660=
">(</span><span style=3D"color:#000">rng</span><span style=3D"color:#660">,=
</span><span style=3D"color:#000"> N</span><span style=3D"color:#660">);</s=
pan><span style=3D"color:#000"><br><br></span><span style=3D"color:#800">//=
B</span><span style=3D"color:#000"><br></span><span style=3D"color:#008">au=
to</span><span style=3D"color:#000"> rrng </span><span style=3D"color:#660"=
>=3D</span><span style=3D"color:#000"> std</span><span style=3D"color:#660"=
>::</span><span style=3D"color:#000">make_reverse_range</span><span style=
=3D"color:#660">(</span><span style=3D"color:#000">rng</span><span style=3D=
"color:#660">);</span><span style=3D"color:#000"><br>std</span><span style=
=3D"color:#660">::</span><span style=3D"color:#000">move</span><span style=
=3D"color:#660">(</span><span style=3D"color:#000">std</span><span style=3D=
"color:#660">::</span><span style=3D"color:#000">make_range</span><span sty=
le=3D"color:#660">(</span><span style=3D"color:#000">rrng</span><span style=
=3D"color:#660"><wbr>.</span><span style=3D"color:#008">begin</span><span s=
tyle=3D"color:#000"> </span><span style=3D"color:#660">+</span><span style=
=3D"color:#000"> N</span><span style=3D"color:#660">,</span><span style=3D"=
color:#000"> rrng</span><span style=3D"color:#660">.</span><span style=3D"c=
olor:#008">end</span><span style=3D"color:#660">()),</span><span style=3D"c=
olor:#000"> rrng</span><span style=3D"color:#660">.</span><span style=3D"co=
lor:#008">begin</span><span style=3D"color:#660">());</span></div></code></=
div></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"javascript:" target=3D"_blank" gdf-obfuscated-mailto=3D"=
ZSNIAKlbBgAJ" rel=3D"nofollow" onmousedown=3D"this.href=3D&#39;javascript:&=
#39;;return true;" onclick=3D"this.href=3D&#39;javascript:&#39;;return true=
;">std-proposal...@<wbr>isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"javascript:" target=3D"_bla=
nk" gdf-obfuscated-mailto=3D"ZSNIAKlbBgAJ" rel=3D"nofollow" onmousedown=3D"=
this.href=3D&#39;javascript:&#39;;return true;" onclick=3D"this.href=3D&#39=
;javascript:&#39;;return true;">std-pr...@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/c722a201-5c9c-4ac5-a1bd-e50beb6d7860%=
40isocpp.org?utm_medium=3Demail&amp;utm_source=3Dfooter" target=3D"_blank" =
rel=3D"nofollow" onmousedown=3D"this.href=3D&#39;https://groups.google.com/=
a/isocpp.org/d/msgid/std-proposals/c722a201-5c9c-4ac5-a1bd-e50beb6d7860%40i=
socpp.org?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" on=
click=3D"this.href=3D&#39;https://groups.google.com/a/isocpp.org/d/msgid/st=
d-proposals/c722a201-5c9c-4ac5-a1bd-e50beb6d7860%40isocpp.org?utm_medium\x3=
demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com=
/a/<wbr>isocpp.org/d/msgid/std-<wbr>proposals/c722a201-5c9c-4ac5-<wbr>a1bd-=
e50beb6d7860%40isocpp.org</a><wbr>.<br>
</div></blockquote></div></blockquote></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/b8807f7c-afc7-4e35-9020-98882a5d93bc%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/b8807f7c-afc7-4e35-9020-98882a5d93bc=
%40isocpp.org</a>.<br />

------=_Part_405_1637477051.1499949560109--

------=_Part_404_1005163662.1499949560108--

.
