220 29867 <e30ffb82-0d5f-fafd-39b4-28e60d07c948@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: Sat, 17 Dec 2016 14:52:08 +0100
Lines: 46
Approved: news@gmane.org
Message-ID: <e30ffb82-0d5f-fafd-39b4-28e60d07c948@gmail.com>
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>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
X-Trace: blaine.gmane.org 1481982733 24055 195.159.176.226 (17 Dec 2016 13:52:13 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Sat, 17 Dec 2016 13:52:13 +0000 (UTC)
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
 Thunderbird/45.5.1
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCUMHC4Z6QGBBCUG2XBAKGQEP3LU35I@isocpp.org Sat Dec 17 14:52:08 2016
Return-path: <std-proposals+bncBCUMHC4Z6QGBBCUG2XBAKGQEP3LU35I@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+bncBCUMHC4Z6QGBBCUG2XBAKGQEP3LU35I@isocpp.org>)
	id 1cIFPC-0005LT-PT
	for gclcip-std-proposals@m.gmane.org; Sat, 17 Dec 2016 14:52:06 +0100
Original-Received: by mail-lf0-f69.google.com with SMTP id b14sf15264604lfg.6
        for <gclcip-std-proposals@m.gmane.org>; Sat, 17 Dec 2016 05:52:11 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=subject:to:references:from:message-id:date:user-agent:mime-version
         :in-reply-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=3Nd0mQ5exF8QAbeSB4mz8hGAvw5OL5O/pG+z3Reap3A=;
        b=Hcn7CWReqEHtS8BnWSprF96nSD8wwCxSkQ7aP6E6IKJDNRJxZXCNpGrosJo1a9ZHIz
         pOUJBbG5LiIt01z0by+MJdaXLmWVtkge/+W6Svgtn7fbKagMqQv+rPO4AMxSTwpmIxFY
         VA1O+tLfJ10Jpa4ZeRaVZdpbGwhLGlEd+8Pkz/MUMt+vvwsLpfeq4nKcEPltkMma7Bmy
         a7oJk8CrttjWQcBrfd85kCAd0FcsKhvHJPrdst9KdT3LqY/vuxsdT+PwdngrN3GI9uC7
         5QZ+r8+NmuETR27sLpNdV0GIwoUt0/A3RfspAbE4h7BVC5NqRboVH+8e6QcO3qqwoZ89
         9P0Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:subject:to:references:from:message-id:date
         :user-agent:mime-version:in-reply-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=3Nd0mQ5exF8QAbeSB4mz8hGAvw5OL5O/pG+z3Reap3A=;
        b=WjLsbtZzvPFiRk0iukxjOAx7KEAZzcJAhhC+sLjsaK64FVO1e+Elp4CNxNJQspfOBc
         hGvZnxwna6MhDXywSrvc3lpszORRbyxbLw0M+xWnUYmGacsV1TYpQGUBh4aJc93wJ6yp
         R8zQRqAFPrRt4/gB2EiOdeMqFy4/6kU9aCO6LvVyTqnATiXiL+zZ6eTD1r4VOj51/sah
         NK9QUpBU2iKycjVN72g8/wFZLN3qBGo2+rDol6kUjZz6PdXzmw4pwcajAdGf9Gl4HurJ
         vYPC0RFvmLNos1euAlPB6dh3uDaVKyC5Xv8jLvOtSLd0f4Mo5PsCh1GPDBaV1xEVItmE
         9BTA==
X-Gm-Message-State: AIkVDXLiUDRq+yTE9JbctbT/c2/cG2t3pbhwlLxaH3SwrPK9KWr1QQwoIpJiRZYv1CRSLw==
X-Received: by 10.46.77.93 with SMTP id a90mr747750ljb.16.1481982731413;
        Sat, 17 Dec 2016 05:52:11 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.28.31.137 with SMTP id f131ls658367wmf.21.gmail; Sat, 17 Dec
 2016 05:52:10 -0800 (PST)
X-Received: by 10.28.26.80 with SMTP id a77mr6363787wma.31.1481982730329;
        Sat, 17 Dec 2016 05:52:10 -0800 (PST)
Original-Received: from mail-wm0-x242.google.com (mail-wm0-x242.google.com. [2a00:1450:400c:c09::242])
        by mx.google.com with ESMTPS id qq8si11814938wjc.143.2016.12.17.05.52.10
        for <std-proposals@isocpp.org>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Sat, 17 Dec 2016 05:52:10 -0800 (PST)
Received-SPF: pass (google.com: domain of jonathanmueller.dev@gmail.com designates 2a00:1450:400c:c09::242 as permitted sender) client-ip=2a00:1450:400c:c09::242;
Original-Received: by mail-wm0-x242.google.com with SMTP id a20so10408321wme.2
        for <std-proposals@isocpp.org>; Sat, 17 Dec 2016 05:52:10 -0800 (PST)
X-Received: by 10.28.139.12 with SMTP id n12mr6474346wmd.79.1481982729775;
        Sat, 17 Dec 2016 05:52:09 -0800 (PST)
Original-Received: from [192.168.1.98] (dslb-084-060-205-232.084.060.pools.vodafone-ip.de. [84.60.205.232])
        by smtp.gmail.com with ESMTPSA id cl10sm11624309wjb.4.2016.12.17.05.52.09
        for <std-proposals@isocpp.org>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Sat, 17 Dec 2016 05:52:09 -0800 (PST)
In-Reply-To: <ad1bfe2f-c769-4938-9f92-8f6b396f03e6@isocpp.org>
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 2a00:1450:400c:c09::242 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:29867
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/29867>

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/isocpp.org/d/msgid/std-proposals/e30ffb82-0d5f-fafd-39b4-28e60d07c948%40gmail.com.

.
