220 20547 <CADGW59nvg3sC0D1kkEW9HDjpHGdqabHycXbR-hqTgbmsmEKbAA@mail.gmail.com> article
Path: news.gmane.org!not-for-mail
From: =?UTF-8?Q?Tomasz_Kami=C5=84ski?= <tomaszkam@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Draft D0065: Movable initializer lists, rev. 2
Date: Mon, 21 Sep 2015 08:43:37 +0200
Lines: 115
Approved: news@gmane.org
Message-ID: <CADGW59nvg3sC0D1kkEW9HDjpHGdqabHycXbR-hqTgbmsmEKbAA@mail.gmail.com>
References: <BAE02C11-9AC8-41F8-BD3C-A2C9B33F9794@gmail.com>
	<87343e65-eecd-4b96-86b7-a883aa7f9d1d@isocpp.org>
	<ADB6E3C0-AD21-41A1-86AA-3DE2637BEABC@gmail.com>
	<CADGW59mVUmCTVN+CSVnk+LCmTvFXBf1YR_L5X1dfEgoKEPF8FQ@mail.gmail.com>
	<6D75256B-F476-4BA4-BA13-D2342F8B7B6B@gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary=047d7b41889b7d8a1405203c3377
X-Trace: ger.gmane.org 1442817821 26321 80.91.229.3 (21 Sep 2015 06:43:41 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Mon, 21 Sep 2015 06:43:41 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBDNPVXXG6IGBBGWO72XQKGQE43SW2YI@isocpp.org Mon Sep 21 08:43:40 2015
Return-path: <std-proposals+bncBDNPVXXG6IGBBGWO72XQKGQE43SW2YI@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-vk0-f70.google.com ([209.85.213.70])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBDNPVXXG6IGBBGWO72XQKGQE43SW2YI@isocpp.org>)
	id 1Zdup9-0002y8-V7
	for gclcip-std-proposals@m.gmane.org; Mon, 21 Sep 2015 08:43:40 +0200
Original-Received: by vkao3 with SMTP id o3sf168619846vka.1
        for <gclcip-std-proposals@m.gmane.org>; Sun, 20 Sep 2015 23:43:38 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:mime-version:in-reply-to:references:date
         :message-id:subject:from:to:content-type:x-original-sender
         :x-original-authentication-results:reply-to:precedence:mailing-list
         :list-id:x-spam-checked-in-group:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=9g5rEX9nvMUepTymTWw8ds0JIrANH34zDmTKjgW8h7I=;
        b=gkR0cLrpICLS8ZFyRMjFCdomQ+Gu2QQrpSrK4g2yjplzbkl9lzIrwB+rcIBggZBdo/
         JBS+ahJR1QtIk4W8wPaTeQTpAozudStUfbnvsXjLxK2mXLYMxU/KSF7nZCnJIQGnIMAm
         0z54GcaoE8q+QLSovXlaTtqCzYkJgZwoGGPy3DSm6ZZCSyjMyaueWWV8/Cw2ZTnjS2J3
         ntJfivcfZZvBXjrT8iN1VxxoZ04JjpBDkFK19ooFwazy9ahUSo5PBohErvDOEtJ4n85o
         SYF5w4sbIB2hpIR/eOeSn1Zw7VVZtRgJ2GpRjbYS2auGnR3HYM1oyeYVXnEKUAzUXdsK
         +YYA==
X-Gm-Message-State: ALoCoQkKRFqNNQoVXL7dgLI5vRini1jc3qgjPeeeVKaPwv1thMWj6WuSrRSVQcli9K7tolB2q1DS
X-Received: by 10.140.135.5 with SMTP id 5mr15756473qhh.11.1442817818820;
        Sun, 20 Sep 2015 23:43:38 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.182.28.99 with SMTP id a3ls835521obh.42.gmail; Sun, 20 Sep
 2015 23:43:38 -0700 (PDT)
X-Received: by 10.202.192.131 with SMTP id q125mr4259114oif.118.1442817817996;
        Sun, 20 Sep 2015 23:43:37 -0700 (PDT)
Original-Received: from mail-ob0-x232.google.com (mail-ob0-x232.google.com. [2607:f8b0:4003:c01::232])
        by mx.google.com with ESMTPS id xe1si11241166oeb.42.2015.09.20.23.43.37
        for <std-proposals@isocpp.org>
        (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Sun, 20 Sep 2015 23:43:37 -0700 (PDT)
Received-SPF: pass (google.com: domain of tomaszkam@gmail.com designates 2607:f8b0:4003:c01::232 as permitted sender) client-ip=2607:f8b0:4003:c01::232;
Original-Received: by obbmp4 with SMTP id mp4so40966958obb.3
        for <std-proposals@isocpp.org>; Sun, 20 Sep 2015 23:43:37 -0700 (PDT)
X-Received: by 10.60.81.166 with SMTP id b6mr10177751oey.31.1442817817543;
 Sun, 20 Sep 2015 23:43:37 -0700 (PDT)
Original-Received: by 10.202.87.82 with HTTP; Sun, 20 Sep 2015 23:43:37 -0700 (PDT)
In-Reply-To: <6D75256B-F476-4BA4-BA13-D2342F8B7B6B@gmail.com>
X-Original-Sender: tomaszkam@gmail.com
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of tomaszkam@gmail.com designates 2607:f8b0:4003:c01::232 as permitted
 sender) smtp.mailfrom=tomaszkam@gmail.com;       dkim=pass
 header.i=@gmail.com;       dmarc=pass (p=NONE dis=NONE) header.from=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:20547
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/20547>

--047d7b41889b7d8a1405203c3377
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

2015-09-21 8:25 GMT+02:00 David Krauss <potswa@gmail.com>:

>
>
> On 2015=E2=80=9309=E2=80=9321, at 1:41 PM, Tomasz Kami=C5=84ski <tomaszka=
m@gmail.com> wrote:
>
> However, I still think that removing the move-constructor would be
> beneficial. The existence of the move-constructor and the name
> (own_initializer_list) suggest that the list object actually manages
> storage and moves it from one object to another. As the
> own_initializer_list is effectively wrapped reference to stack allocated
> array, it cannot do that, so the current design is misleading.
>
>
> Does a std::vector (or, as you mention, unique_ptr<T[]>) =E2=80=9Cmove st=
orage
> from one object to another=E2=80=9D? Aside from user-replaced ::operator =
new or
> watching the stack pointer, and aside from the restricted capabilities of
> the list, what=E2=80=99s the observable difference between own_initialize=
r_list
> and unique_ptr<T[]>?
>
>
The following:
std::size_t computeSomething(std::vector<std::string>);

std::function<std::size_t()> lazyEvaluator()
{
   Type list =3D {"ala", "ola"};
   return std::bind(computeSomething, std::move(list));
}
Works correctly if Type is std::vector<std::string>, but if for Type is
own_initializer_list<std::string> it will cause either:
1. dangling reference
2. unreadable warrning about own_initializer_list member in the some
strange tuple (I belive that is what your proposal dy).
Making own_initializer_list non-movable, will produce error about list
being non-moveable. As own_initializer_list is bassically reference, then
this is true.

--=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/.

--047d7b41889b7d8a1405203c3377
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"gmail_extra"><br><div class=3D"gmail_quote">=
2015-09-21 8:25 GMT+02:00 David Krauss <span dir=3D"ltr">&lt;<a href=3D"mai=
lto:potswa@gmail.com" target=3D"_blank">potswa@gmail.com</a>&gt;</span>:<br=
><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border=
-left:1px solid rgb(204,204,204);padding-left:1ex"><div style=3D"word-wrap:=
break-word"><br><br><div><span class=3D""><blockquote type=3D"cite"><div>On=
 2015=E2=80=9309=E2=80=9321, at 1:41 PM, Tomasz Kami=C5=84ski &lt;<a href=
=3D"mailto:tomaszkam@gmail.com" target=3D"_blank">tomaszkam@gmail.com</a>&g=
t; wrote:</div><br><div><div dir=3D"ltr"><div class=3D"gmail_extra">However=
, I still think that removing the move-constructor would be beneficial. The=
 existence of the move-constructor and the name (own_initializer_list) sugg=
est that the list object actually manages storage and moves it from one obj=
ect to another. As the own_initializer_list is effectively wrapped referenc=
e to stack allocated array, it cannot do that, so the current design is mis=
leading.</div></div></div></blockquote><div><br></div></span><div>Does a <f=
ont face=3D"Courier">std::vector</font>=C2=A0(or, as you mention,=C2=A0<spa=
n style=3D"font-family:Courier">unique_ptr&lt;T[]&gt;</span>) =E2=80=9Cmove=
 storage from one object to another=E2=80=9D? Aside from user-replaced <fon=
t face=3D"Courier">::operator new</font> or watching the stack pointer, and=
 aside from the restricted capabilities of the list, what=E2=80=99s the obs=
ervable difference between <font face=3D"Courier">own_initializer_list</fon=
t> and <font face=3D"Courier">unique_ptr&lt;T[]&gt;</font>?</div><span clas=
s=3D""></span><br></div></div></blockquote><div><br></div><div>The followin=
g:<br></div><div>std::size_t computeSomething(std::vector&lt;std::string&gt=
;);<br></div><div><br></div><div>std::function&lt;std::size_t()&gt; lazyEva=
luator()<br>{<br></div><div>=C2=A0 =C2=A0Type list =3D {&quot;ala&quot;, &q=
uot;ola&quot;};<br></div><div>=C2=A0=C2=A0 return std::bind(computeSomethin=
g, std::move(list));</div><div>} <br></div>Works correctly if Type is std::=
vector&lt;std::string&gt;, but if for Type is own_initializer_list&lt;std::=
string&gt; it will cause either:<br>1. dangling reference<br></div><div cla=
ss=3D"gmail_quote">2. unreadable warrning about own_initializer_list member=
 in the some strange tuple (I belive that is what your proposal dy).<br></d=
iv><div class=3D"gmail_quote">Making own_initializer_list non-movable, will=
 produce error about list being non-moveable. As own_initializer_list is ba=
ssically reference, then this is true.<br></div></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 />

--047d7b41889b7d8a1405203c3377--

.
