220 29842 <ad1bfe2f-c769-4938-9f92-8f6b396f03e6@isocpp.org> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Nicol Bolas <jmckesson@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: New smart pointer: CopyConstructible and
 CopyAssignable flavor of unique_ptr
Date: Fri, 16 Dec 2016 08:06:14 -0800 (PST)
Lines: 102
Approved: news@gmane.org
Message-ID: <ad1bfe2f-c769-4938-9f92-8f6b396f03e6@isocpp.org>
References: <13702f32-32c2-447f-9996-3624fd678675@isocpp.org> <CAFk2RUY3c67YgivjPTSCB+FLUGfiFgi8F_8kcSSUwPeBp9tMmw@mail.gmail.com>
 <CAEddoJZxM5qe9qVfags_iNrd0YpvUo2xmSw-OqifnHJ+4wJtxA@mail.gmail.com>
 <e1e780b7-34ea-41bf-9aba-22a1eb6a5f3f@isocpp.org>
 <67a9e9ed-8748-4098-a43b-33598b516464@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_735_616581044.1481904374400"
X-Trace: blaine.gmane.org 1481904387 9069 195.159.176.226 (16 Dec 2016 16:06:27 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Fri, 16 Dec 2016 16:06:27 +0000 (UTC)
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBCEKFTV6ZUMBB55B2DBAKGQEZWE27HY@isocpp.org Fri Dec 16 17:06:14 2016
Return-path: <std-proposals+bncBCEKFTV6ZUMBB55B2DBAKGQEZWE27HY@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-pf0-f200.google.com ([209.85.192.200])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCEKFTV6ZUMBB55B2DBAKGQEZWE27HY@isocpp.org>)
	id 1cHv1P-0000PA-Gf
	for gclcip-std-proposals@m.gmane.org; Fri, 16 Dec 2016 17:06:11 +0100
Original-Received: by mail-pf0-f200.google.com with SMTP id i88sf123563896pfk.3
        for <gclcip-std-proposals@m.gmane.org>; Fri, 16 Dec 2016 08:06:16 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=date:from:to:message-id:in-reply-to:references:subject:mime-version
         :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=wDlurT28YfkluXtM4vkWyPhtEPXXoQD62yO4D2ll/Gw=;
        b=OAX+PVxkgGW08SIKca+0SYd62sgMyfmrZk02NYkxZ1AzZcL2fGh4CsQ6TWlxj9rmY3
         I1m/x5LBuMzroAxmTDaSefGS8BPDzP6NOVIKPHtJtr5nYXvuxF+jJme43T0GcxN2DPmi
         HiDQQAORoSuF++MQY9But0WJDxJkOTj27gQDS3iow9nBk+gDPYR+lOme7bkDPQ2pox5l
         xJlXKovRCXnqswCkSioUBmEk4/CL9pgX1Fqr0BDnjOkoGPFV12QtalnC/A9A801ZMU6N
         EENU69Vl2oemwtatTG5i5TbdN1IvRGRjvyCAobKUQIBFE0XBxXI2/5yKPQbXAKTi6bDe
         yadg==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=date:from:to:message-id:in-reply-to:references:subject:mime-version
         :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=wDlurT28YfkluXtM4vkWyPhtEPXXoQD62yO4D2ll/Gw=;
        b=PRCQUuqezOP8HeG5rWRX12O687jICdbYvlDHbmIHt2iH6gIba33opxPcZ/TJWzACgJ
         HM2IPpf79BL1AQepfX6/aoBTFlN7YKVki9/VLuMsTZnWnu39TYtji9CnjMzp9H13R5ca
         ySFWewNHfyB3RDDZPCPW2G5srFsQKaG6PmcIr6lSIR6pjRMlc0jY2WftYo+47KanVSkz
         pjMetBTHGvDXt28CYypTSc1ha+RP5oN1RvRMlsk1FCB7dnSQeT3eGmvGzhzGcUkG22cK
         l84Q8wuvbAV0GTHrYOLI4qLojFVtHa3U/f+XVtZXoe7k5d4yTtbWQiLVebS1AI9eY60Z
         +drA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        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:x-spam-checked-in-group:list-post:list-help
         :list-archive:list-subscribe:list-unsubscribe;
        bh=wDlurT28YfkluXtM4vkWyPhtEPXXoQD62yO4D2ll/Gw=;
        b=aBTzQSESN5HcgAKZtsEJRmv3rnL9MNoNQyIwje4+U/ya7oPbE6PZsLhX6fU8p/WX4N
         EnP0rMIQdAmaffCwrqBbHgMiuWA8iLF1sZOL1dFgXQZDkKcWKhtIs7oE54nQFdSXVPip
         eNSBSdKkdpvoERoshc2zMGV39XK1eCEfu69CI/bE8fyUN9rhCp8dU2ZbYvIoi191c2+X
         h+SPy2IgdEM1TvUV2wH64T6WX4LCo/DkgJrQA6neshD7Zhw5c5FeYG133zD3ZPdBiAQ8
         vX92JkAxpD0ePbawC+mRq9gz1gktoDz/mChN7tSGW/MfUioyZKyNXdbNcV2DmQyMHs09
         Qeqg==
X-Gm-Message-State: AKaTC016l7E74p+O4qlidBYbyOcnP4K3TayCVyyMfjS1cbroouVNWO3SwNDh63vQBZ0pKQ==
X-Received: by 10.99.36.1 with SMTP id k1mr1727405pgk.25.1481904375671;
        Fri, 16 Dec 2016 08:06:15 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.157.11.2 with SMTP id a2ls8481300ota.16.gmail; Fri, 16 Dec
 2016 08:06:14 -0800 (PST)
X-Received: by 10.157.37.125 with SMTP id j58mr195218otd.18.1481904374798;
        Fri, 16 Dec 2016 08:06:14 -0800 (PST)
In-Reply-To: <67a9e9ed-8748-4098-a43b-33598b516464@isocpp.org>
X-Original-Sender: jmckesson@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: <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:29842
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/29842>

------=_Part_735_616581044.1481904374400
Content-Type: multipart/alternative; 
	boundary="----=_Part_736_1931310412.1481904374400"

------=_Part_736_1931310412.1481904374400
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

On Friday, December 16, 2016 at 10:46:28 AM UTC-5, Nicol Bolas wrote:
>
> On Friday, December 16, 2016 at 6:58:40 AM UTC-5, Jonathan Wakely wrote:
>>
>> On Friday, 16 December 2016 11:44:40 UTC, Jonathan M=C3=BCller wrote:
>>>
>>> So it transfers ownership when moving and does a deep copy when copying=
?
>>>
>>> I don't think two so different semantics are a great idea.
>>>
>>>
>>>
>> That seems to work for std::vector, and many other types.
>>
>
> I really think this needs to be emphasized. Cheap-move+deep-copy are=20
> hardly an uncommon set of semantics in C++. Every standard library=20
> container uses these semantics.
>
> The only question is how deep the copy goes: whether you're creating a `T=
`=20
> itself or some class derived from `T`.
>

Oh, and one more C++ standard library type that has these semantics: `any`.=
=20
It requires that the types provided are copyable, and on copying an `any`,=
=20
it will perform a copy (of the exact type provided, of course). However,=20
the move may be merely a pointer-shift (to support small object=20
optimization, `any`s that store objects with noexcept moves may use the=20
object's move constructor instead of the `any` pointer-shift).

--=20
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 e=
mail 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/ad1bfe2f-c769-4938-9f92-8f6b396f03e6%40isocpp.or=
g.

------=_Part_736_1931310412.1481904374400
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Friday, December 16, 2016 at 10:46:28 AM UTC-5, Nicol B=
olas 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">On=
 Friday, December 16, 2016 at 6:58:40 AM UTC-5, Jonathan Wakely wrote:<bloc=
kquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-lef=
t:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr">On Friday, 16 December =
2016 11:44:40 UTC, Jonathan M=C3=BCller  wrote:<blockquote class=3D"gmail_q=
uote" style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;paddin=
g-left:1ex"><p dir=3D"ltr">So it transfers ownership when moving and does a=
 deep copy when copying?</p>
<p dir=3D"ltr">I don&#39;t think two so different semantics are a great ide=
a.</p>
<p dir=3D"ltr"><br></p></blockquote><div><br></div><div>That seems to work =
for std::vector, and many other types.</div></div></blockquote><div><br>I r=
eally think this needs to be emphasized. Cheap-move+deep-copy are hardly an=
 uncommon set of semantics in C++. Every standard library container uses th=
ese semantics.<br><br>The only question is how deep the copy goes: whether =
you&#39;re creating a `T` itself or some class derived from `T`.<br></div><=
/div></blockquote><div><br>Oh, and one more C++ standard library type that =
has these semantics: `any`. It requires that the types provided are copyabl=
e, and on copying an `any`, it will perform a copy (of the exact type provi=
ded, of course). However, the move may be merely a pointer-shift (to suppor=
t small object optimization, `any`s that store objects with noexcept moves =
may use the object&#39;s move constructor instead of the `any` pointer-shif=
t).<br></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/ad1bfe2f-c769-4938-9f92-8f6b396f03e6%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/ad1bfe2f-c769-4938-9f92-8f6b396f03e6=
%40isocpp.org</a>.<br />

------=_Part_736_1931310412.1481904374400--

------=_Part_735_616581044.1481904374400--

.
