220 7405 <f844b34d-f64b-430d-9328-e44246a89238@isocpp.org> article
Path: news.gmane.org!not-for-mail
From: Vlad from Moscow <vlad.moscow@mail.ru>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Re: To add the method append for all sequential
 containers that have method push_back
Date: Tue, 22 Oct 2013 13:03:53 -0700 (PDT)
Lines: 261
Approved: news@gmane.org
Message-ID: <f844b34d-f64b-430d-9328-e44246a89238@isocpp.org>
References: <4167b82e-a3cc-44ce-9825-b52514bc1531@isocpp.org>
 <357325b0-cec5-4d22-ad56-9bb66f76b458@isocpp.org> <c98342aa-14d6-4fc6-8499-234c5e44e894@isocpp.org>
 <983ff074-5d8c-488a-b06c-49d53d5b7a5b@isocpp.org> <f47679d2-be05-4fdf-aea6-c617eb291aad@isocpp.org>
 <369298d9-3f8b-405a-8bfe-ae209372a26f@isocpp.org>
 <CAPBZbvzVuUKHsNSWz+KQPBzB1KJh0KgaY_cv6XuCwuhbZRhgHw@mail.gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; 
	boundary="----=_Part_434_27953027.1382472233301"
X-Trace: ger.gmane.org 1382472232 21057 80.91.229.3 (22 Oct 2013 20:03:52 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Tue, 22 Oct 2013 20:03:52 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCXLLRHD7IDRBKVUTOJQKGQEXPZZLUA@isocpp.org Tue Oct 22 22:03:58 2013
Return-path: <std-proposals+bncBCXLLRHD7IDRBKVUTOJQKGQEXPZZLUA@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-pb0-f72.google.com ([209.85.160.72])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCXLLRHD7IDRBKVUTOJQKGQEXPZZLUA@isocpp.org>)
	id 1VYiBI-0004fw-Gp
	for gclcip-std-proposals@m.gmane.org; Tue, 22 Oct 2013 22:03:56 +0200
Original-Received: by mail-pb0-f72.google.com with SMTP id jt11sf3831574pbb.11
        for <gclcip-std-proposals@m.gmane.org>; Tue, 22 Oct 2013 13:03:55 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        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
         :content-type;
        bh=TebE+FXCO9MwUJcj1z9ma+JU01qiCUaH3VTgwu/+8pY=;
        b=dCpE49jRRaNrF+cskhFGsjz8oMnmhyE5DjH6K4PeVzvVDgpWonL+O9TbQnzxZJWR70
         FZe1j3SI6ocagKhHRYJOt3o5YizYYJcAQLHL0ndXigM7cSCtF1gqERaU01gKsWzLaJ8P
         Lhc7eeaq6RUOH377VKvmDClOr9thLqdAVOdR6nysmazkP3YmvWCJX08x7xZsRS/j9EJM
         tBdqGeXkxLuXA4nokZ8SmSiM74SO06GePVWRHe1EsnhgxIwl5q5/Uz5X/w5ZbZmqrqiS
         sM7VE/zSLwGE7e6JA6ANrN5ESytQwuIPDiZ72NO7Qnu1rgtq0xzl/eXFTWI4OMn+2tcP
         qoJQ==
X-Received: by 10.66.148.8 with SMTP id to8mr9320817pab.0.1382472234909;
        Tue, 22 Oct 2013 13:03:54 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.49.71.209 with SMTP id x17ls230074qeu.83.gmail; Tue, 22 Oct
 2013 13:03:54 -0700 (PDT)
X-Received: by 10.49.13.40 with SMTP id e8mr732580qec.1.1382472233982;
        Tue, 22 Oct 2013 13:03:53 -0700 (PDT)
In-Reply-To: <CAPBZbvzVuUKHsNSWz+KQPBzB1KJh0KgaY_cv6XuCwuhbZRhgHw@mail.gmail.com>
X-Original-Sender: vlad.moscow@mail.ru
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: <http://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <http://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <http://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:std-proposals+subscribe@isocpp.org>
List-Unsubscribe: <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:7405
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/7405>

------=_Part_434_27953027.1382472233301
Content-Type: text/plain; charset=KOI8-R
Content-Transfer-Encoding: quoted-printable

=20
In this case you can not substituted a call of the method for=20
std::basic_string with a call for a vector. So the interface will not be=20
consistent.=20
=20
Apart from this the call
=20
std::cout << v.append( { 1, 2, 3, 4, 5 } );
=20
looks semantically more clear than
=20
std::cout << append( v, { 1, 2, 3, 4, 5 } );
=20
From the second call it is not clear what is outputed whether it is a new=
=20
vector or it is the original vector.

=D7=D4=CF=D2=CE=C9=CB, 22 =CF=CB=D4=D1=C2=D2=D1 2013 =C7., 21:37:19 UTC+4 =
=D0=CF=CC=D8=DA=CF=D7=C1=D4=C5=CC=D8 Billy O'Neal=20
=CE=C1=D0=C9=D3=C1=CC:

> I suppose I understand why there's no append here -- append on=20
> basic_string is the same thing effectively as operator+=3D -- but there's=
 no=20
> such semantic operation that makes sense for vector.
>
> I suppose there's no reason for someone who wants this semantic not to do=
:
>
> template <typename T, typename InputIterator>
> T& append(T& container, InputIterator first, InputIterator last)
> {
>     container.insert(container.end(), first, last);
>     return container;
> }
>
> Billy O'Neal
> https://github.com/BillyONeal/ <https://bitbucket.org/BillyONeal/>
>  http://stackoverflow.com/users/82320/billy-oneal
> Malware Response Instructor - BleepingComputer.com
>
>
> On Tue, Oct 22, 2013 at 5:04 AM, Vlad from Moscow <vlad....@mail.ru<javas=
cript:>
> > wrote:
>
>> Taking into account method append of std::basic_string it is not a new=
=20
>> name. append and insert will have differenct semantic. append will retur=
n=20
>> reference to the container itself. So you can use it for example the=20
>> follwoing way
>> =20
>> std::vector<int> v =3D { 1, 2, 3, 4, 5 };
>> =20
>> for ( int x : v.append( { 4, 3, 2, 1 } ) ) std::cout << x << ' ';
>> =20
>> insert is used then you need the position after inserting new elements.=
=20
>> For example
>> =20
>> auto pos =3D v.end();
>> =20
>> pos =3D v.insert( pos, { 4, 3, 2, 1 } );
>> v.insert( pos, 5 );
>>
>> =D7=D4=CF=D2=CE=C9=CB, 22 =CF=CB=D4=D1=C2=D2=D1 2013 =C7., 11:56:50 UTC+=
4 =D0=CF=CC=D8=DA=CF=D7=C1=D4=C5=CC=D8 Bengt Gustafsson=20
>> =CE=C1=D0=C9=D3=C1=CC:
>>
>>> I think the idea is good, this use case appears quite often. But why no=
t=20
>>> overload push_back with more signatures instead of introducing a new na=
me?=20
>>> The signatures available would then be exactly parallel to insert(), wi=
th=20
>>> the difference that the first parameter is absent.
>>>
>>>
>>> Den tisdagen den 22:e oktober 2013 kl. 01:20:59 UTC+2 skrev Evgeny=20
>>> Panasyuk:
>>>>
>>>>
>>>> No, I do not think so.
>>>>>
>>>>
>>>> Why not?
>>>> =20
>>>>
>>>>> It is common interface of all sequential containers including and=20
>>>>> together with std::basic_string.
>>>>>
>>>>
>>>> Just read GotW #84.
>>>> std::string has many controversial design decisions. We should not=20
>>>> uglify STL by borrowing bad stuff from std::string.
>>>>
>>>  --=20
>> =20
>> ---=20
>> You received this message because you are subscribed to the Google Group=
s=20
>> "ISO C++ Standard - Future Proposals" group.
>> To unsubscribe from this group and stop receiving emails from it, send a=
n=20
>> email to std-proposal...@isocpp.org <javascript:>.
>> To post to this group, send email to std-pr...@isocpp.org <javascript:>.
>> Visit this group at=20
>> http://groups.google.com/a/isocpp.org/group/std-proposals/.
>>
>
>

--=20

---=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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.

------=_Part_434_27953027.1382472233301
Content-Type: text/html; charset=KOI8-R
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>&nbsp;</div><div>In this case you can not substituted=
 a call of the method for std::basic_string with a call for&nbsp;a vector. =
So the interface will not be consistent. </div><div>&nbsp;</div><div>Apart =
from this the call</div><div>&nbsp;</div><div>std::cout &lt;&lt; v.append( =
{ 1, 2, 3, 4, 5 } );</div><div>&nbsp;</div><div>looks semantically more cle=
ar than</div><div>&nbsp;</div><div>std::cout &lt;&lt; append( v, { 1, 2, 3,=
 4, 5 } );</div><div>&nbsp;</div><div>From the second call it is not clear =
what is outputed whether it is a new vector or it is the original vector.</=
div><div><br>=D7=D4=CF=D2=CE=C9=CB, 22 =CF=CB=D4=D1=C2=D2=D1 2013&nbsp;=C7.=
, 21:37:19 UTC+4 =D0=CF=CC=D8=DA=CF=D7=C1=D4=C5=CC=D8 Billy O'Neal =CE=C1=
=D0=C9=D3=C1=CC:</div><blockquote class=3D"gmail_quote" style=3D"margin: 0p=
x 0px 0px 0.8ex; padding-left: 1ex; border-left-color: rgb(204, 204, 204); =
border-left-width: 1px; border-left-style: solid;"><div dir=3D"ltr">I suppo=
se I understand why there's no append here -- append on basic_string is the=
 same thing effectively as operator+=3D -- but there's no such semantic ope=
ration that makes sense for vector.<div><br>

</div><div>I suppose there's no reason for someone who wants this semantic =
not to do:</div><div><br></div><div>template &lt;typename T, typename Input=
Iterator&gt;</div><div>T&amp; append(T&amp; container, InputIterator first,=
 InputIterator last)</div>

<div>{</div><div>&nbsp; &nbsp; container.insert(container.<wbr>end(), first=
, last);</div><div>&nbsp; &nbsp; return container;</div><div>}</div><div><d=
iv><br clear=3D"all"><div><div dir=3D"ltr"><div>Billy O'Neal</div><div><a h=
ref=3D"https://bitbucket.org/BillyONeal/" target=3D"_blank">https://github.=
com/BillyONeal/</a></div>

<div>
<a href=3D"http://stackoverflow.com/users/82320/billy-oneal" target=3D"_bla=
nk">http://stackoverflow.com/<wbr>users/82320/billy-oneal</a></div><div>Mal=
ware Response Instructor - BleepingComputer.com</div></div></div>
<br><br><div class=3D"gmail_quote">On Tue, Oct 22, 2013 at 5:04 AM, Vlad fr=
om Moscow <span dir=3D"ltr">&lt;<a href=3D"javascript:" target=3D"_blank" g=
df-obfuscated-mailto=3D"nS9EIkvork8J">vlad....@mail.ru</a>&gt;</span> wrote=
:<br><blockquote class=3D"gmail_quote" style=3D"margin: 0px 0px 0px 0.8ex; =
padding-left: 1ex; border-left-color: rgb(204, 204, 204); border-left-width=
: 1px; border-left-style: solid;">


<div dir=3D"ltr"><div>Taking into account method append of std::basic_strin=
g it is not a new name. append and insert will have differenct semantic. ap=
pend will return reference to the container itself. So you can use it for e=
xample the follwoing way</div>


<div>&nbsp;</div><div>std::vector&lt;int&gt; v =3D { 1, 2, 3, 4, 5 };</div>=
<div>&nbsp;</div><div>for ( int x&nbsp;: v.append( { 4, 3, 2, 1 } ) ) std::=
cout &lt;&lt; x &lt;&lt; ' ';</div><div>&nbsp;</div><div>insert is used the=
n you need the position after inserting new elements. For example</div>


<div>&nbsp;</div><div>auto pos =3D v.end();</div><div>&nbsp;</div><div>pos =
=3D v.insert( pos, { 4, 3, 2, 1 } );</div><div>v.insert( pos,&nbsp;5 );</di=
v><div><br>=D7=D4=CF=D2=CE=C9=CB, 22 =CF=CB=D4=D1=C2=D2=D1 2013&nbsp;=C7., =
11:56:50 UTC+4 =D0=CF=CC=D8=DA=CF=D7=C1=D4=C5=CC=D8 Bengt Gustafsson =CE=C1=
=D0=C9=D3=C1=CC:</div>


<div><div><blockquote class=3D"gmail_quote" style=3D"margin: 0px 0px 0px 0.=
8ex; padding-left: 1ex; border-left-color: rgb(204, 204, 204); border-left-=
width: 1px; border-left-style: solid;"><div dir=3D"ltr">I think the idea is=
 good, this use case appears quite often. But why not overload push_back wi=
th more signatures instead of introducing a new name? The signatures availa=
ble would then be exactly parallel to insert(), with the difference that th=
e first parameter is absent.<div>


<br><br>Den tisdagen den 22:e oktober 2013 kl. 01:20:59 UTC+2 skrev Evgeny =
Panasyuk:<blockquote class=3D"gmail_quote" style=3D"margin: 0px 0px 0px 0.8=
ex; padding-left: 1ex; border-left-color: rgb(204, 204, 204); border-left-w=
idth: 1px; border-left-style: solid;">


<div dir=3D"ltr"><br><blockquote class=3D"gmail_quote" style=3D"margin: 0px=
 0px 0px 0.8ex; padding-left: 1ex; border-left-color: rgb(204, 204, 204); b=
order-left-width: 1px; border-left-style: solid;"><div dir=3D"ltr"><div>No,=
 I do not think so.</div>


</div></blockquote><div><br>Why not?<br>&nbsp;</div><blockquote class=3D"gm=
ail_quote" style=3D"margin: 0px 0px 0px 0.8ex; padding-left: 1ex; border-le=
ft-color: rgb(204, 204, 204); border-left-width: 1px; border-left-style: so=
lid;"><div dir=3D"ltr">


<div>It is common interface of all sequential containers&nbsp;including&nbs=
p;and together with std::basic_string.</div></div></blockquote><div><br>Jus=
t read GotW #84.<br>std::string has many controversial design decisions. We=
 should not uglify STL by borrowing bad stuff from std::string.<br>


</div></div></blockquote></div></div></blockquote></div></div></div><div><d=
iv>

<p></p>

-- <br>
&nbsp;<br>
--- <br>
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" 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"=
nS9EIkvork8J">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"nS9EIkvork8J">std-pr...@isocpp.org</a>.<br>
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/" target=3D"_blank">http://groups.google.com/a/<wbr>isocpp.or=
g/group/std-<wbr>proposals/</a>.<br>
</div></div></blockquote></div><br></div></div></div>
</blockquote></div>

<p></p>

-- <br />
&nbsp;<br />
--- <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 std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_434_27953027.1382472233301--

.
