220 29823 <CAFk2RUb4-hGZq8ZDNR=eMv2erJK+8UH8Qj=SNeG+9DBW678Wkw@mail.gmail.com> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Ville Voutilainen <ville.voutilainen@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 14:11:48 +0200
Lines: 58
Approved: news@gmane.org
Message-ID: <CAFk2RUb4-hGZq8ZDNR=eMv2erJK+8UH8Qj=SNeG+9DBW678Wkw@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> <CAEddoJb9BfQzhoWxLz4-QvD-PkEupxucguMvQEETfcUM7Ed=JA@mail.gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-Trace: blaine.gmane.org 1481890315 512 195.159.176.226 (16 Dec 2016 12:11:55 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Fri, 16 Dec 2016 12:11:55 +0000 (UTC)
To: "ISO C++ Standard - Future Proposals" <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBC5JHI7A7ALRBBNUZ7BAKGQEZFLDASQ@isocpp.org Fri Dec 16 13:11:50 2016
Return-path: <std-proposals+bncBC5JHI7A7ALRBBNUZ7BAKGQEZFLDASQ@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-pg0-f71.google.com ([74.125.83.71])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBC5JHI7A7ALRBBNUZ7BAKGQEZFLDASQ@isocpp.org>)
	id 1cHrMY-0007Jy-FY
	for gclcip-std-proposals@m.gmane.org; Fri, 16 Dec 2016 13:11:46 +0100
Original-Received: by mail-pg0-f71.google.com with SMTP id q10sf179876580pgq.7
        for <gclcip-std-proposals@m.gmane.org>; Fri, 16 Dec 2016 04:11:51 -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
         :content-transfer-encoding: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=dOtMnjR/rokyThHgYymFvUn5R02soZ7gotoQZ5al2oM=;
        b=F9vPu8asJnlQ4J0xTxjJpenmWFGC/1neWc2tktvfcMc3b/tc+WJTfJ7frStrkNGckJ
         GcO44OAkMq4i6Yn9lFKCRc4PI0+MWh810TyxFFpnwkUnnggGULYuonb/pxoorN0ZUbzS
         a0GX4XK3IvD0UVerVaWPZ3+mTK2cW1X4gw4VL2Qk+HDtQqDi+3zO8QaZuPL2/lB79IlA
         TuVAHNEA+80K8QjeI55z3St9+a6/DbhzVlS27NHXGNJoDEM53pxDvJjRpW1LMO79ZGtW
         fVxLrOClfRQ/x0lLr+G2Od6PyFtpOme4fswDrwIAKpBzekRMml1zFlpQ9DfbDkKMLX6l
         rggA==
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:content-transfer-encoding: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=dOtMnjR/rokyThHgYymFvUn5R02soZ7gotoQZ5al2oM=;
        b=o4Ais/zEILfRa/zxHeeo6iDsdErtMRjW1sspo8mBuIDmf33fUFO5x0RN8X1UllfuR3
         O9MRh0DlqXv4G4jUWJd1RqXpZV2XV1BL7cRq8+G9Q1qGSsGnmANt0gbsedTwr9EW5lc/
         eG5xs7maXzmhhz5J/H4rZsLHunoGGC5FEmyNLycQC983uLKtwVZxh5NJH03IMLDLdr0T
         k12oeOhplQ5o0sd4d0PXnZ4i277rhkac6k/zqfdpKyL+SLFTAaDIIc2CBmg0Yg1tQJgg
         Q9Wa+6A7AKu9ypSAJAiqMsIGmTcprbAZzhj2LLUmykwi7PTDoP7WRI2wm6mkpEmvn4YU
         2qM 
X-Gm-Message-State: AKaTC00spy+5fH7Zof0YwU1T8Yqp1BmDmabEyeP43ruM6FkftWM4wLKx2fOf3N5nE9q14Q==
X-Received: by 10.99.138.202 with SMTP id y193mr1158646pgd.121.1481890310558;
        Fri, 16 Dec 2016 04:11:50 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.157.1.164 with SMTP id e33ls8164261ote.43.gmail; Fri, 16 Dec
 2016 04:11:49 -0800 (PST)
X-Received: by 10.176.1.112 with SMTP id 103mr1789278uak.154.1481890309154;
        Fri, 16 Dec 2016 04:11:49 -0800 (PST)
Original-Received: from mail-ua0-x234.google.com (mail-ua0-x234.google.com. [2607:f8b0:400c:c08::234])
        by mx.google.com with ESMTPS id j2si2137663uad.92.2016.12.16.04.11.49
        for <std-proposals@isocpp.org>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Fri, 16 Dec 2016 04:11:49 -0800 (PST)
Received-SPF: pass (google.com: domain of ville.voutilainen@gmail.com designates 2607:f8b0:400c:c08::234 as permitted sender) client-ip=2607:f8b0:400c:c08::234;
Original-Received: by mail-ua0-x234.google.com with SMTP id b35so8438799uaa.0
        for <std-proposals@isocpp.org>; Fri, 16 Dec 2016 04:11:49 -0800 (PST)
X-Received: by 10.176.65.33 with SMTP id j30mr2260123uad.94.1481890308777;
 Fri, 16 Dec 2016 04:11:48 -0800 (PST)
Original-Received: by 10.103.50.74 with HTTP; Fri, 16 Dec 2016 04:11:48 -0800 (PST)
In-Reply-To: <CAEddoJb9BfQzhoWxLz4-QvD-PkEupxucguMvQEETfcUM7Ed=JA@mail.gmail.com>
X-Original-Sender: ville.voutilainen@gmail.com
X-Original-Authentication-Results: mx.google.com;       dkim=pass
 header.i=@gmail.com;       spf=pass (google.com: domain of
 ville.voutilainen@gmail.com designates 2607:f8b0:400c:c08::234 as permitted
 sender) smtp.mailfrom=ville.voutilainen@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:29823
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/29823>

On 16 December 2016 at 14:05, Jonathan M=C3=BCller
<jonathanmueller.dev@gmail.com> wrote:
> 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 emp=
ty:
> 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 ownershi=
p.
> This also makes sense.
>
> Now, std::optional does not work with polymorphic objects. So I see a poi=
nt
> for a smart pointer with deep copying semantics. But then it should behav=
e
> 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 t=
he
> 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 operati=
on,
> 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 id=
ea.


That semantic difference allows doing noexcept moves, which ends up
being such a major
win that quite many people are able to tolerate this trade-off.

--=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/CAFk2RUb4-hGZq8ZDNR%3DeMv2erJK%2B8UH8Qj%3DSNeG%2=
B9DBW678Wkw%40mail.gmail.com.

.
