220 19758 <f9b91a13-f5ce-452b-9f4b-a43c7522d75e@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 14:59:07 -0700 (PDT)
Lines: 440
Approved: news@gmane.org
Message-ID: <f9b91a13-f5ce-452b-9f4b-a43c7522d75e@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>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_866_2035194516.1439243947633"
X-Trace: ger.gmane.org 1439243956 25229 80.91.229.3 (10 Aug 2015 21:59:16 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Mon, 10 Aug 2015 21:59:16 +0000 (UTC)
Cc: isocppgroup@denisbider.com
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBD5LNK7YQYJRBLN5USXAKGQEUI2KNQQ@isocpp.org Mon Aug 10 23:59:12 2015
Return-path: <std-proposals+bncBD5LNK7YQYJRBLN5USXAKGQEUI2KNQQ@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-pd0-f199.google.com ([209.85.192.199])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBD5LNK7YQYJRBLN5USXAKGQEUI2KNQQ@isocpp.org>)
	id 1ZOv67-0008DH-9l
	for gclcip-std-proposals@m.gmane.org; Mon, 10 Aug 2015 23:59:11 +0200
Original-Received: by pdrn6 with SMTP id n6sf43719050pdr.1
        for <gclcip-std-proposals@m.gmane.org>; Mon, 10 Aug 2015 14:59:10 -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=1qcGumcoFI/QC2AYXNVYCT9yomLlOLeeM7SKDk8xM6M=;
        b=XbynfNv9ltd83mK0WnlNSAEsxNOA+Ty/f4sFWygvKb3wvsPaguss/mC5BWzNoqNBLo
         OxZ3/hLYMZyIplEEjuyyQFTYzdHP3blVoGdYi3gcrY/Q3jg5xtQiZ7sv8R3mjTDtjYsZ
         vEba1DupyVh4i23yOWDQ94ph0RIXzpZ0dsLPsXcn/0DndY1T/jgSFQbJAB7nn333TFKf
         OmJBsDonGtb0MHtE5x1kv6j90uZIPVhUETHHI7H/jkESkOBIef9taDhIVQFHP+zBu1CW
         vcG+orJ0Qj9IRsNO82MTL4hGpc60DySQ8JWPpo6lfpBlpJjc9L/lEXKajWHCbfRQXaHM
         0BOA==
X-Gm-Message-State: ALoCoQluscn7nnu/TuD8VcmUl6+s3d3A2Y/UcSy4C0LF6fh00KSfZgyOD5skwdAu309qqxb3Nowp
X-Received: by 10.66.185.195 with SMTP id fe3mr20996325pac.13.1439243950233;
        Mon, 10 Aug 2015 14:59:10 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.140.81.115 with SMTP id e106ls3322839qgd.4.gmail; Mon, 10 Aug
 2015 14:59:08 -0700 (PDT)
X-Received: by 10.140.93.38 with SMTP id c35mr218341qge.38.1439243948803;
        Mon, 10 Aug 2015 14:59:08 -0700 (PDT)
In-Reply-To: <c52673f9-dda3-453d-9adb-c912a3348405@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:19758
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/19758>

------=_Part_866_2035194516.1439243947633
Content-Type: multipart/alternative; 
	boundary="----=_Part_867_988721069.1439243947634"

------=_Part_867_988721069.1439243947634
Content-Type: text/plain; charset=UTF-8

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_867_988721069.1439243947634
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<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><div><br></div><div><font color=3D"#00=
0000" 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;;"><span style=
=3D"mso-spacerun: yes;">=C2=A0=C2=A0=C2=A0 </span></span><span style=3D"col=
or: rgb(48, 128, 128); font-family: Consolas; font-size: 10pt; mso-fareast-=
font-family: &quot;Times New Roman&quot;;">&gt;&gt;</span><span style=3D"co=
lor: rgb(0, 0, 32); font-family: Consolas; font-size: 10pt; mso-fareast-fon=
t-family: &quot;Times New Roman&quot;;">A</span><span style=3D"color: rgb(4=
8, 128, 128); font-family: Consolas; font-size: 10pt; mso-fareast-font-fami=
ly: &quot;Times New Roman&quot;;">(</span><span style=3D"color: rgb(0, 0, 3=
2); 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); fo=
nt-family: Consolas; font-size: 10pt; mso-fareast-font-family: &quot;Times =
New Roman&quot;;">&amp;</span><span style=3D"color: rgb(0, 0, 32); font-fam=
ily: Consolas; font-size: 10pt; mso-fareast-font-family: &quot;Times New Ro=
man&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&q=
uot;;">)</span><span style=3D"color: rgb(0, 0, 32); font-family: Consolas; =
font-size: 10pt; mso-fareast-font-family: &quot;Times New Roman&quot;;"> </=
span><span style=3D"color: rgb(64, 96, 128); font-family: Consolas; font-si=
ze: 10pt; mso-fareast-font-family: &quot;Times New Roman&quot;;">:</span><s=
pan style=3D"color: rgb(0, 0, 32); font-family: Consolas; font-size: 10pt; =
mso-fareast-font-family: &quot;Times New Roman&quot;;"> </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;;">&gt;&gt;</span><span styl=
e=3D"color: rgb(0, 0, 32); font-family: Consolas; font-size: 10pt; mso-fare=
ast-font-family: &quot;Times New Roman&quot;;">B</span><span style=3D"color=
: rgb(48, 128, 128); font-family: Consolas; font-size: 10pt; mso-fareast-fo=
nt-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, 1=
28); font-family: Consolas; font-size: 10pt; mso-fareast-font-family: &quot=
;Times New Roman&quot;;">)</span><span style=3D"color: rgb(64, 96, 128); fo=
nt-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;;"> </span><span style=3D"color: rgb(48, 128, 128); font-family: Conso=
las; font-size: 10pt; mso-fareast-font-family: &quot;Times New Roman&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;;">c=
</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: 10p=
t; mso-fareast-font-family: &quot;Times New Roman&quot;;">x</span><span sty=
le=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-f=
ont-family: &quot;Times New Roman&quot;;">c</span><span style=3D"color: rgb=
(48, 128, 128); 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(48, 128, 12=
8); font-family: Consolas; font-size: 10pt; mso-fareast-font-family: &quot;=
Times New Roman&quot;;">&gt;&gt;</span><span style=3D"color: rgb(0, 0, 32);=
 font-family: Consolas; font-size: 10pt; mso-fareast-font-family: &quot;Tim=
es New Roman&quot;;">i</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: Co=
nsolas; font-size: 10pt; mso-fareast-font-family: &quot;Times New Roman&quo=
t;;">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-siz=
e: 10pt; mso-fareast-font-family: &quot;Times New Roman&quot;;">i</span><sp=
an style=3D"color: rgb(48, 128, 128); font-family: Consolas; font-size: 10p=
t; 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;;"><span style=
=3D"mso-spacerun: yes;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 </span></span><span =
style=3D"color: rgb(64, 96, 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-siz=
e: 10pt; mso-fareast-font-family: &quot;Times New Roman&quot;;">a </span><s=
pan style=3D"color: rgb(48, 128, 128); font-family: Consolas; font-size: 10=
pt; 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&quot;;"> </span><b><span style=
=3D"color: rgb(32, 0, 128); font-family: Consolas; font-size: 10pt; mso-far=
east-font-family: &quot;Times New Roman&quot;;">this</span></b><span style=
=3D"color: rgb(64, 96, 128); font-family: Consolas; font-size: 10pt; mso-fa=
reast-font-family: &quot;Times New Roman&quot;;">; }</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; 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;;"><span style=
=3D"mso-spacerun: yes;">=C2=A0=C2=A0=C2=A0 </span></span><span style=3D"col=
or: rgb(48, 128, 128); font-family: Consolas; font-size: 10pt; mso-fareast-=
font-family: &quot;Times New Roman&quot;;">&gt;&gt;</span><span style=3D"co=
lor: rgb(0, 0, 32); font-family: Consolas; font-size: 10pt; mso-fareast-fon=
t-family: &quot;Times New Roman&quot;;">A</span><span style=3D"color: rgb(4=
8, 128, 128); font-family: Consolas; font-size: 10pt; mso-fareast-font-fami=
ly: &quot;Times New Roman&quot;;">(</span><span style=3D"color: rgb(0, 0, 3=
2); 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); fo=
nt-family: Consolas; font-size: 10pt; mso-fareast-font-family: &quot;Times =
New Roman&quot;;">&amp;</span><span style=3D"color: rgb(0, 0, 32); font-fam=
ily: Consolas; font-size: 10pt; mso-fareast-font-family: &quot;Times New Ro=
man&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&q=
uot;;">)</span><span style=3D"color: rgb(0, 0, 32); font-family: Consolas; =
font-size: 10pt; mso-fareast-font-family: &quot;Times New Roman&quot;;"> </=
span><span style=3D"color: rgb(64, 96, 128); font-family: Consolas; font-si=
ze: 10pt; mso-fareast-font-family: &quot;Times New Roman&quot;;">:</span><s=
pan style=3D"color: rgb(0, 0, 32); font-family: Consolas; font-size: 10pt; =
mso-fareast-font-family: &quot;Times New Roman&quot;;"> </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;;">&gt;&gt;</span><span styl=
e=3D"color: rgb(0, 0, 32); font-family: Consolas; font-size: 10pt; mso-fare=
ast-font-family: &quot;Times New Roman&quot;;">B</span><span style=3D"color=
: rgb(64, 96, 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;;"> </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;;">&gt;&gt;</span><span style=3D"color: rgb(0, 0, 32);=
 font-family: Consolas; font-size: 10pt; mso-fareast-font-family: &quot;Tim=
es New Roman&quot;;">c</span><span style=3D"color: rgb(64, 96, 128); font-f=
amily: Consolas; font-size: 10pt; mso-fareast-font-family: &quot;Times New =
Roman&quot;;">, </span><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;</span><span style=3D"color: rgb(0, 0, 32); font-family: C=
onsolas; font-size: 10pt; mso-fareast-font-family: &quot;Times New Roman&qu=
ot;;">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; 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;;"><span style=
=3D"mso-spacerun: yes;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 </span></span><span =
style=3D"color: rgb(64, 96, 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-siz=
e: 10pt; mso-fareast-font-family: &quot;Times New Roman&quot;;">a </span><s=
pan style=3D"color: rgb(48, 128, 128); font-family: Consolas; font-size: 10=
pt; 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&quot;;"> </span><b><span style=
=3D"color: rgb(32, 0, 128); font-family: Consolas; font-size: 10pt; mso-far=
east-font-family: &quot;Times New Roman&quot;;">this</span></b><span style=
=3D"color: rgb(64, 96, 128); font-family: Consolas; font-size: 10pt; mso-fa=
reast-font-family: &quot;Times New Roman&quot;;">; }</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; -ms-word-wrap: break-word; background-color=
: rgb(250, 250, 250);"><code><div><span style=3D"color: rgb(0, 0, 136);">st=
ruct</span><span style=3D"color: rgb(0, 0, 0);"> A </span><span style=3D"co=
lor: 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: rg=
b(0, 0, 0);"> q</span><span style=3D"color: rgb(102, 102, 0);">,</span><spa=
n style=3D"color: rgb(0, 0, 0);"> r</span><span style=3D"color: rgb(102, 10=
2, 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><span style=3D"color: rgb(102, 102, 0);">&gt;&gt;<=
/span><span style=3D"color: rgb(0, 0, 0);">A</span><span style=3D"color: rg=
b(102, 102, 0);">(</span><span 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 style=3D"color: rgb(102, 102, 0);">)</span><span s=
tyle=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"col=
or: rgb(102, 102, 0);">&gt;&gt;</span><span style=3D"color: rgb(0, 0, 0);">=
r</span><span style=3D"color: rgb(102, 102, 0);">(</span><span style=3D"col=
or: rgb(0, 0, 0);">x</span><span 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 style=3D"color: rgb(0, 0, 0);"> </span><span sty=
le=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 sty=
le=3D"color: rgb(0, 0, 0);">x</span><span 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 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 style=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 style=3D"color: rgb(0, 0, 0);"><br></span><span sty=
le=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 fa=
ce=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_YifSOWB69ZOU5okYoDl3uhnQkQ&#39;;return true;" onclick=3D"this.hr=
ef=3D&#39;http://www.google.com/url?q\75http%3A%2F%2Fx.id\46sa\75D\46sntz\0=
751\46usg\75AFQjCNG_YifSOWB69ZOU5okYoDl3uhnQkQ&#39;;return true;" href=3D"h=
ttp://x.id" target=3D"_blank" rel=3D"nofollow">x.id</a>)</font> where the t=
wo identifiers are equivalent? If so, whose responsibility is it to call th=
e destructor on the corresponding member of the source object? If not, woul=
d it be better to omit the mem-initializer-list entirely, as with destructo=
rs?</div><div><br></div><div>Within the body of the relocator special membe=
r function, what are the lifetime statuses of the source and destination ob=
jects, particularly with regard to [class.cdtor]? Is it permissible to form=
 lvalues to the bases and members of the source object, or is this undefine=
d behavior as they are destructed? If the type is polymorphic, is it permis=
sible to dynamic_cast or invoke virtual functions on the source? Indeed, is=
 it permissible to invoke any member functions on the source?</div><div><br=
></div><div>In particular, I&#39;d like to make this utility class legal (n=
oting that aligned_storage_t is a POD but my utility class is not):</div><d=
iv><br></div><div><div style=3D"border: 1px solid rgb(187, 187, 187); borde=
r-image: none; -ms-word-wrap: break-word; background-color: rgb(250, 250, 2=
50);"><code><div><span style=3D"color: rgb(0, 0, 136);">template</span><spa=
n style=3D"color: rgb(102, 102, 0);">&lt;</span><span style=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 style=3D"color: rgb(0,=
 0, 0);"><br></span><span style=3D"color: rgb(0, 0, 136);">struct</span><sp=
an style=3D"color: rgb(0, 0, 0);"> relocate_wrapper </span><span style=3D"c=
olor: 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);">template</span><span s=
tyle=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><sp=
an 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><spa=
n style=3D"color: rgb(0, 0, 0);"> relocate_wrapper</span><span style=3D"col=
or: rgb(102, 102, 0);">(</span><span style=3D"color: rgb(102, 0, 102);">Arg=
s</span><span style=3D"color: rgb(102, 102, 0);">&amp;&amp;...</span><span =
style=3D"color: rgb(0, 0, 0);"> args</span><span style=3D"color: rgb(102, 1=
02, 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, 0);">std</span><span style=3D"color: 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"color: rgb(102, 0, =
102);">Args</span><span style=3D"color: rgb(102, 102, 0);">&gt;(</span><spa=
n 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);">}</span><span style=3D"col=
or: 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);">relocate_wrapper</span><spa=
n 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 styl=
e=3D"color: rgb(0, 0, 0);"> </span><span style=3D"color: rgb(0, 0, 136);">r=
einterpret_cast</span><span style=3D"color: rgb(102, 102, 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 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);">&gt;&gt;</span><span style=3D"colo=
r: rgb(0, 0, 0);">relocate_wrapper</span><span style=3D"color: rgb(102, 102=
, 0);">(</span><span style=3D"color: rgb(0, 0, 0);">relocate_<wbr>wrapper</=
span><span style=3D"color: rgb(102, 102, 0);">&amp;</span><span style=3D"co=
lor: rgb(0, 0, 0);"> rhs</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);"><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);">(&am=
p;</span><span style=3D"color: rgb(0, 0, 0);">buf</span><span style=3D"colo=
r: 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"color: rgb(102, 102, 0)=
;">&lt;</span><span style=3D"color: rgb(0, 0, 0);">T</span><span style=3D"c=
olor: rgb(102, 102, 0);">&amp;&amp;&gt;(</span><span style=3D"color: rgb(0,=
 0, 0);">rhs</span><span style=3D"color: rgb(102, 102, 0);">.</span><span s=
tyle=3D"color: rgb(0, 0, 0);">bu<wbr>f</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);">reinterpret_cast</span><span=
 style=3D"color: rgb(102, 102, 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);">rhs</span><span style=3D"color: rgb(10=
2, 102, 0);">.</span><span style=3D"color: rgb(0, 0, 0);">buf</span><span s=
tyle=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);">::</span><span style=3D"col=
or: rgb(0, 0, 0);">aligned_storage_t</span><span style=3D"color: rgb(102, 1=
02, 0);">&lt;</span><span style=3D"color: rgb(0, 0, 136);">sizeof</span><sp=
an style=3D"color: rgb(102, 102, 0);">(</span><span style=3D"color: rgb(0, =
0, 0);"><wbr>T</span><span style=3D"color: rgb(102, 102, 0);">),</span><spa=
n style=3D"color: rgb(0, 0, 0);"> </span><span style=3D"color: rgb(0, 0, 13=
6);">alignof</span><span style=3D"color: rgb(102, 102, 0);">(</span><span s=
tyle=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 nice to ensure that the re=
locator doesn&#39;t do any unnecessary work copying the buffer that&#39;s j=
ust going to be placement new moved into. Is that an argument against an im=
plicit mem-initializer-list?</div></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_867_988721069.1439243947634--
------=_Part_866_2035194516.1439243947633--

.
