220 14122 <6e2cf992-2bc8-4334-8ea2-df947fc7d884@isocpp.org> article
Path: news.gmane.org!not-for-mail
From: Olaf van der Spek <olafvdspek@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Reconstruct function idea
Date: Wed, 22 Oct 2014 08:31:56 -0700 (PDT)
Lines: 93
Approved: news@gmane.org
Message-ID: <6e2cf992-2bc8-4334-8ea2-df947fc7d884@isocpp.org>
References: <ff612334-ae16-43d1-a650-580d0ce635f2@isocpp.org>
 <CAGg_6+OH-P=uxCx7YEWdJSRtrRfBYhGXh55eymvyM9Vjr+yKMg@mail.gmail.com>
 <8a74f08b-7453-4d1a-9f20-bc1d3866617c@isocpp.org>
 <CAFk2RUZ7w3jpuJU1Hqr2=qfDJQycG0P8az+QwsWCG8mBQWi8Jg@mail.gmail.com>
 <27e2ae9c-8b1f-4688-9bb3-9caef6bf4f54@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; 
	boundary="----=_Part_3781_220329307.1413991916580"
X-Trace: ger.gmane.org 1413991925 3373 80.91.229.3 (22 Oct 2014 15:32:05 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Wed, 22 Oct 2014 15:32:05 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBC5NB45SSABBB3M3T6RAKGQEO2WP6DY@isocpp.org Wed Oct 22 17:31:59 2014
Return-path: <std-proposals+bncBC5NB45SSABBB3M3T6RAKGQEO2WP6DY@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-yh0-f71.google.com ([209.85.213.71])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBC5NB45SSABBB3M3T6RAKGQEO2WP6DY@isocpp.org>)
	id 1XgxtG-0006Lv-8S
	for gclcip-std-proposals@m.gmane.org; Wed, 22 Oct 2014 17:31:58 +0200
Original-Received: by mail-yh0-f71.google.com with SMTP id f10sf5207896yha.2
        for <gclcip-std-proposals@m.gmane.org>; Wed, 22 Oct 2014 08:31:57 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=date:from:to:message-id:in-reply-to:references:subject:mime-version
         :x-original-sender:reply-to:precedence:mailing-list:list-id
         :list-post:list-help:list-archive:list-subscribe:list-unsubscribe
         :content-type;
        bh=r64Bf1Po7qgLTvjPE+CBCcNHcOqDXLh7IGfXBEnfZ7Q=;
        b=e23FNaZiR9wxYZuPbfFoSzkgq0FMbuF8ESXNfB3i5knXB7bSyo6kYiNeS+CwwR5jKd
         rF8gSHiWwQL5HuZ58Jknvnhp0y1t7sEc04/cmb0as2UGm4/zlTT8WLVMVN+rT93W2HA4
         Y2Ynr0eGeeXla3qTTJLpYZlo34h6y4D2hnIamsGRmIpdljIYIsva1iTtKHYXxHtAcNsV
         c9PuzYVMBOKv4VdbZTDEiRBjlbq3xgBNwmvNHCIeApxjP3NGochPdrt4FhPtqEVixufv
         Q7kUIB70GEHcIBzqulHEhsAVN/Ax36bhPXjNxL1QyBEapwiwHrm5wCDKYbNHFdW/7gf5
         37eg==
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:message-id:in-reply-to:references
         :subject:mime-version:x-original-sender:reply-to:precedence
         :mailing-list:list-id:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe:content-type;
        bh=r64Bf1Po7qgLTvjPE+CBCcNHcOqDXLh7IGfXBEnfZ7Q=;
        b=NqJ+Y1Jopk1gUzKEHZIc5V1zNayYSQkFWYURw+GrsIrTfW4fHNc8vDTFTPi43l5rno
         utJ6AUqlApFApTVquTGsNfpkJrZdEg9GlVXAq7I91KG9rha9XJPc5VhW4ifJNTl2fJuk
         CdS3pKhhf4YrzB6G0jwMxfbbeSiOou+1Rwhflu9Z4bh3KX3y2NJGcU0+/42HF00F+13Q
         IbMm+Nl3ZEo/jp33TaXfZl/vv1Y3P+Orn5RT05PlQ4U+s/ZAW0WjIxUh7mGdEGguCbo2
         nguiRwYNrrv+e+KgJWkohbrYQ7L+tfQIrLwT1XspZdk32V+6FlpDrw97yRa2n4RZufFO
         D/cw==
X-Gm-Message-State: ALoCoQkKLgfoaR27CwQJLvYrC4kLptLZZ5ousixskD3iAKAi8vAfQkARL75bJByCYGTi70DJyTkS
X-Received: by 10.236.66.102 with SMTP id g66mr27225298yhd.3.1413991917448;
        Wed, 22 Oct 2014 08:31:57 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.140.40.232 with SMTP id x95ls810574qgx.76.gmail; Wed, 22 Oct
 2014 08:31:56 -0700 (PDT)
X-Received: by 10.140.109.132 with SMTP id l4mr17028qgf.24.1413991916914;
        Wed, 22 Oct 2014 08:31:56 -0700 (PDT)
In-Reply-To: <27e2ae9c-8b1f-4688-9bb3-9caef6bf4f54@isocpp.org>
X-Original-Sender: olafvdspek@gmail.com
Precedence: list
Mailing-list: list std-proposals@isocpp.org; contact std-proposals+owners@isocpp.org
List-ID: <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:14122
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/14122>

------=_Part_3781_220329307.1413991916580
Content-Type: text/plain; charset=UTF-8

On Thursday, October 16, 2014 12:22:53 AM UTC+2, Myriachan wrote:
>
> The main reason to use something like this is for copy constructors.  
> Sometimes, the most convenient way to implement a copy or move constructor 
> is like this:
>
> T &T::operator =(const T &copy)
> {
>     if (&copy != this)
>     {
>         this->~T();
>         new(this) T(copy);
>     }
>     return *this;
> }
>
> ...and equivalently with std::forward for move constructors.
>
>
Can't you forward to the assignment operator in that case (most of the 
time)? 

-- 

--- 
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_3781_220329307.1413991916580
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Thursday, October 16, 2014 12:22:53 AM UTC+2, Myriachan=
 wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.=
8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"><div>T=
he main reason to use something like this is for copy constructors.&nbsp; S=
ometimes, the most convenient way to implement a copy or move constructor i=
s like this:<br><br><div style=3D"background-color:rgb(250,250,250);border-=
color:rgb(187,187,187);border-style:solid;border-width:1px;word-wrap:break-=
word"><code><div><span style=3D"color:#000">T </span><span style=3D"color:#=
660">&amp;</span><span style=3D"color:#000">T</span><span style=3D"color:#6=
60">::</span><span style=3D"color:#008">operator</span><span style=3D"color=
:#000"> </span><span style=3D"color:#660">=3D(</span><span style=3D"color:#=
008">const</span><span style=3D"color:#000"> T </span><span style=3D"color:=
#660">&amp;</span><span style=3D"color:#000">copy</span><span style=3D"colo=
r:#660">)</span><span style=3D"color:#000"><br></span><span style=3D"color:=
#660">{</span><span style=3D"color:#000"><br>&nbsp; &nbsp; </span><span sty=
le=3D"color:#008">if</span><span style=3D"color:#000"> </span><span style=
=3D"color:#660">(&amp;</span><span style=3D"color:#000">copy </span><span s=
tyle=3D"color:#660">!=3D</span><span style=3D"color:#000"> </span><span sty=
le=3D"color:#008">this</span><span style=3D"color:#660">)</span><span style=
=3D"color:#000"><br>&nbsp; &nbsp; </span><span style=3D"color:#660">{</span=
><span style=3D"color:#000"><br>&nbsp; &nbsp; &nbsp; &nbsp; </span><span st=
yle=3D"color:#008">this</span><span style=3D"color:#660">-&gt;~</span><span=
 style=3D"color:#000">T</span><span style=3D"color:#660">();</span><span st=
yle=3D"color:#000"><br>&nbsp; &nbsp; &nbsp; &nbsp; </span><span style=3D"co=
lor:#008">new</span><span style=3D"color:#660">(</span><span style=3D"color=
:#008">this</span><span style=3D"color:#660">)</span><span style=3D"color:#=
000"> T</span><span style=3D"color:#660">(</span><span style=3D"color:#000"=
>copy</span><span style=3D"color:#660">);</span><span style=3D"color:#000">=
<br>&nbsp; &nbsp; </span><span style=3D"color:#660">}</span><span style=3D"=
color:#000"><br>&nbsp; &nbsp; </span><span style=3D"color:#008">return</spa=
n><span style=3D"color:#000"> </span><span style=3D"color:#660">*</span><sp=
an style=3D"color:#008">this</span><span style=3D"color:#660">;</span><span=
 style=3D"color:#000"><br></span><span style=3D"color:#660">}</span><span s=
tyle=3D"color:#000"><br></span></div></code></div><br>...and equivalently w=
ith std::forward for move constructors.<br><br></div></div></blockquote><di=
v><br></div><div>Can't you forward to the assignment operator in that case =
(most of the time)?&nbsp;</div></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_3781_220329307.1413991916580--

.
