220 33185 <a33d3e68-f629-4048-8716-418b5778d471@isocpp.org> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Ray Hamel <rayghamel@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: [idea for proposal] Adding std::shift to <algorithm>
Date: Wed, 12 Jul 2017 10:10:39 -0700 (PDT)
Lines: 67
Approved: news@gmane.org
Message-ID: <a33d3e68-f629-4048-8716-418b5778d471@isocpp.org>
References: <bd1a5d3b-ccc1-44ab-91cc-a4d7195c9dc3@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_56_1395443315.1499879439543"
X-Trace: blaine.gmane.org 1499879443 19251 195.159.176.226 (12 Jul 2017 17:10:43 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Wed, 12 Jul 2017 17:10:43 +0000 (UTC)
Cc: dan@soundradix.com
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBDPM7JNEVQJRBEFQTHFQKGQEVOTXE7A@isocpp.org Wed Jul 12 19:10:39 2017
Return-path: <std-proposals+bncBDPM7JNEVQJRBEFQTHFQKGQEVOTXE7A@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-pf0-f198.google.com ([209.85.192.198])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBDPM7JNEVQJRBEFQTHFQKGQEVOTXE7A@isocpp.org>)
	id 1dVL9o-0004gK-Mg
	for gclcip-std-proposals@m.gmane.org; Wed, 12 Jul 2017 19:10:36 +0200
Original-Received: by mail-pf0-f198.google.com with SMTP id z10sf29158772pff.1
        for <gclcip-std-proposals@m.gmane.org>; Wed, 12 Jul 2017 10:10:42 -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=l1ACryCcQPnLty+LA/2dxo1GhiCG2Iq2Cwj6RNcLKbo=;
        b=eY5oC4APGHF8zgM0uaspTcoKzuX2csMW6FZE8rCNqC+dsB2A/fdhIkBBHcnwtiGecV
         4VDgFawnDGcAz1D7QwvcIOi2GChO1MzhSdF9v/An/wf1KqWsTRRPIDdnltYXCwznwDKw
         duDg0gjoqeSCQH0ZjnFz09WQS2NCb8Zq+YAb7NnjJHLbqOvMP2ep/ZJxRsqN+tqXEaHW
         mlykQEJw7X/ne2EnVn7bwsc3amnOcpjh8uTBp4Cj0iYpZkVYxTRT+50Dm0RnOK1GuuBp
         a9vvHUCyQNv6IVXfJRdPogUP5/u0d2KkuZduvwfrpVBJLac+Z+rRmWPiUKt479wtKZbj
         vqJg==
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=l1ACryCcQPnLty+LA/2dxo1GhiCG2Iq2Cwj6RNcLKbo=;
        b=XzPR8PelJNaLj1QQ6DEa99CYpkPuTtD/8G3BB+bEK8OI3cupVZRHF02n6zekaJFqQv
         HG1z2bSgc+p5xZRfNZo1xsPlmDTPLPfZ0nWUD14cWPLbOXdBczGSyx3yMupT63gBOW7+
         g8Owiv7xoMk+iaOtZDf6u7eyeA1v5jd5UW8rj3792bMFxWce2VQprnCGV8RodI7VhEMf
         MdnkC0YVYnrZE2KH3z+urnsIk3rwppGPBE6Punexn8Lzfm8vA7fK++C7PvSLJ4EMYabu
         mK/pT5WdHcr/SB/VSMDeZ46pErm77e6gNZshry+mpYCP276/YQ7Wt6RabX6DsWKcRdic
         nN2w==
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=l1ACryCcQPnLty+LA/2dxo1GhiCG2Iq2Cwj6RNcLKbo=;
        b=Tt6kMxp0UhiVccXeNEYEAk+29tSKaL68gIt+jGfw+4G0igOsQYcSnfswwa9dOrBhsF
         QHWUaPyL4Q8sLjUc0D+RZzm321jpPZfu4j8RO4jM1652xzicK00khUHA3GqpW+/J+tzU
         dGXLztz5MXCGOJMPAir1ISiVXehztCiqcfYAAF3cOTe3Y8MpL5pm7rBAgzL2TtqwNDXE
         JbulrqE7LqFPgFIm+YVB3Y29NEOLyLBKLSvQhBGUNzwUUfChSuOBzTtxqlhKgOIrCVVz
         bBPN/t5kHTIPRzBzy6XQogC6MfX6yghkIMn1u1CyKtsPCQC7BeC4S+KRIFm1EJNXjEvO
         F5Aw==
X-Gm-Message-State: AIVw111dlsc/zBhgJT2py+Uw6GY3ak2O6U1DQE9BzxvXkA79rhFLaKAR
	nDJLujVCbEUvU/qr
X-Received: by 10.99.113.9 with SMTP id m9mr3073514pgc.101.1499879441867;
        Wed, 12 Jul 2017 10:10:41 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.107.55.69 with SMTP id e66ls3772949ioa.35.gmail; Wed, 12 Jul
 2017 10:10:40 -0700 (PDT)
X-Received: by 10.31.158.209 with SMTP id h200mr4920vke.11.1499879440061;
        Wed, 12 Jul 2017 10:10:40 -0700 (PDT)
In-Reply-To: <bd1a5d3b-ccc1-44ab-91cc-a4d7195c9dc3@isocpp.org>
X-Original-Sender: rayghamel@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:33185
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/33185>

------=_Part_56_1395443315.1499879439543
Content-Type: multipart/alternative; 
	boundary="----=_Part_57_1582464980.1499879439543"

------=_Part_57_1582464980.1499879439543
Content-Type: text/plain; charset="UTF-8"

A couple additional comments about your sample implementation:

`n` should be `std::iterator_traits<BidirIt>::difference_type`, which is a 
signed type (usually `std::ptrdiff_t`), instead of `unsigned`.

Bidirectional iterators aren't required to implement `operator-`, so the 
second argument to `std::move_backward` should be `std::prev(last, n)` 
instead of `last - n`.

-- 
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/a33d3e68-f629-4048-8716-418b5778d471%40isocpp.org.

------=_Part_57_1582464980.1499879439543
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">A couple additional comments about your sample implementat=
ion:<div><br></div><div><font face=3D"arial, sans-serif">`</font><font face=
=3D"courier new, monospace">n</font><font face=3D"arial, sans-serif">`=C2=
=A0should be `</font><font face=3D"courier new, monospace">std::iterator_tr=
aits&lt;BidirIt&gt;::difference_type</font><span style=3D"font-family: aria=
l, sans-serif;">`, which is a signed type (usually `</span><font face=3D"co=
urier new, monospace">std::ptrdiff_t</font><span style=3D"font-family: aria=
l, sans-serif;">`), i</span><font face=3D"arial, sans-serif">nstead of `</f=
ont><font face=3D"courier new, monospace">unsigned</font><font face=3D"aria=
l, sans-serif">`</font><span style=3D"font-family: arial, sans-serif;">.</s=
pan></div><div><span style=3D"font-family: arial, sans-serif;"><br></span><=
/div><div><span style=3D"font-family: arial, sans-serif;">Bidirectional ite=
rators aren&#39;t required to implement `</span><font face=3D"courier new, =
monospace">operator-</font><span style=3D"font-family: arial, sans-serif;">=
`, so the second argument to `</span><font face=3D"courier new, monospace">=
std::move_backward</font><span style=3D"font-family: arial, sans-serif;">` =
should be `</span><font face=3D"courier new, monospace">std::prev(last, n)<=
/font><span style=3D"font-family: arial, sans-serif;">` instead of `</span>=
<font face=3D"courier new, monospace">last - n</font><span style=3D"font-fa=
mily: arial, sans-serif;">`.</span></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/a33d3e68-f629-4048-8716-418b5778d471%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/a33d3e68-f629-4048-8716-418b5778d471=
%40isocpp.org</a>.<br />

------=_Part_57_1582464980.1499879439543--

------=_Part_56_1395443315.1499879439543--

.
