220 19759 <5e70c6b8-7faf-4b6d-a4e2-dbf502116c39@isocpp.org> article
Path: news.gmane.org!not-for-mail
From: isocppgroup@denisbider.com
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Re: Move destructor draft
Date: Mon, 10 Aug 2015 15:17:01 -0700 (PDT)
Lines: 524
Approved: news@gmane.org
Message-ID: <5e70c6b8-7faf-4b6d-a4e2-dbf502116c39@isocpp.org>
References: <0A99E209-333B-4140-8F65-2F022E681AC1@gmail.com> <mqab2k$hkh$1@ger.gmane.org> <cc69210f-3dec-42ed-8729-ba9576d13467@isocpp.org>
 <11799558.eJTBMtnS6W@tjmaciei-mobl4>
 <368db355-1910-4da3-b50e-96a595ee974a@isocpp.org>
 <c52673f9-dda3-453d-9adb-c912a3348405@isocpp.org>
 <f9b91a13-f5ce-452b-9f4b-a43c7522d75e@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_5153_517007116.1439245021585"
X-Trace: ger.gmane.org 1439245027 9265 80.91.229.3 (10 Aug 2015 22:17:07 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Mon, 10 Aug 2015 22:17:07 +0000 (UTC)
Cc: isocppgroup@denisbider.com
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBD5LNK7YQYJRBXWFUSXAKGQE2PZHDAI@isocpp.org Tue Aug 11 00:17:06 2015
Return-path: <std-proposals+bncBD5LNK7YQYJRBXWFUSXAKGQE2PZHDAI@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-ig0-f197.google.com ([209.85.213.197])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBD5LNK7YQYJRBXWFUSXAKGQE2PZHDAI@isocpp.org>)
	id 1ZOvNQ-0005fv-Gv
	for gclcip-std-proposals@m.gmane.org; Tue, 11 Aug 2015 00:17:04 +0200
Original-Received: by igbjg10 with SMTP id jg10sf47363601igb.0
        for <gclcip-std-proposals@m.gmane.org>; Mon, 10 Aug 2015 15:17:03 -0700 (PDT)
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:cc: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=mKEoZ4Kix+ijDVPDOTzIafuXJEAvHWenyGz8I41RFIo=;
        b=hw9tQ8NTpFNLZsRbXOW/frphnvlR8eY8Wid2KvZFvxprtv688uWsjzYs1VYiqasEx5
         7ycyhQaa+tfB7Is+sPtpALq2RzYMS0E2w39cAY0TtbH8j3IgaKDdEbuxqpDp4ql1FzP7
         qm1tcvF0Xsdc0KI+/EB+s2EE6miznhp1k459JuabJy86UPSBTLYst4PGD0HEpQKiPDV4
         HfGriqrXoj3Bab1vj044CdB/PI2De/P6G7hkOvWSzWhe/OQJuk11/hk7M/kwElyecw1T
         mEO9Mz2ixWcGq8cf2KWK5iFvJLEgLthFFtNeFyv4bUy4OFn7L8pNY0KnMawBg4n4MZVp
         KSNQ==
X-Gm-Message-State: ALoCoQlG9wIBd3ctuf63qkz/S+r0oTpRzqSsX8Xf8ieBxylP8OrrqYc/GZCY72r6wbBZN17je8+m
X-Received: by 10.182.143.70 with SMTP id sc6mr22645610obb.24.1439245023370;
        Mon, 10 Aug 2015 15:17:03 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.140.107.246 with SMTP id h109ls3215371qgf.1.gmail; Mon, 10 Aug
 2015 15:17:02 -0700 (PDT)
X-Received: by 10.140.98.147 with SMTP id o19mr98945qge.37.1439245022391;
        Mon, 10 Aug 2015 15:17:02 -0700 (PDT)
In-Reply-To: <f9b91a13-f5ce-452b-9f4b-a43c7522d75e@isocpp.org>
X-Original-Sender: isocppgroup@denisbider.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:19759
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/19759>

------=_Part_5153_517007116.1439245021585
Content-Type: multipart/alternative; 
	boundary="----=_Part_5154_539478872.1439245021586"

------=_Part_5154_539478872.1439245021586
Content-Type: text/plain; charset=UTF-8

However, if there's real desire for the wrapper you show to be legal, a 
better way to do it would probably be to allow this:

 

  >>A(A& x) : B(std::move(x)), >>c(x.c), >>i(x.i) { a = this; }

 

But this means we:

- say goodbye to the noexcept guarantee;

- define the point when ~B is called in the original location - 
probably when >>A returns;

- introduce another type trait, is_nothrow_relocatable

I would have preferred to avoid this, but - I guess, if people *really* 
want to merge move and copy construction into relocation... *(shudder :)*


On Monday, August 10, 2015 at 3:59:07 PM UTC-6, isocp...@denisbider.com 
wrote:

> Hmm, good points.
>
> There are definitely situations where you don't want to mem-initialize a 
> trivial member, such as in the example:
>
>     >>A(A& x) : >>B(x), >>c(x.c), >>i(x.i)
>
>       { a = *this*; }
>
> However, one might definitely argue that situations where you want to 
> mem-initialize a base or a member, but with a non-corresponding member, are 
> practically nonexistent. So, we may in fact prefer the following:
>
>     >>A(A& x) : >>B, >>c, >>i
>
>       { a = *this*; }
>
> The relocate_wrapper you suggest I think looks neat, and should be legal. 
> I don't see a reason why it wouldn't be legal, if the mem-initializer-list 
> is not implicit.
>
> It seems to me, intuitively, that there's no reason to make it illegal to 
> access any data member of the moved-from subobject until the outermost 
> relocator exits.
>
> I see no obvious reason why virtual methods shouldn't continue to work, as 
> well. But this is not to say, of course, that one should call them.
>
> In general, anything that's const ought to be safe to call. Which is an 
> argument in favor of making the signature >>T(T const&) - except that would 
> prevent zeroing out of members.
>
>
> On Monday, August 10, 2015 at 2:20:28 PM UTC-6, Edward Catmur wrote:
>
>> A few queries:
>>
>> What exactly are the semantics of the mem-initializer-list, particularly 
>> with regard to omitted, duplicated or misplaced bases/members:
>>
>> struct A {
>>     std::string q, r, s;
>>     >>A(A& x) : >>r(x.r), >>s(x.r) { /* oops */ }
>> };
>>
>> Is it ever legitimate for a mem-initializer to be omitted or to take any 
>> form other than >>id(x.id) where the two identifiers are equivalent? If 
>> so, whose responsibility is it to call the destructor on the corresponding 
>> member of the source object? If not, would it be better to omit the 
>> mem-initializer-list entirely, as with destructors?
>>
>> Within the body of the relocator special member function, what are the 
>> lifetime statuses of the source and destination objects, particularly with 
>> regard to [class.cdtor]? Is it permissible to form lvalues to the bases and 
>> members of the source object, or is this undefined behavior as they are 
>> destructed? If the type is polymorphic, is it permissible to dynamic_cast 
>> or invoke virtual functions on the source? Indeed, is it permissible to 
>> invoke any member functions on the source?
>>
>> In particular, I'd like to make this utility class legal (noting that 
>> aligned_storage_t is a POD but my utility class is not):
>>
>> template<class T>
>> struct relocate_wrapper {
>>   template<class... Args> relocate_wrapper(Args&&... args) {
>>     new (&buf) T(std::forward<Args>(args)...);
>>   }
>>   ~relocate_wrapper() { reinterpret_cast<T&>(buf).~T(); }
>>   >>relocate_wrapper(relocate_wrapper& rhs) {
>>     new (&buf) T(reinterpret_cast<T&&>(rhs.buf));
>>     reinterpret_cast<T&>(rhs.buf).~T();
>>   }
>>   std::aligned_storage_t<sizeof(T), alignof(T)> buf;
>> };
>>
>> Hm... it might be nice to ensure that the relocator doesn't do any 
>> unnecessary work copying the buffer that's just going to be placement new 
>> moved into. Is that an argument against an implicit mem-initializer-list?
>>
>

-- 

--- 
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

------=_Part_5154_539478872.1439245021586
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>However,=C2=A0if there&#39;s real desire for the wrap=
per you show to be legal, a better way to do it would probably be to allow =
this:</div><div><br></div><div><font color=3D"#000000" face=3D"Times New Ro=
man" size=3D"3">

</font><p style=3D"background: rgb(246, 248, 255); margin: 0in 0in 0pt; lin=
e-height: normal; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt =
320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732=
..8pt;"><span style=3D"font-family: Consolas; font-size: 10pt;"><font color=
=3D"#000000">=C2=A0</font></span></p><font color=3D"#000000" face=3D"Times =
New Roman" size=3D"3">

</font><p style=3D"background: rgb(246, 248, 255); margin: 0in 0in 0pt; lin=
e-height: normal; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt =
320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732=
..8pt;"><span style=3D"color: rgb(48, 128, 128); font-family: Consolas; font=
-size: 10pt; mso-fareast-font-family: &quot;Times New Roman&quot;;"><span s=
tyle=3D"mso-spacerun: yes;">=C2=A0 </span>&gt;&gt;</span><span style=3D"col=
or: rgb(0, 0, 32); font-family: Consolas; font-size: 10pt; mso-fareast-font=
-family: &quot;Times New Roman&quot;;">A</span><span style=3D"color: rgb(48=
, 128, 128); font-family: Consolas; font-size: 10pt; mso-fareast-font-famil=
y: &quot;Times New Roman&quot;;">(</span><span style=3D"color: rgb(0, 0, 32=
); font-family: Consolas; font-size: 10pt; mso-fareast-font-family: &quot;T=
imes New Roman&quot;;">A</span><span style=3D"color: rgb(48, 128, 128); fon=
t-family: Consolas; font-size: 10pt; mso-fareast-font-family: &quot;Times N=
ew Roman&quot;;">&amp;</span><span style=3D"color: rgb(0, 0, 32); font-fami=
ly: Consolas; font-size: 10pt; mso-fareast-font-family: &quot;Times New Rom=
an&quot;;"> x</span><span style=3D"color: rgb(48, 128, 128); font-family: C=
onsolas; font-size: 10pt; mso-fareast-font-family: &quot;Times New Roman&qu=
ot;;">)</span><span style=3D"color: rgb(0, 0, 32); font-family: Consolas; f=
ont-size: 10pt; mso-fareast-font-family: &quot;Times New Roman&quot;;"> </s=
pan><span style=3D"color: rgb(64, 96, 128); font-family: Consolas; font-siz=
e: 10pt; mso-fareast-font-family: &quot;Times New Roman&quot;;">:</span><sp=
an style=3D"color: rgb(0, 0, 32); font-family: Consolas; font-size: 10pt; m=
so-fareast-font-family: &quot;Times New Roman&quot;;"> B</span><span style=
=3D"color: rgb(48, 128, 128); font-family: Consolas; font-size: 10pt; mso-f=
areast-font-family: &quot;Times New Roman&quot;;">(</span><span style=3D"co=
lor: rgb(0, 102, 238); font-family: Consolas; font-size: 10pt; mso-fareast-=
font-family: &quot;Times New Roman&quot;;">std</span><span style=3D"color: =
rgb(64, 96, 128); font-family: Consolas; font-size: 10pt; mso-fareast-font-=
family: &quot;Times New Roman&quot;;">::</span><span style=3D"color: rgb(0,=
 0, 32); font-family: Consolas; font-size: 10pt; mso-fareast-font-family: &=
quot;Times New Roman&quot;;">move</span><span style=3D"color: rgb(48, 128, =
128); font-family: Consolas; font-size: 10pt; mso-fareast-font-family: &quo=
t;Times New Roman&quot;;">(</span><span style=3D"color: rgb(0, 0, 32); font=
-family: Consolas; font-size: 10pt; mso-fareast-font-family: &quot;Times Ne=
w Roman&quot;;">x</span><span style=3D"color: rgb(48, 128, 128); font-famil=
y: Consolas; font-size: 10pt; mso-fareast-font-family: &quot;Times New Roma=
n&quot;;">))</span><span style=3D"color: rgb(64, 96, 128); font-family: Con=
solas; font-size: 10pt; mso-fareast-font-family: &quot;Times New Roman&quot=
;;">,</span><span style=3D"color: rgb(0, 0, 32); font-family: Consolas; fon=
t-size: 10pt; mso-fareast-font-family: &quot;Times New Roman&quot;;"> </spa=
n><span style=3D"color: rgb(48, 128, 128); font-family: Consolas; font-size=
: 10pt; mso-fareast-font-family: &quot;Times New Roman&quot;;">&gt;&gt;</sp=
an><span style=3D"color: rgb(0, 0, 32); font-family: Consolas; font-size: 1=
0pt; mso-fareast-font-family: &quot;Times New Roman&quot;;">c</span><span s=
tyle=3D"color: rgb(48, 128, 128); font-family: Consolas; font-size: 10pt; m=
so-fareast-font-family: &quot;Times New Roman&quot;;">(</span><span style=
=3D"color: rgb(0, 0, 32); font-family: Consolas; font-size: 10pt; mso-farea=
st-font-family: &quot;Times New Roman&quot;;">x</span><span style=3D"color:=
 rgb(48, 128, 128); font-family: Consolas; font-size: 10pt; mso-fareast-fon=
t-family: &quot;Times New Roman&quot;;">.</span><span style=3D"color: rgb(0=
, 0, 32); font-family: Consolas; font-size: 10pt; mso-fareast-font-family: =
&quot;Times New Roman&quot;;">c</span><span style=3D"color: rgb(48, 128, 12=
8); font-family: Consolas; font-size: 10pt; mso-fareast-font-family: &quot;=
Times New Roman&quot;;">)</span><span style=3D"color: rgb(64, 96, 128); fon=
t-family: Consolas; font-size: 10pt; mso-fareast-font-family: &quot;Times N=
ew Roman&quot;;">, </span><span style=3D"color: rgb(48, 128, 128); font-fam=
ily: Consolas; font-size: 10pt; mso-fareast-font-family: &quot;Times New Ro=
man&quot;;">&gt;&gt;</span><span style=3D"color: rgb(0, 0, 32); font-family=
: Consolas; font-size: 10pt; mso-fareast-font-family: &quot;Times New Roman=
&quot;;">i</span><span style=3D"color: rgb(48, 128, 128); font-family: Cons=
olas; font-size: 10pt; mso-fareast-font-family: &quot;Times New Roman&quot;=
;">(</span><span style=3D"color: rgb(0, 0, 32); font-family: Consolas; font=
-size: 10pt; mso-fareast-font-family: &quot;Times New Roman&quot;;">x</span=
><span style=3D"color: rgb(48, 128, 128); font-family: Consolas; font-size:=
 10pt; mso-fareast-font-family: &quot;Times New Roman&quot;;">.</span><span=
 style=3D"color: rgb(0, 0, 32); font-family: Consolas; font-size: 10pt; mso=
-fareast-font-family: &quot;Times New Roman&quot;;">i</span><span style=3D"=
color: rgb(48, 128, 128); font-family: Consolas; font-size: 10pt; mso-farea=
st-font-family: &quot;Times New Roman&quot;;">)</span><span style=3D"color:=
 rgb(0, 0, 32); font-family: Consolas; font-size: 10pt; mso-fareast-font-fa=
mily: &quot;Times New Roman&quot;;"> </span><span style=3D"color: rgb(64, 9=
6, 128); font-family: Consolas; font-size: 10pt; mso-fareast-font-family: &=
quot;Times New Roman&quot;;">{ </span><span style=3D"color: rgb(0, 0, 32); =
font-family: Consolas; font-size: 10pt; mso-fareast-font-family: &quot;Time=
s New Roman&quot;;">a </span><span style=3D"color: rgb(48, 128, 128); font-=
family: Consolas; font-size: 10pt; mso-fareast-font-family: &quot;Times New=
 Roman&quot;;">=3D</span><span style=3D"color: rgb(0, 0, 32); font-family: =
Consolas; font-size: 10pt; mso-fareast-font-family: &quot;Times New Roman&q=
uot;;"> </span><span style=3D"color: rgb(48, 128, 128); font-family: Consol=
as; font-size: 10pt; mso-fareast-font-family: &quot;Times New Roman&quot;;"=
>this</span><span style=3D"color: rgb(64, 96, 128); font-family: Consolas; =
font-size: 10pt; mso-fareast-font-family: &quot;Times New Roman&quot;;">; }=
</span></p><font color=3D"#000000" face=3D"Times New Roman" size=3D"3">

</font><p style=3D"background: rgb(246, 248, 255); margin: 0in 0in 0pt; lin=
e-height: normal; tab-stops: 45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt =
320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732=
..8pt;"><span style=3D"color: rgb(0, 0, 32); font-family: Consolas; font-siz=
e: 10pt; mso-fareast-font-family: &quot;Times New Roman&quot;;">=C2=A0</spa=
n></p><font color=3D"#000000" face=3D"Times New Roman" size=3D"3">

</font></div><div><br></div><div>But this means we:</div><div><br></div><di=
v>- say goodbye to the noexcept guarantee;</div><div><br></div><div>- defin=
e the point when=C2=A0~B is called=C2=A0in the original location - probably=
=C2=A0when &gt;&gt;A returns;</div><div><br></div><div>- introduce another =
type trait, <font face=3D"courier new,monospace">is_nothrow_relocatable</fo=
nt></div><div><br></div><div>I would have preferred to avoid this, but - I =
guess, if people <em>really</em> want to merge move and copy=C2=A0construct=
ion into relocation... <em>(shudder :)</em></div><div><br></div><div><br>On=
 Monday, August 10, 2015 at 3:59:07 PM UTC-6, isocp...@denisbider.com wrote=
:</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-wid=
th: 1px; border-left-style: solid;"><div dir=3D"ltr"><div>Hmm, good points.=
</div><div><br></div><div>There are definitely situations where you don&#39=
;t want to mem-initialize a trivial member, such as in the example:</div><d=
iv><br></div><div><font color=3D"#000000" face=3D"Times New Roman" size=3D"=
3">

</font><p style=3D"background: rgb(246, 248, 255); margin: 0in 0in 0pt; lin=
e-height: normal;"><span style=3D"color: rgb(0, 0, 32); font-family: Consol=
as; font-size: 10pt;"><span>=C2=A0=C2=A0=C2=A0 </span></span><span style=3D=
"color: rgb(48, 128, 128); font-family: Consolas; font-size: 10pt;">&gt;&gt=
;</span><span style=3D"color: rgb(0, 0, 32); font-family: Consolas; font-si=
ze: 10pt;">A</span><span style=3D"color: rgb(48, 128, 128); font-family: Co=
nsolas; font-size: 10pt;">(</span><span style=3D"color: rgb(0, 0, 32); font=
-family: Consolas; font-size: 10pt;">A</span><span style=3D"color: rgb(48, =
128, 128); font-family: Consolas; font-size: 10pt;">&amp;</span><span style=
=3D"color: rgb(0, 0, 32); font-family: Consolas; font-size: 10pt;"> x</span=
><span style=3D"color: rgb(48, 128, 128); font-family: Consolas; font-size:=
 10pt;">)</span><span style=3D"color: rgb(0, 0, 32); font-family: Consolas;=
 font-size: 10pt;"> </span><span style=3D"color: rgb(64, 96, 128); font-fam=
ily: Consolas; font-size: 10pt;">:</span><span style=3D"color: rgb(0, 0, 32=
); font-family: Consolas; font-size: 10pt;"> </span><span style=3D"color: r=
gb(48, 128, 128); font-family: Consolas; font-size: 10pt;">&gt;&gt;</span><=
span style=3D"color: rgb(0, 0, 32); font-family: Consolas; font-size: 10pt;=
">B</span><span style=3D"color: rgb(48, 128, 128); font-family: Consolas; f=
ont-size: 10pt;">(</span><span style=3D"color: rgb(0, 0, 32); font-family: =
Consolas; font-size: 10pt;">x</span><span style=3D"color: rgb(48, 128, 128)=
; font-family: Consolas; font-size: 10pt;">)</span><span style=3D"color: rg=
b(64, 96, 128); font-family: Consolas; font-size: 10pt;">,</span><span styl=
e=3D"color: rgb(0, 0, 32); font-family: Consolas; font-size: 10pt;"> </span=
><span style=3D"color: rgb(48, 128, 128); font-family: Consolas; font-size:=
 10pt;">&gt;&gt;</span><span style=3D"color: rgb(0, 0, 32); font-family: Co=
nsolas; font-size: 10pt;">c</span><span style=3D"color: rgb(48, 128, 128); =
font-family: Consolas; font-size: 10pt;">(</span><span style=3D"color: rgb(=
0, 0, 32); font-family: Consolas; font-size: 10pt;">x</span><span style=3D"=
color: rgb(48, 128, 128); font-family: Consolas; font-size: 10pt;">.</span>=
<span style=3D"color: rgb(0, 0, 32); font-family: Consolas; font-size: 10pt=
;">c</span><span style=3D"color: rgb(48, 128, 128); font-family: Consolas; =
font-size: 10pt;">)</span><span style=3D"color: rgb(64, 96, 128); font-fami=
ly: Consolas; font-size: 10pt;">, </span><span style=3D"color: rgb(48, 128,=
 128); font-family: Consolas; font-size: 10pt;">&gt;&gt;</span><span style=
=3D"color: rgb(0, 0, 32); font-family: Consolas; font-size: 10pt;">i</span>=
<span style=3D"color: rgb(48, 128, 128); font-family: Consolas; font-size: =
10pt;">(</span><span style=3D"color: rgb(0, 0, 32); font-family: Consolas; =
font-size: 10pt;">x</span><span style=3D"color: rgb(48, 128, 128); font-fam=
ily: Consolas; font-size: 10pt;">.</span><span style=3D"color: rgb(0, 0, 32=
); font-family: Consolas; font-size: 10pt;">i</span><span style=3D"color: r=
gb(48, 128, 128); font-family: Consolas; font-size: 10pt;">)</span></p><fon=
t color=3D"#000000" face=3D"Times New Roman" size=3D"3">

</font><p style=3D"background: rgb(246, 248, 255); margin: 0in 0in 0pt; lin=
e-height: normal;"><span style=3D"color: rgb(0, 0, 32); font-family: Consol=
as; font-size: 10pt;"><span>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 </span></span><s=
pan style=3D"color: rgb(64, 96, 128); font-family: Consolas; font-size: 10p=
t;">{
</span><span style=3D"color: rgb(0, 0, 32); font-family: Consolas; font-siz=
e: 10pt;">a </span><span style=3D"color: rgb(48, 128, 128); font-family: Co=
nsolas; font-size: 10pt;">=3D</span><span style=3D"color: rgb(0, 0, 32); fo=
nt-family: Consolas; font-size: 10pt;"> </span><b><span style=3D"color: rgb=
(32, 0, 128); font-family: Consolas; font-size: 10pt;">this</span></b><span=
 style=3D"color: rgb(64, 96, 128); font-family: Consolas; font-size: 10pt;"=
>; }</span></p><font color=3D"#000000" face=3D"Times New Roman" size=3D"3">

</font></div><div><br></div><div>However, one might definitely argue that s=
ituations where you want to mem-initialize a base or a member, but with a n=
on-corresponding member,=C2=A0are practically nonexistent. So, we may in fa=
ct=C2=A0prefer the following:</div><div><br></div><div><font color=3D"#0000=
00" face=3D"Times New Roman" size=3D"3">

</font><p style=3D"background: rgb(246, 248, 255); margin: 0in 0in 0pt; lin=
e-height: normal;"><span style=3D"color: rgb(0, 0, 32); font-family: Consol=
as; font-size: 10pt;"><span>=C2=A0=C2=A0=C2=A0 </span></span><span style=3D=
"color: rgb(48, 128, 128); font-family: Consolas; font-size: 10pt;">&gt;&gt=
;</span><span style=3D"color: rgb(0, 0, 32); font-family: Consolas; font-si=
ze: 10pt;">A</span><span style=3D"color: rgb(48, 128, 128); font-family: Co=
nsolas; font-size: 10pt;">(</span><span style=3D"color: rgb(0, 0, 32); font=
-family: Consolas; font-size: 10pt;">A</span><span style=3D"color: rgb(48, =
128, 128); font-family: Consolas; font-size: 10pt;">&amp;</span><span style=
=3D"color: rgb(0, 0, 32); font-family: Consolas; font-size: 10pt;"> x</span=
><span style=3D"color: rgb(48, 128, 128); font-family: Consolas; font-size:=
 10pt;">)</span><span style=3D"color: rgb(0, 0, 32); font-family: Consolas;=
 font-size: 10pt;"> </span><span style=3D"color: rgb(64, 96, 128); font-fam=
ily: Consolas; font-size: 10pt;">:</span><span style=3D"color: rgb(0, 0, 32=
); font-family: Consolas; font-size: 10pt;"> </span><span style=3D"color: r=
gb(48, 128, 128); font-family: Consolas; font-size: 10pt;">&gt;&gt;</span><=
span style=3D"color: rgb(0, 0, 32); font-family: Consolas; font-size: 10pt;=
">B</span><span style=3D"color: rgb(64, 96, 128); font-family: Consolas; fo=
nt-size: 10pt;">,</span><span style=3D"color: rgb(0, 0, 32); font-family: C=
onsolas; font-size: 10pt;"> </span><span style=3D"color: rgb(48, 128, 128);=
 font-family: Consolas; font-size: 10pt;">&gt;&gt;</span><span style=3D"col=
or: rgb(0, 0, 32); font-family: Consolas; font-size: 10pt;">c</span><span s=
tyle=3D"color: rgb(64, 96, 128); font-family: Consolas; font-size: 10pt;">,=
 </span><span style=3D"color: rgb(48, 128, 128); font-family: Consolas; fon=
t-size: 10pt;">&gt;&gt;</span><span style=3D"color: rgb(0, 0, 32); font-fam=
ily: Consolas; font-size: 10pt;">i</span></p><font color=3D"#000000" face=
=3D"Times New Roman" size=3D"3">

</font><p style=3D"background: rgb(246, 248, 255); margin: 0in 0in 0pt; lin=
e-height: normal;"><span style=3D"color: rgb(0, 0, 32); font-family: Consol=
as; font-size: 10pt;"><span>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 </span></span><s=
pan style=3D"color: rgb(64, 96, 128); font-family: Consolas; font-size: 10p=
t;">{
</span><span style=3D"color: rgb(0, 0, 32); font-family: Consolas; font-siz=
e: 10pt;">a </span><span style=3D"color: rgb(48, 128, 128); font-family: Co=
nsolas; font-size: 10pt;">=3D</span><span style=3D"color: rgb(0, 0, 32); fo=
nt-family: Consolas; font-size: 10pt;"> </span><b><span style=3D"color: rgb=
(32, 0, 128); font-family: Consolas; font-size: 10pt;">this</span></b><span=
 style=3D"color: rgb(64, 96, 128); font-family: Consolas; font-size: 10pt;"=
>; }</span></p><font color=3D"#000000" face=3D"Times New Roman" size=3D"3">

</font></div><div><br></div><div>The relocate_wrapper you suggest I think l=
ooks neat, and should be legal. I don&#39;t see a reason why it wouldn&#39;=
t be legal, if the mem-initializer-list is not implicit.</div><div><br></di=
v><div>It seems to me,=C2=A0intuitively,=C2=A0that there&#39;s no reason to=
 make it illegal to access any data member of the moved-from subobject unti=
l the outermost relocator exits.</div><div><br></div><div>I see no obvious =
reason why virtual methods shouldn&#39;t continue to work, as well. But thi=
s is not to say, of course, that one should call them.</div><div><br></div>=
<div>In general, anything that&#39;s const ought to be safe to call. Which =
is an argument in favor of making the signature &gt;&gt;T(T const&amp;) -=
=C2=A0except that would prevent zeroing out of members.</div><div><br></div=
><div><br>On Monday, August 10, 2015 at 2:20:28 PM UTC-6, Edward Catmur wro=
te:</div><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"><div>A few queries:<=
/div><div><br></div><div>What exactly are the semantics of the mem-initiali=
zer-list, particularly with regard to omitted, duplicated or misplaced base=
s/members:<br></div><div><br></div><div style=3D"border: 1px solid rgb(187,=
 187, 187); border-image: none; background-color: rgb(250, 250, 250);"><cod=
e><div><span style=3D"color: rgb(0, 0, 136);">struct</span><span style=3D"c=
olor: rgb(0, 0, 0);"> A </span><span style=3D"color: rgb(102, 102, 0);">{</=
span><span style=3D"color: rgb(0, 0, 0);"><br>=C2=A0 =C2=A0 std</span><span=
 style=3D"color: rgb(102, 102, 0);">::</span><span style=3D"color: rgb(0, 0=
, 136);">string</span><span style=3D"color: rgb(0, 0, 0);"> q</span><span s=
tyle=3D"color: rgb(102, 102, 0);">,</span><span style=3D"color: rgb(0, 0, 0=
);"> r</span><span style=3D"color: rgb(102, 102, 0);">,</span><span style=
=3D"color: rgb(0, 0, 0);"> s</span><span style=3D"color: rgb(102, 102, 0);"=
>;</span><span style=3D"color: rgb(0, 0, 0);"><br>=C2=A0 =C2=A0 </span><spa=
n style=3D"color: rgb(102, 102, 0);">&gt;&gt;</span><span style=3D"color: r=
gb(0, 0, 0);">A</span><span style=3D"color: rgb(102, 102, 0);">(</span><spa=
n style=3D"color: rgb(0, 0, 0);">A</span><span style=3D"color: rgb(102, 102=
, 0);">&amp;</span><span style=3D"color: rgb(0, 0, 0);"> x</span><span styl=
e=3D"color: rgb(102, 102, 0);">)</span><span style=3D"color: rgb(0, 0, 0);"=
> </span><span style=3D"color: rgb(102, 102, 0);">:</span><span style=3D"co=
lor: rgb(0, 0, 0);"> </span><span style=3D"color: rgb(102, 102, 0);">&gt;&g=
t;</span><span style=3D"color: rgb(0, 0, 0);">r</span><span style=3D"color:=
 rgb(102, 102, 0);">(</span><span style=3D"color: rgb(0, 0, 0);">x</span><s=
pan style=3D"color: rgb(102, 102, 0);">.</span><span style=3D"color: rgb(0,=
 0, 0);">r</span><span style=3D"color: rgb(102, 102, 0);">),</span><span st=
yle=3D"color: rgb(0, 0, 0);"> </span><span style=3D"color: rgb(102, 102, 0)=
;">&gt;&gt;</span><span style=3D"color: rgb(0, 0, 0);">s</span><span style=
=3D"color: rgb(102, 102, 0);">(</span><span style=3D"color: rgb(0, 0, 0);">=
x</span><span style=3D"color: rgb(102, 102, 0);">.</span><span style=3D"col=
or: rgb(0, 0, 0);">r</span><span style=3D"color: rgb(102, 102, 0);">)</span=
><span style=3D"color: rgb(0, 0, 0);"> </span><span style=3D"color: rgb(102=
, 102, 0);">{</span><span style=3D"color: rgb(0, 0, 0);"> </span><span styl=
e=3D"color: rgb(136, 0, 0);">/* oops */</span><span style=3D"color: rgb(0, =
0, 0);"> </span><span style=3D"color: rgb(102, 102, 0);">}</span><span styl=
e=3D"color: rgb(0, 0, 0);"><br></span><span style=3D"color: rgb(102, 102, 0=
);">};</span><span style=3D"color: rgb(0, 0, 0);"><br></span></div></code><=
/div><div><br></div><div>Is it ever legitimate for a mem-initializer to be =
omitted or to take any form other than <font face=3D"courier new, monospace=
">&gt;&gt;id(<a onmousedown=3D"this.href=3D&#39;http://www.google.com/url?q=
\75http%3A%2F%2Fx.id\46sa\75D\46sntz\0751\46usg\75AFQjCNG_YifSOWB69ZOU5okYo=
Dl3uhnQkQ&#39;;return true;" onclick=3D"this.href=3D&#39;http://www.google.=
com/url?q\75http%3A%2F%2Fx.id\46sa\75D\46sntz\0751\46usg\75AFQjCNG_YifSOWB6=
9ZOU5okYoDl3uhnQkQ&#39;;return true;" href=3D"http://x.id" target=3D"_blank=
" rel=3D"nofollow">x.id</a>)</font> where the two identifiers are equivalen=
t? If so, whose responsibility is it to call the destructor on the correspo=
nding member of the source object? If not, would it be better to omit the m=
em-initializer-list entirely, as with destructors?</div><div><br></div><div=
>Within the body of the relocator special member function, what are the lif=
etime statuses of the source and destination objects, particularly with reg=
ard to [class.cdtor]? Is it permissible to form lvalues to the bases and me=
mbers of the source object, or is this undefined behavior as they are destr=
ucted? If the type is polymorphic, is it permissible to dynamic_cast or inv=
oke virtual functions on the source? Indeed, is it permissible to invoke an=
y member functions on the source?</div><div><br></div><div>In particular, I=
&#39;d like to make this utility class legal (noting that aligned_storage_t=
 is a POD but my utility class is not):</div><div><br></div><div><div style=
=3D"border: 1px solid rgb(187, 187, 187); border-image: none; background-co=
lor: rgb(250, 250, 250);"><code><div><span style=3D"color: rgb(0, 0, 136);"=
>template</span><span style=3D"color: rgb(102, 102, 0);">&lt;</span><span s=
tyle=3D"color: rgb(0, 0, 136);">class</span><span style=3D"color: rgb(0, 0,=
 0);"> T</span><span style=3D"color: rgb(102, 102, 0);">&gt;</span><span st=
yle=3D"color: rgb(0, 0, 0);"><br></span><span style=3D"color: rgb(0, 0, 136=
);">struct</span><span style=3D"color: rgb(0, 0, 0);"> relocate_wrapper </s=
pan><span style=3D"color: rgb(102, 102, 0);">{</span><span style=3D"color: =
rgb(0, 0, 0);"><br>=C2=A0 </span><span style=3D"color: rgb(0, 0, 136);">tem=
plate</span><span style=3D"color: rgb(102, 102, 0);">&lt;</span><span style=
=3D"color: rgb(0, 0, 136);">class</span><span style=3D"color: rgb(102, 102,=
 0);">...</span><span style=3D"color: rgb(0, 0, 0);"> </span><span style=3D=
"color: rgb(102, 0, 102);">Args</span><span style=3D"color: rgb(102, 102, 0=
);">&gt;</span><span style=3D"color: rgb(0, 0, 0);"> relocate_wrapper</span=
><span style=3D"color: rgb(102, 102, 0);">(</span><span style=3D"color: rgb=
(102, 0, 102);">Args</span><span style=3D"color: rgb(102, 102, 0);">&amp;&a=
mp;...</span><span style=3D"color: rgb(0, 0, 0);"> args</span><span style=
=3D"color: rgb(102, 102, 0);">)</span><span style=3D"color: rgb(0, 0, 0);">=
 </span><span style=3D"color: rgb(102, 102, 0);">{</span><span style=3D"col=
or: rgb(0, 0, 0);"><br>=C2=A0 =C2=A0 </span><span style=3D"color: rgb(0, 0,=
 136);">new</span><span style=3D"color: rgb(0, 0, 0);"> </span><span style=
=3D"color: rgb(102, 102, 0);">(&amp;</span><span style=3D"color: rgb(0, 0, =
0);">buf</span><span style=3D"color: rgb(102, 102, 0);">)</span><span style=
=3D"color: rgb(0, 0, 0);"> T</span><span style=3D"color: rgb(102, 102, 0);"=
>(</span><span style=3D"color: rgb(0, 0, 0);">std</span><span style=3D"colo=
r: rgb(102, 102, 0);">::</span><span style=3D"color: rgb(0, 0, 0);">forward=
</span><span style=3D"color: rgb(102, 102, 0);">&lt;</span><span style=3D"c=
olor: rgb(102, 0, 102);">Args</span><span style=3D"color: rgb(102, 102, 0);=
">&gt;(</span><span style=3D"color: rgb(0, 0, 0);">args</span><span style=
=3D"color: rgb(102, 102, 0);">)...)<wbr>;</span><span style=3D"color: rgb(0=
, 0, 0);"><br>=C2=A0 </span><span style=3D"color: rgb(102, 102, 0);">}</spa=
n><span style=3D"color: rgb(0, 0, 0);"><br>=C2=A0 </span><span style=3D"col=
or: rgb(102, 102, 0);">~</span><span style=3D"color: rgb(0, 0, 0);">relocat=
e_wrapper</span><span style=3D"color: rgb(102, 102, 0);">()</span><span sty=
le=3D"color: rgb(0, 0, 0);"> </span><span style=3D"color: rgb(102, 102, 0);=
">{</span><span style=3D"color: rgb(0, 0, 0);"> </span><span style=3D"color=
: rgb(0, 0, 136);">reinterpret_cast</span><span style=3D"color: rgb(102, 10=
2, 0);">&lt;</span><span style=3D"color: rgb(0, 0, 0);">T</span><span style=
=3D"color: rgb(102, 102, 0);">&amp;&gt;(</span><span style=3D"color: rgb(0,=
 0, 0);">buf</span><span style=3D"color: rgb(102, 102, 0);">).~</span><span=
 style=3D"color: rgb(0, 0, 0);">T</span><span style=3D"color: rgb(102, 102,=
 0);">()<wbr>;</span><span style=3D"color: rgb(0, 0, 0);"> </span><span sty=
le=3D"color: rgb(102, 102, 0);">}</span><span style=3D"color: rgb(0, 0, 0);=
"><br>=C2=A0 </span><span style=3D"color: rgb(102, 102, 0);">&gt;&gt;</span=
><span style=3D"color: rgb(0, 0, 0);">relocate_wrapper</span><span style=3D=
"color: rgb(102, 102, 0);">(</span><span style=3D"color: rgb(0, 0, 0);">rel=
ocate_<wbr>wrapper</span><span style=3D"color: rgb(102, 102, 0);">&amp;</sp=
an><span style=3D"color: rgb(0, 0, 0);"> rhs</span><span style=3D"color: rg=
b(102, 102, 0);">)</span><span style=3D"color: rgb(0, 0, 0);"> </span><span=
 style=3D"color: rgb(102, 102, 0);">{</span><span style=3D"color: rgb(0, 0,=
 0);"><br>=C2=A0 =C2=A0 </span><span style=3D"color: rgb(0, 0, 136);">new</=
span><span style=3D"color: rgb(0, 0, 0);"> </span><span style=3D"color: rgb=
(102, 102, 0);">(&amp;</span><span style=3D"color: rgb(0, 0, 0);">buf</span=
><span style=3D"color: rgb(102, 102, 0);">)</span><span style=3D"color: rgb=
(0, 0, 0);"> T</span><span style=3D"color: rgb(102, 102, 0);">(</span><span=
 style=3D"color: rgb(0, 0, 136);">reinterpret_cast</span><span style=3D"col=
or: rgb(102, 102, 0);">&lt;</span><span style=3D"color: rgb(0, 0, 0);">T</s=
pan><span style=3D"color: rgb(102, 102, 0);">&amp;&amp;&gt;(</span><span st=
yle=3D"color: rgb(0, 0, 0);">rhs</span><span style=3D"color: rgb(102, 102, =
0);">.</span><span style=3D"color: rgb(0, 0, 0);">bu<wbr>f</span><span styl=
e=3D"color: rgb(102, 102, 0);">));</span><span style=3D"color: rgb(0, 0, 0)=
;"><br>=C2=A0 =C2=A0 </span><span style=3D"color: rgb(0, 0, 136);">reinterp=
ret_cast</span><span style=3D"color: rgb(102, 102, 0);">&lt;</span><span st=
yle=3D"color: rgb(0, 0, 0);">T</span><span style=3D"color: rgb(102, 102, 0)=
;">&amp;&gt;(</span><span style=3D"color: rgb(0, 0, 0);">rhs</span><span st=
yle=3D"color: rgb(102, 102, 0);">.</span><span style=3D"color: rgb(0, 0, 0)=
;">buf</span><span style=3D"color: rgb(102, 102, 0);">).<wbr>~</span><span =
style=3D"color: rgb(0, 0, 0);">T</span><span style=3D"color: rgb(102, 102, =
0);">();</span><span style=3D"color: rgb(0, 0, 0);"><br>=C2=A0 </span><span=
 style=3D"color: rgb(102, 102, 0);">}</span><span style=3D"color: rgb(0, 0,=
 0);"><br>=C2=A0 std</span><span style=3D"color: rgb(102, 102, 0);">::</spa=
n><span style=3D"color: rgb(0, 0, 0);">aligned_storage_t</span><span style=
=3D"color: rgb(102, 102, 0);">&lt;</span><span style=3D"color: rgb(0, 0, 13=
6);">sizeof</span><span style=3D"color: rgb(102, 102, 0);">(</span><span st=
yle=3D"color: rgb(0, 0, 0);"><wbr>T</span><span style=3D"color: rgb(102, 10=
2, 0);">),</span><span style=3D"color: rgb(0, 0, 0);"> </span><span style=
=3D"color: rgb(0, 0, 136);">alignof</span><span style=3D"color: rgb(102, 10=
2, 0);">(</span><span style=3D"color: rgb(0, 0, 0);">T</span><span style=3D=
"color: rgb(102, 102, 0);">)&gt;</span><span style=3D"color: rgb(0, 0, 0);"=
> buf</span><span style=3D"color: rgb(102, 102, 0);">;</span><span style=3D=
"color: rgb(0, 0, 0);"><br></span><span style=3D"color: rgb(102, 102, 0);">=
};</span></div></code></div><div><br></div></div><div>Hm... it might be nic=
e to ensure that the relocator doesn&#39;t do any unnecessary work copying =
the buffer that&#39;s just going to be placement new moved into. Is that an=
 argument against an implicit mem-initializer-list?</div></div></blockquote=
></div></blockquote></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_5154_539478872.1439245021586--
------=_Part_5153_517007116.1439245021585--

.
