220 19854 <6aa5db15-1c30-4374-85af-afdbce670c7c@isocpp.org> article
Path: news.gmane.org!not-for-mail
From: isocppgroup@denisbider.com
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Move destructor draft
Date: Thu, 13 Aug 2015 19:58:53 -0700 (PDT)
Lines: 511
Approved: news@gmane.org
Message-ID: <6aa5db15-1c30-4374-85af-afdbce670c7c@isocpp.org>
References: <0A99E209-333B-4140-8F65-2F022E681AC1@gmail.com>	<a23b1793-1012-46cf-b688-8e893e185b83@isocpp.org>	<EFDF8619-B85A-4C9C-84FC-974ACEBB8370@gmail.com>	<ac96d840-208a-472a-b0b6-712d0ad0d4cc@isocpp.org>	<CAFk2RUbrVj+3uHTSSYL8ipe=4Q=u1Lq47Pn7+aux6Rw-sNhzKQ@mail.gmail.com>	<A1D6E60D-8506-4E5A-A71A-A28B997E973B@gmail.com>	<55C0DDD4.8090100@halpernwightsoftware.com>	<411A67D7-B062-4D22-983A-095737483208@gmail.com>	<55C299B0.1060300@gmail.com>	<55C2ABA3.8060605@halpernwightsoftware.com>	<55C2ECDB.1060307@gmail.com> <CAD6_Qj-QuPRequYbFOL0SqrQSMDh73DbRr7TaqyOX42MZpYXTg@mail.gmail.com> <mpvuub$ekc$1@ger.gmane.org> <5de71605-7320-4130-938b-813304c51069@isocpp.org> <  mq2f45$k25$1@ger.gmane.org> <dc118bc8-2b00-4e23- b794-75779b15f463@isocpp.org> <mq2l4d$ub0$1@ger.gmane.org> <94331665-f7f3-444
 b-a1dc-333a52be7873@isocpp.org> <mq3857$fc8$1@ger.gmane.org> <a2630a2b-51b1-4678-8217-1185ad484f9d@isocpp.org> <mqd0f6$up8$1@ger.gmane.org> <80721d48-888b-4dc8-b938-28f2ca329f04@isocpp.org>
 <mqifkk$76m$1@ger.gmane.org>
 <d2f76deb-d883-412f-b787-c42b9ad98f7f@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_185_1486388530.1439521133556"
X-Trace: ger.gmane.org 1439521138 6240 80.91.229.3 (14 Aug 2015 02:58:58 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Fri, 14 Aug 2015 02:58:58 +0000 (UTC)
Cc: mwoehlke.floss@gmail.com, isocppgroup@denisbider.com
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBD5LNK7YQYJRB3VSWWXAKGQE6JYJFEY@isocpp.org Fri Aug 14 04:58:57 2015
Return-path: <std-proposals+bncBD5LNK7YQYJRB3VSWWXAKGQE6JYJFEY@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-oi0-f70.google.com ([209.85.218.70])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBD5LNK7YQYJRB3VSWWXAKGQE6JYJFEY@isocpp.org>)
	id 1ZQ5Cq-0007gl-BX
	for gclcip-std-proposals@m.gmane.org; Fri, 14 Aug 2015 04:58:56 +0200
Original-Received: by oio137 with SMTP id 137sf96790658oio.2
        for <gclcip-std-proposals@m.gmane.org>; Thu, 13 Aug 2015 19:58:55 -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=qEjCKQIFHrlRwzJvKAaWnUQu0iAjwOK+NFt7aj5y1/k=;
        b=mZm9teoEPvluAED4NgSqgCP+H8HCoEalOrN+AEYrz2ORHPF2oqb/FHdI/f9AZqKaIK
         90Q6ETs4pJFWeSdZSmnHTQNFNANlUtlX5J46gBMnbxr9Bhe3qW1lbnMzA4qxZ3fvD0Dn
         f1ZQ/SSJvhW0i6rKyAVLJRVBMXNo/GSPeZd7iAAzpb0z2IYsiJzBv5lGCO95y8D4ue90
         CEtp4uV2q8rmehvDFliXRtwHldn9Tj75n34Qrimnjud33XW2CpZkXzvzVTElPD8w8b/X
         KXxxy5GYgg30PP06UYKJKykZ4N8PtW0RRhNve96cI0EUqPrTAtjY2czuofP1gZZ/QnJH
         gOIw==
X-Gm-Message-State: ALoCoQm61WX41EKz91qHZJt5Mvbz74+cx0Rz7FUU202YMrrf+StEtrZUriey6AhD57tpx1oJr7iZ
X-Received: by 10.107.128.203 with SMTP id k72mr8754636ioi.26.1439521135337;
        Thu, 13 Aug 2015 19:58:55 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.140.93.9 with SMTP id c9ls506299qge.16.gmail; Thu, 13 Aug 2015
 19:58:54 -0700 (PDT)
X-Received: by 10.140.41.148 with SMTP id z20mr7027qgz.3.1439521134237;
        Thu, 13 Aug 2015 19:58:54 -0700 (PDT)
In-Reply-To: <d2f76deb-d883-412f-b787-c42b9ad98f7f@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:19854
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/19854>

------=_Part_185_1486388530.1439521133556
Content-Type: multipart/alternative; 
	boundary="----=_Part_186_1888314699.1439521133557"

------=_Part_186_1888314699.1439521133557
Content-Type: text/plain; charset=UTF-8

Ville informs me that someone needs to champion this proposal in front of 
the Evolution WG.

I reckon, if someone isn't found, the alternative is that it will be simply 
disregarded.

Is anyone going to the next WG meeting who is super passionate about 
efficient relocation, and wants to present this proposal?

If no one volunteers, I'll have to go to Hawaii, and you know how much I 
would hate that. :)

I believe such a volunteer should be sufficiently comfortable with the 
current state of the proposal as to be comfortable putting their name on 
it. Since this person would be presenting and defending the proposal in 
front of the EWG, I imagine they would be added to the proposal as 
co-author.


On Thursday, August 13, 2015 at 8:54:17 PM UTC-6, isocp...@denisbider.com 
wrote:

> Thanks for your reply!
>
> > Finally read it; sorry it took so long. 
>
> No worries at all.
>
> I have uploaded a new version again, based on this feedback:
>
> http://denisbider.com/Relocator.pdf
>
> - It now has a proper proposal number, P0023, currently R0.
>
> - It adds a single-object version of relocate_or_move, as suggested.
>
> - It switches around Annex 1 and Annex 2, so that relocate_or_move is in 
> Annex 1, reflecting it's more central.
>
> - Changed wording related to realloc_in_place, now in Annex 2, to make it 
> clearer that it's related to, but not essential to the proposal.
>
> - Added discussion headings "Why not a const reference?" and "Why not an 
> rvalue reference?"
>
>
>
> > I still wonder if the indirection for the relocation
> > operator shouldn't somehow indicate that the
> > parameter will be destroyed when the outermost 
> > relocation completes. (If not 'T~'/'T~&', I wonder
> > if it should at least be a 'T&&'? Not sure though...) 
>
> The problem with an rvalue reference is that you then have to consistently 
> do this:
>
>  
>
>   >>A(A&& x) : >>B(std::move(x)), >>c(std::move(x.c)) {}
>
>  
>
> I think this would be inconvenience for the sake of inconvenience alone. 
> Not much is gained, since an rvalue reference is not needed to e.g. resolve 
> an overload conflict.
>
> A new reference type is a whole new animal altogether and probably not 
> warranted as long as this would be the only usage case. There is no 
> technical problem we'd be solving with a new reference type, just a 
> subjective problem of indication.
>
> I would argue that indication is already handled sufficiently by the 
> syntax >>A, so that there's no need to handle it additionally via 
> reference type, also.
>
>
> > Might want to say, instead of "std::relocate,
> > defined as" with "might be defined as",
>
> Good point. I have changed that to "behaving as follows".
>
>
> > the relocator should also be deleted if any 
> > subobject *lacks* a relocator (i.e. "not declared").
>
> Good point. I have added this stipulation.
>
>
> > I'm not sure this is as tightly coupled to
> > realloc_in_place as is suggested.
>
> I agree, the championing of realloc_in_place was overdone. I have toned 
> it down to make it clear that the relocator proposal stands on its own, 
> without it. :-)
>
>
> > Where you run into problems is if the base
> > class relocator fiddles with memory that the 
> > derived class still needed. 
>
> True. However, I'd prefer for modification of the original object to be 
> defined behavior, and to let the user beware and not shoot themselves in 
> the foot; rather than to preclude access "for yer protection". :-)
>
>
> On Thursday, August 13, 2015 at 10:12:15 AM UTC-6, Matthew Woehlke wrote:
>
>> On 2015-08-11 15:45, isocp...@denisbider.com wrote: 
>> > Good points, thank you! 
>> > 
>> > I have uploaded a new version of the draft addressing the following: 
>>
>> Finally read it; sorry it took so long. 
>>
>> Thanks for the improved examples section! 
>>
>> I still wonder if the indirection for the relocation operator shouldn't 
>> somehow indicate that the parameter will be destroyed when the outermost 
>> relocation completes. (If not 'T~'/'T~&', I wonder if it should at least 
>> be a 'T&&'? Not sure though...) 
>>
>> > - proposed single object invocation is now similar to placement new 
>>
>> Cool :-). 
>>
>> > - there is now an Annex 2 defining a proposed std::relocate_or_move 
>>
>> Cool :-). 
>>
>> I wonder if there should also be single-object versions? 
>>
>> Nit: Might want to say, instead of "std::relocate, defined as" with 
>> "might be defined as", in case implementations need to insert some 
>> compiler voodoo to denote creation and deletion of objects in the 
>> memmove case. (Presumably, the relocation operator has this built in, 
>> but the trivial case isn't calling that...) Or, just if libraries come 
>> up with some better implementation. I don't think the actual definition 
>> needs to be codified, just the effect. 
>>
>> > - proposed implicit declaration rules have been relaxed, so that 
>> explicitly 
>> > defaulting a special member does not block implicit relocator 
>> declaration 
>>
>> Cool; thanks :-). 
>>
>> > - added explicit statement that lifetime of object in original location 
>> > ceases when outermost relocator completes 
>>
>> Cool :-). I think we needed this, and your wording LGTM. Thanks. 
>>
>> > - added explicit statement that invocation of subobject relocator 
>> outside 
>> > of outer object relocation is undefined behavior 
>>
>> Erk... yes, it had better be ;-). Good catch; thanks. 
>>
>>
>> Other comments: 
>>
>> I think this isn't exactly an omission vs. a language loophole that 
>> should be closed, but the relocator should also be deleted if any 
>> subobject *lacks* a relocator (i.e. "not declared"). Or if not declared 
>> and the conditions for implicit declaration are not met. (Both will 
>> close the loophole, the former might be preferred however.) 
>>
>> I'm not sure this is as tightly coupled to realloc_in_place as is 
>> suggested. If we have realloc_in_place, we don't need relocation for the 
>> case where that succeeds. If we assume that realloc always fails, we 
>> don't see any benefit from realloc_in_place. (That's not to say that we 
>> don't *want* realloc_in_place, just that Annex 1 makes it sound like 
>> both are significantly less useful without the other, which I don't 
>> believe is true. I think they are closer to orthogonal.) 
>>
>> Overall, looks very good; thanks again! 
>>
>> >> the second form should take an 'A[]' rather than an 'A*'. 
>> > 
>> > I have decided against this because the argument may in fact be a slice 
>> of 
>> > an array, not a whole array. Overlapping memory is also explicitly 
>> > supported, so I would not like to suggest that only a whole array may 
>> be 
>> > passed. 
>>
>> Okay, I can follow that. 
>>
>> >> (Which also makes me wonder if relocation should be const w.r.t. 
>> >> the old object?) 
>> > 
>> > I think not, because: 
>> > 
>> > - the user may want to explicitly destroy subobjects if initializing 
>> their 
>> > counterparts via means other than relocation; 
>> > 
>> > - the user may want to zero out memory being moved from. 
>>
>> These are good points, but can cut both ways. Where you run into 
>> problems is if the base class relocator fiddles with memory that the 
>> derived class still needed. 
>>
>> I'm not saying I feel strongly about it either way, just trying to 
>> explore the possible consequences of either decision. 
>>
>> >> I've seen try_realloc more often than realloc_in_place. 
>> > 
>> > I find realloc_in_place more descriptive. 
>>
>> Fair enough; I meant it more as an observation. 
>>
>> -- 
>> Matthew 
>>
>>

-- 

--- 
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_186_1888314699.1439521133557
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>Ville informs me that someone needs to champion this =
proposal in front of the Evolution WG.</div><div><br></div><div>I reckon, i=
f someone isn&#39;t found,=C2=A0the alternative is that it will be simply d=
isregarded.</div><div><br></div><div>Is anyone going to the next WG meeting=
 who is super passionate about efficient relocation, and wants to present t=
his proposal?</div><div><br></div><div>If no one volunteers, I&#39;ll have =
to go to Hawaii, and you know how much I would hate that. :)</div><div><br>=
</div><div>I believe such a volunteer should be sufficiently comfortable wi=
th the current state of the proposal as to be comfortable putting their nam=
e on it. Since this person would be presenting and defending the proposal i=
n front of the EWG, I imagine they would be=C2=A0added to the proposal=C2=
=A0as co-author.</div><div><br><br>On Thursday, August 13, 2015 at 8:54:17 =
PM UTC-6, isocp...@denisbider.com wrote:</div><blockquote class=3D"gmail_qu=
ote" style=3D"margin: 0px 0px 0px 0.8ex; padding-left: 1ex; border-left-col=
or: rgb(204, 204, 204); border-left-width: 1px; border-left-style: solid;">=
<div dir=3D"ltr"><div>Thanks for your reply!</div><div><br></div><div>&gt; =
Finally read it; sorry it took so long. </div><div><br></div><div>No worrie=
s at all.</div><div><br></div><div>I have uploaded a new=C2=A0version again=
, based on this feedback:</div><div><br></div><div><a onmousedown=3D"this.h=
ref=3D&#39;http://www.google.com/url?q\75http%3A%2F%2Fdenisbider.com%2FRelo=
cator.pdf\46sa\75D\46sntz\0751\46usg\75AFQjCNGRaVpviwtOSXhpXtDNRASkBLXVYw&#=
39;;return true;" onclick=3D"this.href=3D&#39;http://www.google.com/url?q\7=
5http%3A%2F%2Fdenisbider.com%2FRelocator.pdf\46sa\75D\46sntz\0751\46usg\75A=
FQjCNGRaVpviwtOSXhpXtDNRASkBLXVYw&#39;;return true;" href=3D"http://denisbi=
der.com/Relocator.pdf" target=3D"_blank" rel=3D"nofollow">http://denisbider=
..com/<wbr>Relocator.pdf</a></div><div><br></div><div>- It now has a proper =
proposal number, P0023, currently R0.</div><div><br></div><div>- It adds a =
single-object version of <font face=3D"courier new,monospace">relocate_or_m=
ove</font>, as suggested.</div><div><br></div><div>- It switches around Ann=
ex 1 and Annex 2, so that <font face=3D"courier new,monospace">relocate_or_=
move</font> is in Annex 1,=C2=A0reflecting it&#39;s=C2=A0more central.</div=
><div><br></div><div>- Changed wording related to <font face=3D"courier new=
,monospace">realloc_in_place</font>, now in=C2=A0Annex 2, to make it cleare=
r that it&#39;s related to, but not essential to the proposal.</div><div><b=
r></div><div>- Added discussion headings &quot;Why not a const reference?&q=
uot; and &quot;Why not an rvalue reference?&quot;</div><div><br></div><div>=
<br></div><div><br></div><div>&gt; I still wonder if the indirection for th=
e relocation</div><div>&gt; operator shouldn&#39;t=C2=A0somehow indicate th=
at the</div><div>&gt; parameter will be destroyed when the outermost <br>&g=
t; relocation completes. (If not &#39;T~&#39;/&#39;T~&amp;&#39;, I wonder</=
div><div>&gt; if it should at least=C2=A0be a &#39;T&amp;&amp;&#39;? Not su=
re though...) <br></div><div><br></div><div>The problem with an rvalue refe=
rence is that you then have to consistently do this:</div><div><br></div><d=
iv><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(48, 128, 128); font-family: Co=
nsolas; font-size: 10pt;">=C2=A0</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(48, 128, 128); font-family: Co=
nsolas; font-size: 10pt;"><span>=C2=A0 </span>&gt;&gt;</span><span style=3D=
"color: rgb(0, 0, 32); font-family: Consolas; font-size: 10pt;">A</span><sp=
an style=3D"color: rgb(48, 128, 128); font-family: Consolas; font-size: 10p=
t;">(</span><span style=3D"color: rgb(0, 0, 32); font-family: Consolas; fon=
t-size: 10pt;">A</span><span style=3D"color: rgb(48, 128, 128); font-family=
: Consolas; font-size: 10pt;">&amp;&amp;</span><span style=3D"color: rgb(0,=
 0, 32); font-family: Consolas; font-size: 10pt;"> x</span><span style=3D"c=
olor: 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-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;">B</span><span s=
tyle=3D"color: rgb(48, 128, 128); font-family: Consolas; font-size: 10pt;">=
(</span><span style=3D"color: rgb(0, 102, 238); font-family: Consolas; font=
-size: 10pt;">std</span><span style=3D"color: rgb(64, 96, 128); font-family=
: Consolas; font-size: 10pt;">::</span><span style=3D"color: rgb(0, 0, 32);=
 font-family: Consolas; font-size: 10pt;">move</span><span style=3D"color: =
rgb(48, 128, 128); font-family: Consolas; font-size: 10pt;">(</span><span s=
tyle=3D"color: rgb(0, 0, 32); font-family: Consolas; font-size: 10pt;">x</s=
pan><span style=3D"color: rgb(48, 128, 128); font-family: Consolas; font-si=
ze: 10pt;">))</span><span style=3D"color: rgb(64, 96, 128); font-family: Co=
nsolas; font-size: 10pt;">,</span><span style=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 st=
yle=3D"color: rgb(0, 0, 32); font-family: Consolas; font-size: 10pt;">c</sp=
an><span style=3D"color: rgb(48, 128, 128); font-family: Consolas; font-siz=
e: 10pt;">(</span><span style=3D"color: rgb(0, 102, 238); font-family: Cons=
olas; font-size: 10pt;">std</span><span style=3D"color: rgb(64, 96, 128); f=
ont-family: Consolas; font-size: 10pt;">::</span><span style=3D"color: rgb(=
0, 0, 32); font-family: Consolas; font-size: 10pt;">move</span><span style=
=3D"color: rgb(48, 128, 128); font-family: Consolas; font-size: 10pt;">(</s=
pan><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: Consol=
as; font-size: 10pt;">.</span><span style=3D"color: rgb(0, 0, 32); font-fam=
ily: Consolas; font-size: 10pt;">c</span><span style=3D"color: rgb(48, 128,=
 128); font-family: Consolas; font-size: 10pt;">))</span><span style=3D"col=
or: rgb(0, 0, 32); font-family: Consolas; font-size: 10pt;"> </span><span s=
tyle=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><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;">=C2=A0</span></p><font color=3D"#000000" face=3D"Time=
s New Roman" size=3D"3">

</font></div><div><br></div><div><div>I think this would be inconvenience f=
or the sake of inconvenience alone. Not much is gained, since an rvalue ref=
erence is not needed to e.g. resolve an overload conflict.</div><div><br></=
div><div>A new reference type is a whole new animal altogether and probably=
 not warranted as long as this would be the only usage case. There is no te=
chnical problem we&#39;d be solving with a new reference type, just a subje=
ctive problem of indication.</div><div><br></div><div>I would argue that in=
dication is already handled sufficiently by the syntax <font face=3D"courie=
r new,monospace">&gt;&gt;A</font>, so that there&#39;s no need to handle it=
 additionally via reference type, also.</div><div><br></div><div><br></div>=
<div>&gt; Might want to say, instead of &quot;std::relocate,</div><div>&gt;=
 defined as&quot; with=C2=A0&quot;might be defined as&quot;,</div><div><br>=
</div><div>Good point. I have changed that to &quot;behaving as follows&quo=
t;.</div><div><br></div><div><br></div><div>&gt; the relocator should also =
be deleted if any <br>&gt; subobject *lacks* a relocator (i.e. &quot;not de=
clared&quot;).</div><div><br></div><div>Good point. I have added this stipu=
lation.</div><div><br></div><div><br></div><div>&gt; I&#39;m not sure this =
is as tightly coupled to</div><div>&gt; realloc_in_place as is suggested.</=
div><div><br></div><div>I agree, the championing of <font face=3D"courier n=
ew,monospace">realloc_in_place</font> was overdone. I have toned it down to=
 make it clear that the relocator proposal stands on its own, without it. :=
-)</div><div><br></div><div><br></div><div>&gt; Where you run into problems=
 is if the base</div><div>&gt; class relocator fiddles with memory that the=
 <br>&gt; derived class still needed. <br></div><div><br></div><div>True. H=
owever, I&#39;d prefer for modification of the original object to be define=
d behavior, and to let the user beware and not shoot themselves=C2=A0in the=
 foot; rather than to preclude access &quot;for yer protection&quot;. :-)</=
div></div><div><br></div><div><br>On Thursday, August 13, 2015 at 10:12:15 =
AM UTC-6, Matthew Woehlke wrote:</div><blockquote class=3D"gmail_quote" sty=
le=3D"margin: 0px 0px 0px 0.8ex; padding-left: 1ex; border-left-color: rgb(=
204, 204, 204); border-left-width: 1px; border-left-style: solid;">On 2015-=
08-11 15:45, <a rel=3D"nofollow">isocp...@denisbider.com</a> wrote:
<br>&gt; Good points, thank you!
<br>&gt;=20
<br>&gt; I have uploaded a new version of the draft addressing the followin=
g:
<br>
<br>Finally read it; sorry it took so long.
<br>
<br>Thanks for the improved examples section!
<br>
<br>I still wonder if the indirection for the relocation operator shouldn&#=
39;t
<br>somehow indicate that the parameter will be destroyed when the outermos=
t
<br>relocation completes. (If not &#39;T~&#39;/&#39;T~&amp;&#39;, I wonder =
if it should at least
<br>be a &#39;T&amp;&amp;&#39;? Not sure though...)
<br>
<br>&gt; - proposed single object invocation is now similar to placement ne=
w
<br>
<br>Cool :-).
<br>
<br>&gt; - there is now an Annex 2 defining a proposed std::relocate_or_mov=
e
<br>
<br>Cool :-).
<br>
<br>I wonder if there should also be single-object versions?
<br>
<br>Nit: Might want to say, instead of &quot;std::relocate, defined as&quot=
; with
<br>&quot;might be defined as&quot;, in case implementations need to insert=
 some
<br>compiler voodoo to denote creation and deletion of objects in the
<br>memmove case. (Presumably, the relocation operator has this built in,
<br>but the trivial case isn&#39;t calling that...) Or, just if libraries c=
ome
<br>up with some better implementation. I don&#39;t think the actual defini=
tion
<br>needs to be codified, just the effect.
<br>
<br>&gt; - proposed implicit declaration rules have been relaxed, so that e=
xplicitly=20
<br>&gt; defaulting a special member does not block implicit relocator decl=
aration
<br>
<br>Cool; thanks :-).
<br>
<br>&gt; - added explicit statement that lifetime of object in original loc=
ation=20
<br>&gt; ceases when outermost relocator completes
<br>
<br>Cool :-). I think we needed this, and your wording LGTM. Thanks.
<br>
<br>&gt; - added explicit statement that invocation of subobject relocator =
outside=20
<br>&gt; of outer object relocation is undefined behavior
<br>
<br>Erk... yes, it had better be ;-). Good catch; thanks.
<br>
<br>
<br>Other comments:
<br>
<br>I think this isn&#39;t exactly an omission vs. a language loophole that
<br>should be closed, but the relocator should also be deleted if any
<br>subobject *lacks* a relocator (i.e. &quot;not declared&quot;). Or if no=
t declared
<br>and the conditions for implicit declaration are not met. (Both will
<br>close the loophole, the former might be preferred however.)
<br>
<br>I&#39;m not sure this is as tightly coupled to realloc_in_place as is
<br>suggested. If we have realloc_in_place, we don&#39;t need relocation fo=
r the
<br>case where that succeeds. If we assume that realloc always fails, we
<br>don&#39;t see any benefit from realloc_in_place. (That&#39;s not to say=
 that we
<br>don&#39;t *want* realloc_in_place, just that Annex 1 makes it sound lik=
e
<br>both are significantly less useful without the other, which I don&#39;t
<br>believe is true. I think they are closer to orthogonal.)
<br>
<br>Overall, looks very good; thanks again!
<br>
<br>&gt;&gt; the second form should take an &#39;A[]&#39; rather than an &#=
39;A*&#39;.
<br>&gt;=20
<br>&gt; I have decided against this because the argument may in fact be a =
slice of=20
<br>&gt; an array, not a whole array. Overlapping memory is also explicitly=
=20
<br>&gt; supported, so I would not like to suggest that only a whole array =
may be=20
<br>&gt; passed.
<br>
<br>Okay, I can follow that.
<br>
<br>&gt;&gt; (Which also makes me wonder if relocation should be const w.r.=
t.
<br>&gt;&gt; the old object?)
<br>&gt;=20
<br>&gt; I think not, because:
<br>&gt;=20
<br>&gt; - the user may want to explicitly destroy subobjects if initializi=
ng their=20
<br>&gt; counterparts via means other than relocation;
<br>&gt;=20
<br>&gt; - the user may want to zero out memory being moved from.
<br>
<br>These are good points, but can cut both ways. Where you run into
<br>problems is if the base class relocator fiddles with memory that the
<br>derived class still needed.
<br>
<br>I&#39;m not saying I feel strongly about it either way, just trying to
<br>explore the possible consequences of either decision.
<br>
<br>&gt;&gt; I&#39;ve seen try_realloc more often than realloc_in_place.
<br>&gt;=20
<br>&gt; I find realloc_in_place more descriptive.
<br>
<br>Fair enough; I meant it more as an observation.
<br>
<br>--=20
<br>Matthew
<br>
<br></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_186_1888314699.1439521133557--
------=_Part_185_1486388530.1439521133556--

.
