220 19778 <mqd1k9$ijm$1@ger.gmane.org> article
Path: news.gmane.org!not-for-mail
From: Matthew Woehlke <mwoehlke.floss@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Move destructor draft
Date: Tue, 11 Aug 2015 10:42:17 -0400
Lines: 38
Approved: news@gmane.org
Message-ID: <mqd1k9$ijm$1@ger.gmane.org>
References: <0A99E209-333B-4140-8F65-2F022E681AC1@gmail.com> <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-444b-a1dc-333a52be7873@isocpp.org> <mq3857$fc8$1@ger.gmane.org> <a2630a2b-51b1-4678-8217-1185ad484f9d@isocpp.org> <5A4BB28D-A1EE-4B78-99FF-6BCFEA7E2FF3@gma
 il.com> <dff8e832-796e-405f-8363-43b8a600d637@isocpp.org> <1384fc7c-3e1e-439a-9ada-8ec2ff48cc2d@isocpp.org> <8c7ed362-5609-4176-a5bb-a68798e2e71d@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
X-Trace: ger.gmane.org 1439304316 22275 80.91.229.3 (11 Aug 2015 14:45:16 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Tue, 11 Aug 2015 14:45:16 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBC37LBFWUIFBB44UVCXAKGQEISILVAQ@isocpp.org Tue Aug 11 16:45:08 2015
Return-path: <std-proposals+bncBC37LBFWUIFBB44UVCXAKGQEISILVAQ@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-wi0-f198.google.com ([209.85.212.198])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBC37LBFWUIFBB44UVCXAKGQEISILVAQ@isocpp.org>)
	id 1ZPAnc-0007KF-43
	for gclcip-std-proposals@m.gmane.org; Tue, 11 Aug 2015 16:45:08 +0200
Original-Received: by wicul11 with SMTP id ul11sf50440435wic.1
        for <gclcip-std-proposals@m.gmane.org>; Tue, 11 Aug 2015 07:45:07 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:to:from:subject:date:lines:message-id:references
         :mime-version:content-type:user-agent:in-reply-to:x-original-sender
         :x-original-authentication-results:reply-to:precedence:mailing-list
         :list-id:x-spam-checked-in-group:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=l4Qb34c1GhspZq/y+8nRd47CPbQqv/4OmYAtxcYYz0c=;
        b=SyRUVSzQ9uue2rTDNL/9k9Mi5TqEEIlBLtGsfhjc4PYgG3tf4MGZMmpgvLhDufpcIZ
         k+QKGQVd6gDwPcC+xnrdrTpWcL/Ios3jMJm52jxOoJZhfOCoGuZH9cqoKfLpyTVzPJhj
         iMU38IZ8qeoHcVqSHUv8m0s6egFpu4KAiTbM7+dW7nPBY0YVjqzC2As3XJg6UXjXM/SV
         7ICc7Z65t2zwf+RwMsIcymfEv42vFPHlVCnEVb4jjiFayVxZcBSAWfv0bQPJ5+t275VY
         juO9Mn4+qjUlo6f87eZMOr0rmlMA79s6mZqrB4qgW1kpLuxKFGwX7yTvKXMdzNTB/iiq
         
X-Gm-Message-State: ALoCoQnaUQbxuUhPeg3hpOnYTIGcNMw/qCkr22unVDij93snJdPFyWvJsL49y6QLy1ePuN++nKuW
X-Received: by 10.112.90.225 with SMTP id bz1mr456938lbb.12.1439304307647;
        Tue, 11 Aug 2015 07:45:07 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.152.5.39 with SMTP id p7ls806047lap.104.gmail; Tue, 11 Aug
 2015 07:45:06 -0700 (PDT)
X-Received: by 10.152.6.65 with SMTP id y1mr12558921lay.58.1439304306339;
        Tue, 11 Aug 2015 07:45:06 -0700 (PDT)
Original-Received: from plane.gmane.org (plane.gmane.org. [80.91.229.3])
        by mx.google.com with ESMTPS id x8si1523760laj.25.2015.08.11.07.45.06
        for <std-proposals@isocpp.org>
        (version=TLSv1 cipher=RC4-SHA bits=128/128);
        Tue, 11 Aug 2015 07:45:06 -0700 (PDT)
Received-SPF: pass (google.com: domain of gclcip-std-proposals@m.gmane.org designates 80.91.229.3 as permitted sender) client-ip=80.91.229.3;
Original-Received: from list by plane.gmane.org with local (Exim 4.69)
	(envelope-from <gclcip-std-proposals@m.gmane.org>)
	id 1ZPAnZ-0007JH-71
	for std-proposals@isocpp.org; Tue, 11 Aug 2015 16:45:05 +0200
Original-Received: from tripoint.kitware.com ([66.194.253.20])
        by main.gmane.org with esmtp (Gmexim 0.1 (Debian))
        id 1AlnuQ-0007hv-00
        for <std-proposals@isocpp.org>; Tue, 11 Aug 2015 16:45:05 +0200
Original-Received: from mwoehlke.floss by tripoint.kitware.com with local (Gmexim 0.1 (Debian))
        id 1AlnuQ-0007hv-00
        for <std-proposals@isocpp.org>; Tue, 11 Aug 2015 16:45:05 +0200
X-Injected-Via-Gmane: http://gmane.org/
Original-Lines: 29
Original-X-Complaints-To: usenet@ger.gmane.org
X-Gmane-NNTP-Posting-Host: tripoint.kitware.com
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0
In-Reply-To: <8c7ed362-5609-4176-a5bb-a68798e2e71d@isocpp.org>
X-Original-Sender: mwoehlke.floss@gmail.com
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of gclcip-std-proposals@m.gmane.org designates 80.91.229.3 as
 permitted sender) smtp.mailfrom=gclcip-std-proposals@m.gmane.org;
       dmarc=fail (p=NONE dis=NONE) header.from=gmail.com
Precedence: list
Mailing-list: list std-proposals@isocpp.org; contact std-proposals+owners@isocpp.org
List-ID: <std-proposals.isocpp.org>
X-Spam-Checked-In-Group: std-proposals@isocpp.org
X-Google-Group-Id: 399137483710
List-Post: <http://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <http://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <http://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:std-proposals+subscribe@isocpp.org>
List-Unsubscribe: <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>,
 <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:19778
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/19778>

On 2015-08-09 21:14, jgottman6@gmail.com wrote:
> Very nice, but I have one question.  How do you handle member variables 
> that might or might not be self-references?  For instance, in your example, 
> if the variable a is guaranteed to be either equal to this or a pointer to 
> an object allocated with new, how would you write the relocator function?  
> Most other members of class A could have code like
> 
> if (a == this) {
>    //do something
> } else {
>    //do something else
> }
> 
> but in the case of the relocator function, by the time we get to the a 
> variable half the object has been relocated and it's not at all obvious 
> what needs to be tested.

You would compare to the old object location rather than 'this'.
Examples like these are why if we were to have a separate fix-up
operator (i.e. able to "mostly" construct the new objects via memcpy),
it would need the original object address and *possibly* also need for
that memory to be unmodified.

With a one-at-a-time relocation operator/ctor/whatever you don't run
into these sorts of problems, although it does penalize the case of such
classes somewhat.

-- 
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/.

.
