220 29831 <c8c29792-37a9-2eb1-1a5e-69ccfe247661@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:36:33 +0100
Lines: 42
Approved: news@gmane.org
Message-ID: <c8c29792-37a9-2eb1-1a5e-69ccfe247661@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>
 <CAFk2RUb4-hGZq8ZDNR=eMv2erJK+8UH8Qj=SNeG+9DBW678Wkw@mail.gmail.com>
 <CAEddoJbQAx5Pne+qu4A92Pd=NgiLQsj8auGuJHeZiKmz1fouQg@mail.gmail.com>
 <CAFk2RUZ-Xm2cQ6jCwQaSAhF+sCudqnHeivrJvqCQ4mhKv9rN+g@mail.gmail.com>
 <CAEddoJZ+AR_UC_xheJnkn4yBg7iny3_BHNXHOa1M1+iZEpuqiQ@mail.gmail.com>
 <CAFk2RUYq+_To254SGVAesMfZtFJDLSVmLvU=U3bhBq83xZdA1w@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; format=flowed
X-Trace: blaine.gmane.org 1481891798 25266 195.159.176.226 (16 Dec 2016 12:36:38 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Fri, 16 Dec 2016 12:36:38 +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+bncBCUMHC4Z6QGBBU57Z7BAKGQE7UBQBXQ@isocpp.org Fri Dec 16 13:36:33 2016
Return-path: <std-proposals+bncBCUMHC4Z6QGBBU57Z7BAKGQE7UBQBXQ@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-wj0-f200.google.com ([209.85.210.200])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCUMHC4Z6QGBBU57Z7BAKGQE7UBQBXQ@isocpp.org>)
	id 1cHrkW-0005Sy-AH
	for gclcip-std-proposals@m.gmane.org; Fri, 16 Dec 2016 13:36:32 +0100
Original-Received: by mail-wj0-f200.google.com with SMTP id xr1sf34706646wjb.7
        for <gclcip-std-proposals@m.gmane.org>; Fri, 16 Dec 2016 04:36:37 -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=zYy1FpKaXiXck+e6LmOL/31gYG2JYQspDgwEpekZxyI=;
        b=Q7cVsFLPJgLYtqmXbWVC5qxKMdiShRlU48k9z3cmel93cKWs+GvwcnfcNyEiqw1Jfo
         ZinT3JYZ4DuBUVeYxZF3OQDbftVx+6RPxELn7h/3SQOIxkGWl79lZGJq5/SMREPByj8O
         I4+GbEeicfPR1tIsRIoBPntIFoV9xeJhqIJY/hW5iPMLqiBEassKz8lcdzr3YSVWkX8t
         TZn+bqpTgYzd0o4ikl9ZLaYU06eektWKeVmSPVEXNHfzm3MJ2eS5bHu6pxqB7Ljp3Ltz
         Ar1DU6SItVLaqJMyrsa/1tFNd8eeG52WLw5FzEAtIWYOynDowA1yW4b0UHR4GOb0oTMn
         5GYw==
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=zYy1FpKaXiXck+e6LmOL/31gYG2JYQspDgwEpekZxyI=;
        b=YLsjlBH/Xor5U7XX0IoHRbI1/ILxmr6iLtiRzTjJYFgSSrRWL+wkt5WqWNb2L2fshq
         c33Qi4eHjgQ2+5QLD031LTlv+rnO5XGsA7C9Q6/QtOXNR1y4PF1Ab8qRzhvgHnVbaGLx
         GmmQav2DhHaop5QR9CtPRT1geNTreLgxrcprPGLniMFt6LtVYJphCiAEBQVZfxJOi0Cs
         yRK+bGP6G11XrVzA/rQfsyV6qgXsJSM7oyOb9JGnC2RxTBUPGxBklwhLj3XIHAcERQiu
         fC4wmyVWaUzbNxxE/nmJaXcumEquVP+oTgik2E0/K7a1P5BYtBxxsUxNIn1d8JoW9CLF
         ZvSA==
X-Gm-Message-State: AIkVDXIkBhkzMJ3RSUcD/Q8AUMo5OQQ83oyjtjsAu08U/WZgq5WyET/Qb1Xdff0ybHUb3g==
X-Received: by 10.46.77.66 with SMTP id a63mr228635ljb.22.1481891796888;
        Fri, 16 Dec 2016 04:36:36 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.28.18.133 with SMTP id 127ls294700wms.10.canary-gmail; Fri, 16
 Dec 2016 04:36:35 -0800 (PST)
X-Received: by 10.194.93.104 with SMTP id ct8mr3009834wjb.87.1481891795456;
        Fri, 16 Dec 2016 04:36:35 -0800 (PST)
Original-Received: from mail-wj0-x243.google.com (mail-wj0-x243.google.com. [2a00:1450:400c:c01::243])
        by mx.google.com with ESMTPS id aj4si6818004wjd.196.2016.12.16.04.36.35
        for <std-proposals@isocpp.org>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Fri, 16 Dec 2016 04:36:35 -0800 (PST)
Received-SPF: pass (google.com: domain of jonathanmueller.dev@gmail.com designates 2a00:1450:400c:c01::243 as permitted sender) client-ip=2a00:1450:400c:c01::243;
Original-Received: by mail-wj0-x243.google.com with SMTP id kp2so14391803wjc.0
        for <std-proposals@isocpp.org>; Fri, 16 Dec 2016 04:36:35 -0800 (PST)
X-Received: by 10.195.14.7 with SMTP id fc7mr2790678wjd.198.1481891794992;
        Fri, 16 Dec 2016 04:36:34 -0800 (PST)
Original-Received: from [134.61.95.229] (095-229.eduroam.rwth-aachen.de. [134.61.95.229])
        by smtp.gmail.com with ESMTPSA id w18sm3192457wme.9.2016.12.16.04.36.34
        for <std-proposals@isocpp.org>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Fri, 16 Dec 2016 04:36:34 -0800 (PST)
In-Reply-To: <CAFk2RUYq+_To254SGVAesMfZtFJDLSVmLvU=U3bhBq83xZdA1w@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 2a00:1450:400c:c01::243 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:29831
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/29831>

On 16.12.2016 13:25, Jonathan Wakely wrote:
 >  p0201r1 deals with that problem, which is why it's a better approach.

On 16.12.2016 13:28, Ville Voutilainen wrote:
 > Like the proposed std::indirect? I got the impression that its latest
 > feedback was to move it
 > closer to value semantics of a polymorphic type.

Yeah, exactly. I like `std::indirect`, it behaves like a `T` and has 
consistent semantics.

> But I do, otherwise I wouldn't have chosen a cloned_ptr.

Alright, hard to argue with that and I get your arguments.

I just don't think that's particularly "clean".
If the type wasn't polymorphic you'd embed it as a member directly,
so copying will copy all members and moving will move all members.
But if you change it to use a polymorphic type you use a cloning_ptr,
so copy will still copy everything but moving will suddenly leave the 
type with an "empty" member?
I wouldn't like using that struct with that change.

There might be a possible use case for cloning_ptr,
but I don't think its as a member.
And if you don't use it is a member,
you don't need a copy constructor but can use a free function.

> All pointers are a mix between "optional" and something else since
> they can be null. And that's
> just fine for many cases.

I meant on a semantic point of view: mix between value semantics and 
ownership transfer.


-- 
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/c8c29792-37a9-2eb1-1a5e-69ccfe247661%40gmail.com.

.
