220 29822 <CAEddoJb9BfQzhoWxLz4-QvD-PkEupxucguMvQEETfcUM7Ed=JA@mail.gmail.com> article
Path: news.gmane.org!.POSTED!not-for-mail
From: =?UTF-8?Q?Jonathan_M=C3=BCller?= <jonathanmueller.dev@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 13:05:29 +0100
Lines: 92
Approved: news@gmane.org
Message-ID: <CAEddoJb9BfQzhoWxLz4-QvD-PkEupxucguMvQEETfcUM7Ed=JA@mail.gmail.com>
References: <13702f32-32c2-447f-9996-3624fd678675@isocpp.org>
 <CAFk2RUY3c67YgivjPTSCB+FLUGfiFgi8F_8kcSSUwPeBp9tMmw@mail.gmail.com>
 <CAEddoJZxM5qe9qVfags_iNrd0YpvUo2xmSw-OqifnHJ+4wJtxA@mail.gmail.com> <CAFk2RUZ9MjM=jCd2YkHHVjurPZB7mscgzbxnOjdLWqZStp0bBQ@mail.gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary=001a1144c922dd50ff0543c56286
X-Trace: blaine.gmane.org 1481889931 32147 195.159.176.226 (16 Dec 2016 12:05:31 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Fri, 16 Dec 2016 12:05:31 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCUMHC4Z6QGBBCVRZ7BAKGQETLILK3A@isocpp.org Fri Dec 16 13:05:27 2016
Return-path: <std-proposals+bncBCUMHC4Z6QGBBCVRZ7BAKGQETLILK3A@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-yb0-f200.google.com ([209.85.213.200])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCUMHC4Z6QGBBCVRZ7BAKGQETLILK3A@isocpp.org>)
	id 1cHrGQ-0007i4-Qq
	for gclcip-std-proposals@m.gmane.org; Fri, 16 Dec 2016 13:05:26 +0100
Original-Received: by mail-yb0-f200.google.com with SMTP id d128sf103565923ybh.6
        for <gclcip-std-proposals@m.gmane.org>; Fri, 16 Dec 2016 04:05:31 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=mime-version: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=kw1SpdwijuhaBIOE9IkKu8aOAnLBBuCNCc3BioKDNiI=;
        b=mZ+m9L/GSGGEaJRTYacCZEHezPqQnsxPry3QgGUnvIseTyVccO4Pu80tTfW8HIDB9v
         0q+qkqReJf6coSPBYI3So4m33yvqN8HFDmyoxlRA1blAm4pPhKnV72M0pFUXfO5OPNdv
         qqXZZISW72NUKSoC7GIljngAQJsNSyg/TMZqPHvJfh6Y/FtXnn/uKcYq2QgpZg4kcuZg
         VFr+5/UQU3frrZl0g57R0v5V7kFqkhZCYT5BpK0xfGLfmsyyZAxk07lUMUk9Q8bcI8Ir
         dibwcikC+g8sRyozRQ9qWAdtp4MPDLYI8S4Kh0UtyCYJUrE4rpKkWith/MBQxqvJsgx9
         aNCQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:mime-version: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=kw1SpdwijuhaBIOE9IkKu8aOAnLBBuCNCc3BioKDNiI=;
        b=S6UCYjsuuwyKUL2eK92l30cbfrYtLEHjtFHc6/fT99kpvFMALQ2ZQDnq4455AKnzBF
         np9mZBAzsc8ATvDlJiDzlSrtWUm6PbboMDRTz3L6OQkFAKq6/m8uwr70AsVOga5lpr+S
         1v56qVhRVX7GwFNVW7WtNnuz7Nmk3FQGjA1BSAnlwu7qXy28PKe5OCcIJw7k+z+IK5iu
         o6NQOjFblKbKGabVqwb029LZkIAsXo/JeD/11GEmF8bbaRcQ2/VxdrBAnTsPHO59Aok6
         VgZX0XAm4a49WRfMteyGHwj1gKI3R8LHMX0W/d8G4CZl4nIuZO+JcFOlSer1NjLGspMY
         cKtA==
X-Gm-Message-State: AKaTC03joXtgLfWSMCatxS9PjvyPNzRqdu86xoWfBEjt/NTRHQj+7Q+is94C57S0QCMFCA==
X-Received: by 10.129.137.6 with SMTP id z6mr652592ywf.137.1481889930952;
        Fri, 16 Dec 2016 04:05:30 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.157.24.9 with SMTP id b9ls8891666ote.15.gmail; Fri, 16 Dec
 2016 04:05:30 -0800 (PST)
X-Received: by 10.55.23.213 with SMTP id 82mr2264898qkx.40.1481889930289;
        Fri, 16 Dec 2016 04:05:30 -0800 (PST)
Original-Received: from mail-qk0-x22b.google.com (mail-qk0-x22b.google.com. [2607:f8b0:400d:c09::22b])
        by mx.google.com with ESMTPS id x58si2981337qtx.289.2016.12.16.04.05.30
        for <std-proposals@isocpp.org>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Fri, 16 Dec 2016 04:05:30 -0800 (PST)
Received-SPF: pass (google.com: domain of jonathanmueller.dev@gmail.com designates 2607:f8b0:400d:c09::22b as permitted sender) client-ip=2607:f8b0:400d:c09::22b;
Original-Received: by mail-qk0-x22b.google.com with SMTP id n204so88231581qke.2
        for <std-proposals@isocpp.org>; Fri, 16 Dec 2016 04:05:30 -0800 (PST)
X-Received: by 10.55.33.2 with SMTP id h2mr2272741qkh.230.1481889929841; Fri,
 16 Dec 2016 04:05:29 -0800 (PST)
Original-Received: by 10.55.74.202 with HTTP; Fri, 16 Dec 2016 04:05:29 -0800 (PST)
Original-Received: by 10.55.74.202 with HTTP; Fri, 16 Dec 2016 04:05:29 -0800 (PST)
In-Reply-To: <CAFk2RUZ9MjM=jCd2YkHHVjurPZB7mscgzbxnOjdLWqZStp0bBQ@mail.gmail.com>
X-Original-Sender: jonathanmueller.dev@gmail.com
X-Original-Authentication-Results: mx.google.com;       dkim=pass
 header.i=@gmail.com;       spf=pass (google.com: domain of
 jonathanmueller.dev@gmail.com designates 2607:f8b0:400d:c09::22b as permitted
 sender) smtp.mailfrom=jonathanmueller.dev@gmail.com;       dmarc=pass (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-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:29822
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/29822>

--001a1144c922dd50ff0543c56286
Content-Type: text/plain; charset=UTF-8

On Dec 16, 2016 12:48, "Ville Voutilainen" <ville.voutilainen@gmail.com>
wrote:
>
> Right, and I think My Little Pony is under-appreciated, but if I
> really want to convey useful information to anyone,
> I explain why. Those semantics happen to be superior to the alternatives.

Take std::optional, when you move it the old optional will not become
empty: move does basically the same as copy, just uses T's copy instead of
move constructor.
And this behavior makes sense: optional<T> is supposed to behave like a T.

std::unique_ptr on the other hand is only moveable and transfers ownership.
This also makes sense.

Now, std::optional does not work with polymorphic objects. So I see a point
for a smart pointer with deep copying semantics. But then it should behave
like the type so moving should also da a "move clone".

Now consider a smart pointer with deep copying semantics but ownership
transfer on move: What is it supposed to model? It does not behave like the
type T as moving does something different.

Consider using the pointer with a type that is only copyable. If you have
code that takes a reference directly and (somehow) invokes a move
operation, the move will copy, so it is safe to use moved-from object
there. But if you use that with this smart pointer, it is not safe anymore,
as the pointer will become null.

I personally think that this kind of semantic difference is not a good idea.

-- 
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/CAEddoJb9BfQzhoWxLz4-QvD-PkEupxucguMvQEETfcUM7Ed%3DJA%40mail.gmail.com.

--001a1144c922dd50ff0543c56286
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<p dir=3D"ltr">On Dec 16, 2016 12:48, &quot;Ville Voutilainen&quot; &lt;<a =
href=3D"mailto:ville.voutilainen@gmail.com">ville.voutilainen@gmail.com</a>=
&gt; wrote:<br>
&gt;<br>
&gt; Right, and I think My Little Pony is under-appreciated, but if I<br>
&gt; really want to convey useful information to anyone,<br>
&gt; I explain why. Those semantics happen to be superior to the alternativ=
es.</p>
<p dir=3D"ltr">Take std::optional, when you move it the old optional will n=
ot become empty: move does basically the same as copy, just uses T&#39;s co=
py instead of move constructor.<br>
And this behavior makes sense: optional&lt;T&gt; is supposed to behave like=
 a T.</p>
<p dir=3D"ltr">std::unique_ptr on the other hand is only moveable and trans=
fers ownership. This also makes sense.</p>
<p dir=3D"ltr">Now, std::optional does not work with polymorphic objects. S=
o I see a point for a smart pointer with deep copying semantics. But then i=
t should behave like the type so moving should also da a &quot;move clone&q=
uot;.</p>
<p dir=3D"ltr">Now consider a smart pointer with deep copying semantics but=
 ownership transfer on move: What is it supposed to model? It does not beha=
ve like the type T as moving does something different.</p>
<p dir=3D"ltr">Consider using the pointer with a type that is only copyable=
.. If you have code that takes a reference directly and (somehow) invokes a =
move operation, the move will copy, so it is safe to use moved-from object =
there. But if you use that with this smart pointer, it is not safe anymore,=
 as the pointer will become null.</p>
<p dir=3D"ltr">I personally think that this kind of semantic difference is =
not a good idea.</p>

<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/CAEddoJb9BfQzhoWxLz4-QvD-PkEupxucguMv=
QEETfcUM7Ed%3DJA%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">h=
ttps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAEddoJb9BfQzho=
WxLz4-QvD-PkEupxucguMvQEETfcUM7Ed%3DJA%40mail.gmail.com</a>.<br />

--001a1144c922dd50ff0543c56286--

.
