220 37442 <CAGg_6+NXH4jPHwLKqYeOJ=CCWsh2dJetCYOSNt8vfmMduZBPqQ@mail.gmail.com> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Nevin Liber <nevin@eviloverlord.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: default assignment should be established by construction
Date: Fri, 23 Mar 2018 14:03:38 -0500
Lines: 100
Approved: news@gmane.org
Message-ID: <CAGg_6+NXH4jPHwLKqYeOJ=CCWsh2dJetCYOSNt8vfmMduZBPqQ@mail.gmail.com>
References: <58813920-b8f6-4e2f-83ed-c4c299792b62@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary="001a114daec260c6b50568191763"
X-Trace: blaine.gmane.org 1521831742 9290 195.159.176.226 (23 Mar 2018 19:02:22 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Fri, 23 Mar 2018 19:02:22 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCE35H5S6IDBBN472XKQKGQEMNIEVWY@isocpp.org Fri Mar 23 20:02:18 2018
Return-path: <std-proposals+bncBCE35H5S6IDBBN472XKQKGQEMNIEVWY@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-ua0-f197.google.com ([209.85.217.197])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCE35H5S6IDBBN472XKQKGQEMNIEVWY@isocpp.org>)
	id 1ezRxC-0002JU-Aa
	for gclcip-std-proposals@m.gmane.org; Fri, 23 Mar 2018 20:02:18 +0100
Original-Received: by mail-ua0-f197.google.com with SMTP id 60sf8267357uab.21
        for <gclcip-std-proposals@m.gmane.org>; Fri, 23 Mar 2018 12:04:26 -0700 (PDT)
ARC-Seal: i=2; a=rsa-sha256; t=1521831865; cv=pass;
        d=google.com; s=arc-20160816;
        b=MJ1rq1gf3MlCaFhHyvJgmNWiLwcj5CYgDOsaYG2qjG4eDx/HOGNNPjXBSgdnBQ0U05
         E8tLllatmdi3kK8AXNV75GvqTN4jjgoDboaN/i4cUEqsp1YYiOqWt1E1U+vMhUGvd+RW
         KQokE1Ot2h+BKdVKNS7JYVohlaNhyH/Kneva3lGYhEbkjcWOBxkUPCwICF2vAWOn/J8b
         tgDGC6LJpY1IJw9KweKzfr3AxbcknDMlFzFu2m9KmxcGTWvQX5WUmvUQ9F/95+xXtTGX
         h1VZH8u4tKdYhmvAUA4SHSoZQ73KkiqfunG4q3zTqKNjEtp1cBEO9EhK+6s9L6pZq+3c
         TGAQ==
ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post
         :list-id:mailing-list:precedence:reply-to:to:subject:message-id:date
         :from:references:in-reply-to:sender:mime-version
         :arc-authentication-results:arc-message-signature
         :arc-authentication-results;
        bh=ekzlqyN8Try+7P0rxEzB3+1IsyDuLFAoUIOXSOPa8+c=;
        b=tyodQ6vfHIU/dQYO77buBWIAJFDdtmo2x3oNYnfQtkS+i6T7HXdwYIFjR7GYDIEwC3
         +efmSUNKKkFHF9vcFRw/AEZx6vx6eUfW8ojbGd5OvDXOhqvfejCyaU3Kkpan17Ob99x4
         +GfOsMPP8TF9eg2NDvmSAby1zAiUcRhX/IhjRBrjOHfepHJ9VEleW8QymEs6VKAwhM/c
         Ay7IUfqRKt+pE2BEH4qQh/yCYB1vVdUdc/ziAo6LYNKO8WIqGfZ+/UVEsAo5wvRUY7YQ
         BLXQE7ce3PC9N8KF0uSi1Jo1sOyKzWNcSB33UAp13/2rCx8T1jYifQxsYraJWZ/uILcw
         Svlw==
ARC-Authentication-Results: i=2; mx.google.com;
       dkim=pass header.i=@gmail.com header.s=20161025 header.b=PAwvxWbV;
       spf=pass (google.com: domain of nliber@gmail.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=nliber@gmail.com
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:mime-version:sender:in-reply-to:references:from
         :date:message-id:subject: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=ekzlqyN8Try+7P0rxEzB3+1IsyDuLFAoUIOXSOPa8+c=;
        b=th3HjmWemvRzz7rCdxW4Ot9j1GPc2jaqIdTvQD99KrPvsVgdmEbcQFxWEOd9DKy/bu
         ZQ1m/XiVdmYXPRjYkPDFIm3F0/mHYjtAVLIaN7OvlE7JVZKUi0ERw7kfatKFEcBdmxet
         74gXSzt8pysIjFzgKBgWqUzDNjcIOK7lUnXM+G/rsAdTZfOFNRu+v2BtZOZY29ojLA8v
         FHzKF8MT1gZyYqbUM+UPWRq3Glv1qKmOuGGFxKXrfFaiMks7L9DA/eCTdnDTH/0e6UhM
         ax6Y3O0ddRi/HXHO26Ty+7v6iaNYFTS+HWQr2d4mLZIXHkEoPn7q04sNUZb6Ewk179Ya
         x7Pw==
X-Gm-Message-State: AElRT7EsXn5ikKLNLfhnhetPtKRGA8xk9w4FB44a93p8vHZngf6th9QB
	ncCinUp8pAOtQ7o7weWhHJU=
X-Google-Smtp-Source: AG47ELtLWGezV73O6aqucLVyUx3czHFrQoKrpiQL8wytW4MUtPecdp/dLgbNys7YNgurkyKlbPvk3A==
X-Received: by 10.31.242.74 with SMTP id q71mr9649520vkh.120.1521831865534;
        Fri, 23 Mar 2018 12:04:25 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.176.16.228 with SMTP id x36ls1284964uab.3.gmail; Fri, 23 Mar
 2018 12:04:19 -0700 (PDT)
X-Received: by 10.176.68.197 with SMTP id n63mr20284431uan.132.1521831859922;
        Fri, 23 Mar 2018 12:04:19 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1521831859; cv=none;
        d=google.com; s=arc-20160816;
        b=yNeUeMx1Jlskds7Oa6JIHlbY/WscHpcM2iqhfR9t7TzKfHQt6c+ePVHaQcMDkowUAu
         70XO1Y2q2nvTIjk6bFWSr1RMuK33aAu2nblJvxD/OGwu+OXAIz2AV3fZyfOcdX8DWFVS
         r9CC133JzjeR02Nm2Gdl0SPz2DCx+gSxCGjG7E5AA6SdgU4jGvCEbj+MvuG2G41KrAdE
         +ttdQR2/qzWlACrTssuqhySp5rU9t3at6bZSTT2f3yl9I/t3orsUrsEbS7Nrf4zj1sY0
         Lvw7/7ej2Y+84eaIyy9pB73BwYVOMIynSUGFy5Lix01owAp4Tk2jpXxYnB6r+dMvcJXQ
         mHfQ==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=to:subject:message-id:date:from:references:in-reply-to:sender
         :mime-version:dkim-signature:arc-authentication-results;
        bh=G+FByNfKSzao5hB2Y0iHaV9Hk6slrfwO5mSJRyxwo8w=;
        b=owBsR27XPO6uzI4gApKwz9osxuJ6Iss8sFBFrq1Sf2Bg3vpa4iATx4vy/NKvqixgos
         +Y6WPLMSzUX1wrZLE9SyGWX309T1x48vgTsRFs0IqljsaAgjrbO6Fc8eB1WbHHc9sug8
         gJ2NZJzwvrlZ5b9ZWON3wJFPovBVwgWD5Q1C6MBDmyNhw02pRAWE6eoq1yAwveUeIBxU
         0819Kww/lAbbleHMd9hNvNo4mUlXte52vmrfJhWb0alVSks7EVAxhm3ZFrz6UghH9lfh
         WkJgN2i9frcaEkkotqK8AqidBt13jNVz9vITxV9srqoNgUR/O4BAQ3/7935AvGnqBm16
         ih/w==
ARC-Authentication-Results: i=1; mx.google.com;
       dkim=pass header.i=@gmail.com header.s=20161025 header.b=PAwvxWbV;
       spf=pass (google.com: domain of nliber@gmail.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=nliber@gmail.com
Original-Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41])
        by mx.google.com with SMTPS id l126sor1663464vkg.140.2018.03.23.12.04.19
        for <std-proposals@isocpp.org>
        (Google Transport Security);
        Fri, 23 Mar 2018 12:04:19 -0700 (PDT)
Received-SPF: pass (google.com: domain of nliber@gmail.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41;
X-Received: by 10.31.69.85 with SMTP id s82mr291069vka.162.1521831859240; Fri,
 23 Mar 2018 12:04:19 -0700 (PDT)
Original-Sender: nliber@gmail.com
Original-Received: by 10.103.118.135 with HTTP; Fri, 23 Mar 2018 12:03:38 -0700 (PDT)
In-Reply-To: <58813920-b8f6-4e2f-83ed-c4c299792b62@isocpp.org>
X-Original-Sender: nevin@eviloverlord.com
X-Original-Authentication-Results: mx.google.com;       dkim=pass
 header.i=@gmail.com header.s=20161025 header.b=PAwvxWbV;       spf=pass
 (google.com: domain of nliber@gmail.com designates 209.85.220.41 as permitted
 sender) smtp.mailfrom=nliber@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: <https://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <https://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <https://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <https://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>,
 <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:37442
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/37442>

--001a114daec260c6b50568191763
Content-Type: text/plain; charset="UTF-8"

On Fri, Mar 23, 2018 at 2:02 PM, 'wkaras@yahoo.com' via ISO C++ Standard -
Future Proposals <std-proposals@isocpp.org> wrote:

> For a class C, if the copy constructor is not deleted or suppressed, the
> default copy assignment operator should be:
>
> C & operator = (const C &that)
> {
>   if (&that != this)
>   {
>     this->~C();
>     new (this) C(that);
>   }
>   return *this;
> }
>
> (with const omitted from the parameter if it is omitted in the copy
> constructor).
>
> Likewise, if the move constructor is not deleted or surpressed, the
> default move assignment operator should be:
>
> C & operator = (C &&that)
> {
>   if (&that != this)
>   {
>     this->~C();
>     new (this) C(std::move(that));
>   }
>   return *this;
> }
>
> Hypothetically this could break existing code, but I can't think of a
> practical example of useful code it would break.
>

Only if you live in an exception-free world...
-- 
 Nevin ":-)" Liber  <mailto:nevin@eviloverlord.com>  +1-847-691-1404

-- 
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.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAGg_6%2BNXH4jPHwLKqYeOJ%3DCCWsh2dJetCYOSNt8vfmMduZBPqQ%40mail.gmail.com.

--001a114daec260c6b50568191763
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Fri, Mar 23, 2018 at 2:02 PM, &#39;<a href=3D"mailto:wk=
aras@yahoo.com">wkaras@yahoo.com</a>&#39; via ISO C++ Standard - Future Pro=
posals <span dir=3D"ltr">&lt;<a href=3D"mailto:std-proposals@isocpp.org" ta=
rget=3D"_blank">std-proposals@isocpp.org</a>&gt;</span> wrote:<br><div clas=
s=3D"gmail_extra"><div class=3D"gmail_quote"><blockquote class=3D"gmail_quo=
te" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"=
><div dir=3D"ltr">For a class C, if the copy constructor is not deleted or =
suppressed, the default copy assignment operator should be:<div><br></div><=
div>C &amp; operator =3D (const C &amp;that)</div><div>{</div><div>=C2=A0 i=
f (&amp;that !=3D this)</div><div>=C2=A0 {</div><div>=C2=A0 =C2=A0 this-&gt=
;~C();</div><div>=C2=A0 =C2=A0 new (this) C(that);</div><div>=C2=A0 }</div>=
<div>=C2=A0 return *this;</div><div>}</div><div><br></div><div>(with const =
omitted from the parameter if it is omitted in the copy constructor).</div>=
<div><br></div><div>Likewise, if the move constructor is not deleted or sur=
pressed, the default move assignment operator should be:</div><div><br></di=
v><div><div>C &amp; operator =3D (C &amp;&amp;that)</div><div>{</div><div>=
=C2=A0 if (&amp;that !=3D this)</div><div>=C2=A0 {</div><div>=C2=A0 =C2=A0 =
this-&gt;~C();</div><div>=C2=A0 =C2=A0 new (this) C(std::move(that));</div>=
<div>=C2=A0 }</div><div>=C2=A0 return *this;</div><div>}</div></div><div><b=
r></div><div>Hypothetically this could break existing code, but I can&#39;t=
 think of a practical example of useful code it would break.</div></div></b=
lockquote><div><br></div><div>Only if you live in an exception-free world..=
..=C2=A0</div></div>-- <br><div class=3D"gmail_signature" data-smartmail=3D"=
gmail_signature"><div dir=3D"ltr"><div><div dir=3D"ltr"><div>=C2=A0Nevin &q=
uot;:-)&quot; Liber=C2=A0 &lt;mailto:<a href=3D"mailto:nevin@eviloverlord.c=
om" target=3D"_blank">nevin@eviloverlord.com</a>&gt; =C2=A0+1-847-691-1404<=
/div></div></div></div></div>
</div></div>

<p></p>

-- <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 />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/CAGg_6%2BNXH4jPHwLKqYeOJ%3DCCWsh2dJet=
CYOSNt8vfmMduZBPqQ%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter"=
>https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAGg_6%2BNXH4=
jPHwLKqYeOJ%3DCCWsh2dJetCYOSNt8vfmMduZBPqQ%40mail.gmail.com</a>.<br />

--001a114daec260c6b50568191763--

.
