220 29868 <20161217141109.GA22645@manuel-ThinkPad-L440.localdomain> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Manuel Bergler <berglerma@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: New smart pointer: CopyConstructible and
 CopyAssignable flavor of unique_ptr
Date: Sat, 17 Dec 2016 15:11:09 +0100
Lines: 103
Approved: news@gmane.org
Message-ID: <20161217141109.GA22645@manuel-ThinkPad-L440.localdomain>
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>
 <ad1bfe2f-c769-4938-9f92-8f6b396f03e6@isocpp.org>
 <e30ffb82-0d5f-fafd-39b4-28e60d07c948@gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha256;
	protocol="application/pgp-signature"; boundary="nFreZHaLTZJo0R7j"
X-Trace: blaine.gmane.org 1481983924 24186 195.159.176.226 (17 Dec 2016 14:12:04 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Sat, 17 Dec 2016 14:12:04 +0000 (UTC)
User-Agent: Mutt/1.5.24 (2015-08-30)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBDOZBAUFX4MRBLEP2XBAKGQE5SODU3I@isocpp.org Sat Dec 17 15:11:54 2016
Return-path: <std-proposals+bncBDOZBAUFX4MRBLEP2XBAKGQE5SODU3I@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-lf0-f69.google.com ([209.85.215.69])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBDOZBAUFX4MRBLEP2XBAKGQE5SODU3I@isocpp.org>)
	id 1cIFiL-0004NV-2m
	for gclcip-std-proposals@m.gmane.org; Sat, 17 Dec 2016 15:11:53 +0100
Original-Received: by mail-lf0-f69.google.com with SMTP id c13sf15476795lfg.4
        for <gclcip-std-proposals@m.gmane.org>; Sat, 17 Dec 2016 06:11:57 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=date:from:to:subject:message-id:references:mime-version
         :content-disposition:in-reply-to:user-agent: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=ZgV5sLVH5OOAGuBTdJZfaIqXwvFLw3B4Dtwb7XNPHag=;
        b=icYtDxPShxlJGNKtPGKT8aUcx9UuRkl4F7J4Ie0HngI4HU1vC38BXvOCYq2xWugoZ3
         X9nTe2edLKM67995FyvEnGQs0uhuTCbP50przZmEoIQ78zGflk6pahhn7JcKP4zP5/1e
         mekYyhvLBEP3vyxC62ngqSPZy0pKJL1dntcNy3X2KWH9nlQxQ+7S8+fM1tPWjXlWutQw
         MhasWZJJsANEXzre76kHMJdBt+9+hLA/u7icJ7cGa9tTP9uDb1eYLlKdrTAgVn28Jrzi
         bBIyDAMijE9JJFLjZUwXXkVt47bAIqSyPHSJJxXIGAK9ZWFyaXFb1uSVcOiv5P380ly1
         PP 
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:subject:message-id:references
         :mime-version:content-disposition:in-reply-to:user-agent
         :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=ZgV5sLVH5OOAGuBTdJZfaIqXwvFLw3B4Dtwb7XNPHag=;
        b=Q7VPIEaZtso1Wi0s4+dumdFA3B9GuhAocKQeY+gnJnpFUnm5DbnykH7idcjVD/7wc6
         5wzXulA/glCpiguXt/o5fQJ3KqouZWNhDZZC5y+bVsIQSExAT/9Wot6mtn0MBhr5rF7q
         6B0rDvyH7SUMzBJuOzU/b+rf+sSE6/jhhghOHzmXUp8NV0cifuJXKl6R8GuRTfP7zOIv
         pX2zdxyviwcbRfw2laRtCCPKWew1sCVfgQLAJ/+u3Fq/pFO/n0fhmwnJNWJLNEIHgJPK
         ++tyOraRX7kaz5KcOVI6H3WxGjhwLBF9QQfP9AtGHiiYaAE96UNICDbo6GP64Po2xW33
        
X-Gm-Message-State: AKaTC00dpsm05bVO04KyxOt1pgw34Gls7NOusz1vPfDH6kgitJz38FwBm7rz9XpNKnr2kw==
X-Received: by 10.25.74.14 with SMTP id x14mr641149lfa.0.1481983917556;
        Sat, 17 Dec 2016 06:11:57 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.28.154.138 with SMTP id c132ls672878wme.6.gmail; Sat, 17 Dec
 2016 06:11:56 -0800 (PST)
X-Received: by 10.28.234.85 with SMTP id i82mr6900827wmh.6.1481983916444;
        Sat, 17 Dec 2016 06:11:56 -0800 (PST)
Original-Received: from mail-wj0-x244.google.com (mail-wj0-x244.google.com. [2a00:1450:400c:c01::244])
        by mx.google.com with ESMTPS id a5si11885188wji.77.2016.12.17.06.11.56
        for <std-proposals@isocpp.org>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Sat, 17 Dec 2016 06:11:56 -0800 (PST)
Received-SPF: pass (google.com: domain of berglerma@gmail.com designates 2a00:1450:400c:c01::244 as permitted sender) client-ip=2a00:1450:400c:c01::244;
Original-Received: by mail-wj0-x244.google.com with SMTP id xy5so17893451wjc.1
        for <std-proposals@isocpp.org>; Sat, 17 Dec 2016 06:11:56 -0800 (PST)
X-Received: by 10.194.52.42 with SMTP id q10mr6714433wjo.50.1481983915890;
        Sat, 17 Dec 2016 06:11:55 -0800 (PST)
Original-Received: from localhost (x5d856f73.dyn.telefonica.de. [93.133.111.115])
        by smtp.gmail.com with ESMTPSA id l74sm8221733wmg.2.2016.12.17.06.11.55
        for <std-proposals@isocpp.org>
        (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
        Sat, 17 Dec 2016 06:11:55 -0800 (PST)
Content-Disposition: inline
In-Reply-To: <e30ffb82-0d5f-fafd-39b4-28e60d07c948@gmail.com>
X-Original-Sender: berglerma@gmail.com
X-Original-Authentication-Results: mx.google.com;       dkim=pass
 header.i=@gmail.com;       spf=pass (google.com: domain of
 berglerma@gmail.com designates 2a00:1450:400c:c01::244 as permitted sender)
 smtp.mailfrom=berglerma@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:29868
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/29868>


--nFreZHaLTZJo0R7j
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Sean Parent gave a talk[1] at Code::Dive this year where he talks about the
problems of such a clone_ptr type.

(He actually starts with a clone_ptr that was proposed to the Standards Com=
mittee
but is different to the one proposed here, but then discussing alternatives
that might seem reasonable)

Best
Manuel

[1] https://youtu.be/cK_kftBNgBc?t=3D40m45s

On Sat, Dec 17, 2016 at 02:52:08PM +0100, Jonathan M=C3=BCller wrote:
>On 16.12.2016 17:06, Nicol Bolas wrote:
>>
>>
>>    I really think this needs to be emphasized. Cheap-move+deep-copy are
>>    hardly an uncommon set of semantics in C++. Every standard library
>>    container uses these semantics.
>>
>
>
>>
>>Oh, and one more C++ standard library type that has these semantics:
>>`any`. It requires that the types provided are copyable, and on copying
>>an `any`, it will perform a copy (of the exact type provided, of
>>course). However, the move may be merely a pointer-shift (to support
>>small object optimization, `any`s that store objects with noexcept moves
>>may use the object's move constructor instead of the `any` pointer-shift)=
..
>>
>
>Exactly, every standard library *container* uses these semantics.
>`std::any` is a container of a single type, so it also uses these
>semantics. And this behavior makes sense, for a container.
>
>Now `std::optional` and the proposed `std::indirect` are not containers,
>they behave like a single value, hence their copy/move forward to `T`s
>copy/move. This behavior also makes sense.
>
>Now the copy_ptr here with mixed copy/move would also be a container
>- a container of a single type or derived class or something like that.
>I don't really see a use for such a container, but alright.
>
>But the proposed copy_ptr is not really a smart pointer,
>none of the other smart pointers do such things,
>they simply manage the lifetime of an object.
>
>This is all my opinion and you're free to ignore me,
>but I think this distinction is important.
>
>Jonathan
>
>
>--
>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/isocp=
p.org/d/msgid/std-proposals/e30ffb82-0d5f-fafd-39b4-28e60d07c948%40gmail.co=
m.

--=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/20161217141109.GA22645%40manuel-ThinkPad-L440.lo=
caldomain.

--nFreZHaLTZJo0R7j
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEi3F6I6jTgMCHgGvofAJ3kFaTK3oFAlhVR3AACgkQfAJ3kFaT
K3pCtBAArO9aHVXdjv/wcdKLfkMObaBNtXGiSMjOgqcC7hnZCfXSyYPlL2HK/H93
I44OmBdiAipexzvK+MWNaFqdEh3hATFYG5A1LeWmXTeLP8kH8sunR7Kjzn0iNS5X
KCdAThfdrqr2vUv/6R7QL/2XC1hUuq+zYVLnIrwhnat1RwDzi6/GtYMwvLsEdAkT
RU36+fpoxUFB1u32SZRpK70p0hpO99XGyq9a+vnO2EBBRFNlp3qnn6TfIkU7sKSu
cge1WbmQ9M59B85CkCuZNHfdz70aPv98kgs9uNgF+jUrlSwv3ieS+cLS9cEJLCJk
yrUTF36exUgB24y6uw7rRCTd/oM4kBdaGUtdZoXu7VKvko8+gNw3ROKs7Vt+tD/z
FvZbqbBh8cxJueqiGnHM+6OC7atcgh3WcFJJilq+vzaY3gYpifOVPJa8wsgWmjh9
5hX3WzIfGGgUCMD+eqn2e++Mwke6Nbufq+zCi4yCZK30cV3lrMtUzYOkB98XkWdZ
UWVHP77ZrHsF7o1AfuQWJafhGuSileVmWgGFB1qIGNCtQxnwSphbY0b9BaQV6aO2
IZG33D+PRYu81WUvfNrcIIiUNOpU3wDEBMuWBmLdbZVTOXvU8GP8Bjm7p/Jbr2vX
VrVtonRy2R0yUfbIvCBq/b6fZ37Vja0iWziID+NEo1KCr+M72Hs=
=Sf/a
-----END PGP SIGNATURE-----

--nFreZHaLTZJo0R7j--

.
