220 22437 <cf9b040c-5008-4f40-bd53-0bf898f95ac2@isocpp.org> article
Path: news.gmane.org!not-for-mail
From: leni536@gmail.com
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: std::vector (and other containers) to have a
 perfect forwarding constructor
Date: Wed, 11 Nov 2015 01:20:01 -0800 (PST)
Lines: 118
Approved: news@gmane.org
Message-ID: <cf9b040c-5008-4f40-bd53-0bf898f95ac2@isocpp.org>
References: <14fb89ea-443b-4696-93ec-29889f642bca@isocpp.org>
 <CAGNvRgBEn=wGT0Z3Wq+Pq4eKXinwEgsO66eQS6bw8WoCrgqC1A@mail.gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_761_1031011390.1447233601836"
X-Trace: ger.gmane.org 1447233608 11772 80.91.229.3 (11 Nov 2015 09:20:08 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Wed, 11 Nov 2015 09:20:08 +0000 (UTC)
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBDXJR44QUQHBBQUQRSZAKGQE45DQCTQ@isocpp.org Wed Nov 11 10:20:07 2015
Return-path: <std-proposals+bncBDXJR44QUQHBBQUQRSZAKGQE45DQCTQ@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-pa0-f69.google.com ([209.85.220.69])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBDXJR44QUQHBBQUQRSZAKGQE45DQCTQ@isocpp.org>)
	id 1ZwRZU-0002on-Ec
	for gclcip-std-proposals@m.gmane.org; Wed, 11 Nov 2015 10:20:04 +0100
Original-Received: by paak3 with SMTP id k3sf3726844paa.3
        for <gclcip-std-proposals@m.gmane.org>; Wed, 11 Nov 2015 01:20:03 -0800 (PST)
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
         :content-type: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=buJz/xXDiJ+WgvHlj1+9+xnFw9xt0X32QvMi7kjKXBs=;
        b=OTxMm1xqGn04dlCF20TgFoX9hIa8iSxtSgV3YJcHHxyV4FvM93daPAF1oOig53GAJg
         /FRVfv5oM/jPZxOj1+W5tflFCOghMcb5jNyTqvAJQD8kgfMd997C2oRGKPMbA8qAvm8y
         c70+MS3Pw40mLCI+MwRMI+zbW1gY31b0ZdeJYxFyEa8zBQHsIy9wm4eihD3dfrRYkN/e
         LMA51G9Mvt5QNzLhlmAmfwXysEQTdvAGJNJVoO2Fw1C4PAeqp84cx1gQwZQkGX9r8YlH
         hzv2sfNvWsH5mPW6/RcC36Oi4DXdKAV6XEqR2dIAfmfGLu8gPT7NuRSyy59EA1F1nCDE
         /zDA==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=date:from:to:message-id:in-reply-to:references:subject:mime-version
         :content-type: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=buJz/xXDiJ+WgvHlj1+9+xnFw9xt0X32QvMi7kjKXBs=;
        b=LTqnQSBB0mShArNUaxMiC+6l1X7iGM7wgaIK2HMv8fZ9N3ktj6b2zfjJX7uipY0Xx9
         Hou22jAQueObtvTKTwLFf62pFsOEZtNnhhdqAQsZe0VcvnjZhOQEzlEQeqjaVw0FqCDB
         OOyay4njYHf/TlUzUaOfUo8Wx3G+bZOgw80M1B52XI2iMkLBnTLSGtMKHSwcJLnwKZaZ
         4MVCaRIbOfbOa2FfjQXRwtcM8WBw7ZyZGI6JKrYTM+Y4xBJkZkB7+Es8z2Z4TGIA6YVy
         gJPtl1xc7zYJRCRDL3Fzr46GoSe/tRKGtL41wY4afuRx9xrkEW+bHGumjk61n5bi+v2m
         ECHA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:date:from:to:message-id:in-reply-to:references
         :subject:mime-version:content-type: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=buJz/xXDiJ+WgvHlj1+9+xnFw9xt0X32QvMi7kjKXBs=;
        b=c3whFZjQLOP5ol0wH4dOEWtCynx6W3ZaKnZkdsEk0f6fNeroLbv5DX/7tIC19dLJVI
         sqYbfzyLga70fTL3kX86zSLSGapijz9xE5OFgPw/dEsYdWJ2xJNcKfCvHpzkmbcpDJtU
         1vVoaLQIizPvIZM+LVvEoa/j84CCtjQGFrcM4Lxa6IuZLjUYcliHwRajq/R5VHm7UJiM
         lFqlQEeK1Ct+Z2IPndVbt5rcdBlX7inGkV4H5hNaLL843bO5LyPG1xKJ0gK8Nc9MHaGk
         sDMjuzpEWKl/fLrVgivs8ej1T1uXhTUYazsSNxNU0+jHTTiXuzWi5dsFCduKcp8zLmci
         fZzw==
X-Gm-Message-State: ALoCoQmI8P2m1+TCrZgmTURWCFUF0vrPBE09giNkWiDbZXALsXzRN9zngKS//vIvadgMPnZJbyDn
X-Received: by 10.68.196.169 with SMTP id in9mr841931pbc.2.1447233603291;
        Wed, 11 Nov 2015 01:20:03 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.107.11.139 with SMTP id 11ls138793iol.94.gmail; Wed, 11 Nov
 2015 01:20:02 -0800 (PST)
X-Received: by 10.50.142.66 with SMTP id ru2mr748431igb.3.1447233602485;
        Wed, 11 Nov 2015 01:20:02 -0800 (PST)
In-Reply-To: <CAGNvRgBEn=wGT0Z3Wq+Pq4eKXinwEgsO66eQS6bw8WoCrgqC1A@mail.gmail.com>
X-Original-Sender: leni536@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: <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: <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>,
 <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:22437
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/22437>

------=_Part_761_1031011390.1447233601836
Content-Type: multipart/alternative; 
	boundary="----=_Part_762_1085229922.1447233601837"

------=_Part_762_1085229922.1447233601837
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable


On Wednesday, November 11, 2015 at 10:01:56 AM UTC+1, Daniel Kr=C3=BCgler w=
rote:
>
> I consider the combination of "perfect forwarding" and the additional=20
> size information as a potential dangerous combination. If a=20
> constructor with size information would get any rvalues via args, the=20
> first vector element construction might move the arguments into the=20
> target and the second, third, etc. vector element constructed from the=20
> same argument pack would try to become constructed from already moved=20
> arguments. For exactly this reason any existing container member=20
> function that provides a size information and a "prototype" value=20
> expects that value as const value_type& and not as a potentially=20
> movable argument.=20
>
> - Daniel=20
>

Yeah, that was truly a mistake by me, perfect forwarding really doesn't=20
make sense in this context. Shouldn't this work though?

vector(size_type n,vector::forward_args_type,Args&... args);

=20
This way even if something in args is an rvalue reference its type would be=
=20
deduced to be an lvalue reference.

- L=C3=A9n=C3=A1rd

--=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_762_1085229922.1447233601837
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br>On Wednesday, November 11, 2015 at 10:01:56 AM UTC+1, =
Daniel Kr=C3=BCgler wrote:<blockquote class=3D"gmail_quote" style=3D"margin=
: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">I co=
nsider the combination of &quot;perfect forwarding&quot; and the additional
<br>size information as a potential dangerous combination. If a
<br>constructor with size information would get any rvalues via args, the
<br>first vector element construction might move the arguments into the
<br>target and the second, third, etc. vector element constructed from the
<br>same argument pack would try to become constructed from already moved
<br>arguments. For exactly this reason any existing container member
<br>function that provides a size information and a &quot;prototype&quot; v=
alue
<br>expects that value as const value_type&amp; and not as a potentially
<br>movable argument.
<br>
<br>- Daniel
<br></blockquote><div><br></div><div>Yeah, that was truly a mistake by me, =
perfect forwarding really doesn&#39;t make sense in this context. Shouldn&#=
39;t this work though?</div><div><br></div><div><span style=3D"font-family:=
 monospace; color: rgb(0, 0, 0); background-color: rgb(250, 250, 250);"><di=
v class=3D"prettyprint" style=3D"border: 1px solid rgb(187, 187, 187); word=
-wrap: break-word; background-color: rgb(250, 250, 250);"><code class=3D"pr=
ettyprint"><div class=3D"subprettyprint"><span style=3D"color: #000;" class=
=3D"styled-by-prettify">vector</span><span style=3D"color: rgb(102, 102, 0)=
;"><span style=3D"color: #660;" class=3D"styled-by-prettify">(</span></span=
><span style=3D"color: #000;" class=3D"styled-by-prettify">size_type n</spa=
n><span style=3D"color: rgb(102, 102, 0);"><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">,</span></span><span style=3D"color: #000;" class=
=3D"styled-by-prettify">vector</span><span style=3D"color: rgb(102, 102, 0)=
;"><span style=3D"color: #660;" class=3D"styled-by-prettify">::</span></spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify">forward_args_ty=
pe</span><span style=3D"color: rgb(102, 102, 0);"><wbr><span style=3D"color=
: #660;" class=3D"styled-by-prettify">,</span></span><span style=3D"color: =
rgb(102, 0, 102);"><span style=3D"color: #606;" class=3D"styled-by-prettify=
">Args</span></span><span style=3D"color: rgb(102, 102, 0);"><span style=3D=
"color: #660;" class=3D"styled-by-prettify">&amp;...</span></span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"> args</span><span style=3D=
"color: rgb(102, 102, 0);"><span style=3D"color: #660;" class=3D"styled-by-=
prettify">);</span></span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"><br></span></div><div><span style=3D"color: rgb(102, 102, 0);"><br=
></span></div></code></div></span>=C2=A0<span style=3D"font-family: monospa=
ce; color: rgb(0, 0, 0); background-color: rgb(250, 250, 250);"><br></span>=
</div><div>This way even if something in args is an rvalue reference its ty=
pe would be deduced to be an lvalue reference.</div><div><br></div><div>- L=
=C3=A9n=C3=A1rd</div><div><br></div></div>

<p></p>

-- <br />
<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 <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 />
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_762_1085229922.1447233601837--
------=_Part_761_1031011390.1447233601836--

.
