220 33429 <cb996c8c-eb3a-40ca-a925-b3885f1548ee@isocpp.org> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Nicol Bolas <jmckesson@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: [idea for proposal] Adding std::shift to <algorithm>
Date: Fri, 28 Jul 2017 12:19:07 -0700 (PDT)
Lines: 72
Approved: news@gmane.org
Message-ID: <cb996c8c-eb3a-40ca-a925-b3885f1548ee@isocpp.org>
References: <bd1a5d3b-ccc1-44ab-91cc-a4d7195c9dc3@isocpp.org>
 <3e77c029-bc79-424c-bdad-eba28ec10cdb@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_2064_884191061.1501269547842"
X-Trace: blaine.gmane.org 1501269553 11085 195.159.176.226 (28 Jul 2017 19:19:13 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Fri, 28 Jul 2017 19:19:13 +0000 (UTC)
Cc: dan@soundradix.com
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBCEKFTV6ZUMBBLE453FQKGQEBSQETOY@isocpp.org Fri Jul 28 21:19:05 2017
Return-path: <std-proposals+bncBCEKFTV6ZUMBBLE453FQKGQEBSQETOY@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-ua0-f198.google.com ([209.85.217.198])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCEKFTV6ZUMBBLE453FQKGQEBSQETOY@isocpp.org>)
	id 1dbAmu-0002MJ-1X
	for gclcip-std-proposals@m.gmane.org; Fri, 28 Jul 2017 21:19:04 +0200
Original-Received: by mail-ua0-f198.google.com with SMTP id p32sf166709202uag.13
        for <gclcip-std-proposals@m.gmane.org>; Fri, 28 Jul 2017 12:19:10 -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=VxAJJW0tDFfATe69zvCKNide/Lh0JfQ8GKB83BFH36M=;
        b=yS3skSV+TUbhX0VAjDpdmjHrTgfvQvTvXDU4Q560BQzR23MVxk0MoxF/1DJwT0baJy
         fDEW4v5LbqnsRBoAkgKvTtpMW49UQh6BfgXrH6Rm9NOEviWEzcMN1bzxo3mXygg9x5tE
         2MIZxUfH5YDjqLj/aubJvIuF2zbaE8LI4PeP72USklkD5NP4oplG8FV5nsymho9olqoC
         +BgkCJyi0D+SOrD4AMiKTaT6mIGsyTKSs0gfZ2qngywcw4m0+6yXvHhXRwl8517+K3TT
         FfuWHH2Bn9hx/WPmbBeGXjEugqo7BAq05WPwMI6u71kIWVZbsdYiXwd0tmHW0ZsfDe/N
         3WKw==
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=VxAJJW0tDFfATe69zvCKNide/Lh0JfQ8GKB83BFH36M=;
        b=l7Szfj3G4byOAnEluVcX88yqpEQg2OsgaewgrMa67c5+24We+gNjPgZm9lTbFrjLye
         czKRnGmvhUjH7fFm0v6pTb41atXc5p9Ef/aLSH7BfNS4O+Ptmprqr1yxYrq+tN7OfGwQ
         Rh2hXVqQgzAH0iKEKtnSwUXB5qA9sGCDO8hcIrakn8Qt9sYCW4PO3oJVIVHfb+qqik9z
         9u8JzPXMBVu5OyYAqQUr7pQu0D5vWlnvFK6/xbwhGM+2VpnerI2zAimoWJy389R/Tlyi
         OCR32feivFrp0UZNcHu99A8qe6Ri1+Bh53HBBtBneMr3xUl1bTdopxCxy5eA6ANLqmKx
         hAXQ==
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=VxAJJW0tDFfATe69zvCKNide/Lh0JfQ8GKB83BFH36M=;
        b=r4ABA+gWA3cSnst4MmXIbgjdIl/nmCkKoAZOxeUXXxXJOmLOuDL1ZsqLWTOgIUxgjV
         7IOE4yERF+npJn5zSkWsDDs9EXOPCIERyqIZWGsnLtOt91KIvjGoogtCd2Tvtw3lrsc/
         Ylo7h45vmdw52H7wc9OOc5ENB/d9obW4sEndKGF8IeNcMYuvdJPqGt5yA4F2RlVeLQYp
         OYZr8bn+Syp9VFJMNn4geWxxO+mo22BZNB3L3sz4Yoq0PNCo2fq3dSb8lOGkDWzkq7u2
         MM849ryX0bUKsJtvvl8CM21UUgNoJ1mjB2aUsYoxZjFzMgye8JqBz9yO9aioD/Kvz6cL
         alNg==
X-Gm-Message-State: AIVw113vRfHWug0nejU5EsHDSr+qO4ucHaUZWEM4imv3FhgaY/aR7YUb
	Pu3Oh0XyHUm55XOW
X-Received: by 10.176.81.123 with SMTP id f56mr5698662uaa.54.1501269549722;
        Fri, 28 Jul 2017 12:19:09 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.107.128.165 with SMTP id k37ls4945632ioi.37.gmail; Fri, 28 Jul
 2017 12:19:08 -0700 (PDT)
X-Received: by 10.31.139.1 with SMTP id n1mr37856vkd.19.1501269548399;
        Fri, 28 Jul 2017 12:19:08 -0700 (PDT)
In-Reply-To: <3e77c029-bc79-424c-bdad-eba28ec10cdb@isocpp.org>
X-Original-Sender: jmckesson@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:33429
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/33429>

------=_Part_2064_884191061.1501269547842
Content-Type: multipart/alternative; 
	boundary="----=_Part_2065_719338155.1501269547842"

------=_Part_2065_719338155.1501269547842
Content-Type: text/plain; charset="UTF-8"

On Friday, July 28, 2017 at 2:43:10 PM UTC-4, Dan Raviv wrote:
>
> Does anyone know if there was a specific motivation for adding 
> std::move_backward() to <algorithm>? It seems that using std::move() with 
> rbegin(),rend() iterators (for the basic use case) would have the same 
> effect.
>

First, reverse iterators have a tendency to be opaque. That is, you can't 
effectively optimize through them. If `value_type` were trivially-copyable 
and move-assignable, and the iterators would have been contiguous 
(pointers, etc), you wouldn't be able to move them with a memcpy/memmove. 
You could only do the standard one-element-at-a-time thing.

Second, your `rbegin/rend` idea only is useful if you have a container. If 
you just have a pair of iterators, then reversing them is a bit harder, and 
it requires putting them in backwards. Whereas `move_backward` pretty much 
tells the story of what you want.

-- 
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/cb996c8c-eb3a-40ca-a925-b3885f1548ee%40isocpp.org.

------=_Part_2065_719338155.1501269547842
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Friday, July 28, 2017 at 2:43:10 PM UTC-4, Dan Raviv wr=
ote:<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">Does anyo=
ne know if there was a specific motivation for adding std::move_backward() =
to &lt;algorithm&gt;? It seems that using std::move() with rbegin(),rend() =
iterators (for the basic use case) would have the same effect.<br></div></b=
lockquote><div><br>First, reverse iterators have a tendency to be opaque. T=
hat is, you can&#39;t effectively optimize through them. If `value_type` we=
re trivially-copyable and move-assignable, and the iterators would have bee=
n contiguous (pointers, etc), you wouldn&#39;t be able to move them with a =
memcpy/memmove. You could only do the standard one-element-at-a-time thing.=
<br><br>Second, your `rbegin/rend` idea only is useful if you have a contai=
ner. If you just have a pair of iterators, then reversing them is a bit har=
der, and it requires putting them in backwards. Whereas `move_backward` pre=
tty much tells the story of what you want.</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/cb996c8c-eb3a-40ca-a925-b3885f1548ee%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/cb996c8c-eb3a-40ca-a925-b3885f1548ee=
%40isocpp.org</a>.<br />

------=_Part_2065_719338155.1501269547842--

------=_Part_2064_884191061.1501269547842--

.
