220 29147 <6d03522b-39f0-4d96-8384-ef9210122168@isocpp.org> article
Path: news.gmane.org!.POSTED!not-for-mail
From: joseph.thomson@gmail.com
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Re: [propagate_const] Implicit conversion to T
Date: Wed, 26 Oct 2016 21:52:35 -0700 (PDT)
Lines: 282
Approved: news@gmane.org
Message-ID: <6d03522b-39f0-4d96-8384-ef9210122168@isocpp.org>
References: <1f43ffe8-b267-4c8c-8834-f3e60035f18d@isocpp.org>
 <aeae0bb0-aa8e-4c84-90ea-45cea4aa1b25@isocpp.org> <bcba393d-6c88-42ca-88ca-fbda08d49758@isocpp.org>
 <b53d5d2e-35cb-4f55-8ce6-6f7fe926c428@isocpp.org> <a51760a2-b976-4ef6-9214-bba82af80b79@isocpp.org>
 <bebb500d-5b71-48e5-8878-0e5fae129c41@isocpp.org> <5c682d18-9cf2-4a80-9e58-6b8fae2cf7e8@isocpp.org>
 <c431c094-9a24-481f-aaea-e66950a7ccb9@isocpp.org> <20161023161002.4911185.19138.19005@gmail.com>
 <08231f25-9d2b-40be-a79e-92225a0b0336@isocpp.org> <20161023175710.4911185.4764.19015@gmail.com>
 <8EE69808-0C9A-4825-B834-375CDBA8FAC5@gmail.com> <f88b96df-e3b2-4845-98d9-05c216cf47c3@isocpp.org>
 <CAAbBDD-V=349D4YFS26_Z2Fg-0tDKvCdtKxcJgf3in9yaUEf0g@mail.gmail.com>
 <b11f0d55-280a-4ff0-b6c2-9f197337364f@isocpp.org> <CAFk2RUaHWiVFia7_1WfOGVjNFX717xoZc_u=ZA-cApWUFfD-sA@mail.gmail.com>
 <0921ce76-4294-460d-9bd4-ad2816741b10@isocpp.org> <CAFk2RUbamO38vehB54iTGvL9Nyu9DjniYi5bAw6muNLuODLBsg@mail.gmail.com>
 <e872629c-88cd-4355-a1fa-429196668936@isocpp.org> <CAFk2RUZRDT+D6W4=LkNAYSikXNP0opOtFcq9gPSymN8RzGMX-w@mail.gmail.com>
 <80EB0663-B834-488C-85A7-2767F6196BCF@gmail.com>
 <754c5bb6-b821-4565-8dd0-76c1fb2b5a7a@isocpp.org>
 <01eb6560-8902-40e3-af54-c395f3d3d33d@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_278_933223176.1477543956105"
X-Trace: blaine.gmane.org 1477543964 11605 195.159.176.226 (27 Oct 2016 04:52:44 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Thu, 27 Oct 2016 04:52:44 +0000 (UTC)
Cc: joseph.thomson@gmail.com, mihailnajdenov@gmail.com
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBDQM7AFVVUERBFMQY3AAKGQEFNR4K4A@isocpp.org Thu Oct 27 06:52:39 2016
Return-path: <std-proposals+bncBDQM7AFVVUERBFMQY3AAKGQEFNR4K4A@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-oi0-f70.google.com ([209.85.218.70])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBDQM7AFVVUERBFMQY3AAKGQEFNR4K4A@isocpp.org>)
	id 1bzcg8-0002Dj-NH
	for gclcip-std-proposals@m.gmane.org; Thu, 27 Oct 2016 06:52:37 +0200
Original-Received: by mail-oi0-f70.google.com with SMTP id e12sf42882851oib.5
        for <gclcip-std-proposals@m.gmane.org>; Wed, 26 Oct 2016 21:52:39 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=date:from:to:cc:message-id:in-reply-to:references:subject
         :mime-version:x-original-sender:reply-to:precedence:mailing-list
         :list-id:x-spam-checked-in-group:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=jh54j3cMCtzkFzG2Fq5hCI8dp5g8iLmtqT/0IZJuxXY=;
        b=lqinNPI94p3C6zRlAt5ZEixBU+HbTXH2WJWEPJUbMfC0lhLN6rnXoAqtujBBHAtFLb
         oOT0RqIOlwqDXq6WREqePEHAPbqBSJMaicJF7Mdg5pGWlK9JV13BqPoQ5EgkYgo1Ujjn
         m0Z1YsQrq7dx2DoZIhCXN7pt3QDo8DYDr4Yi+MP8tsE/keppqLGRR6hUVIBLpKCxiMXw
         tKA2OEZ+5o2cqd2GTwEIQLleaDb/fyKt+tf+C5h0rexbwy2sqI5DNwFCQGYZ3T6hDf67
         yXrv5eLevoF4lSaM9e3Xy36dQeDkjgu1hTip9j6GMMouunAo+UBAJ3jJaK1iqT2WJdMh
         aHAQ==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=date:from:to:cc:message-id:in-reply-to:references:subject
         :mime-version:x-original-sender:reply-to:precedence:mailing-list
         :list-id:x-spam-checked-in-group:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=jh54j3cMCtzkFzG2Fq5hCI8dp5g8iLmtqT/0IZJuxXY=;
        b=BT3LtVYHl72gN6YGQi1fjI/DKueBRH4xul51aIWJwAeE62c0U1MnYdoPxPkjN7TLAp
         RQ/SqJhzjpgiWbttzdh6jEan7dc2KizHFkZfJT8oQDxilGveVC63irVno/AGv2QpIvvH
         G2okQGtU1yaoRqvXADEYkvtXZfQQuzrJHtloYbCS84tAKR8vkpSufPRPjePxCY9ZuwXu
         oAhYmwdReddfir1NuVJuj/dzzVy1H2JWe1mn6u6W74kxsHDNV/hTuxzJcN3XcSjKx5ny
         /itBR9VFbRHUp+oXNuqZozL4dL/JYZp9MbcfnPY+N5SS3jq4M8uyhXfa+fJJxI0jIxXr
         sEeA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:date:from:to:cc:message-id:in-reply-to
         :references:subject:mime-version:x-original-sender:reply-to
         :precedence:mailing-list:list-id:x-spam-checked-in-group:list-post
         :list-help:list-archive:list-subscribe:list-unsubscribe;
        bh=jh54j3cMCtzkFzG2Fq5hCI8dp5g8iLmtqT/0IZJuxXY=;
        b=UhDxt8MUC0XcvDt995bQ2M2/A9DHrZRh8EWGuUktvjzkbJdMQHUKsoRrN4zNJx93y5
         qM/OgmCGS8wEMpf/NKFAf9Ku/UUw/muCSw9yno2Nobt9MQgSAlAsFJTn3qyuZPaxAruU
         76Gdh83mFKRRUajrYK9MaUCZ1O2l53wbunMG3rQiw9mSh3tDWYPByOy7Gc/qUjn2iB4J
         QsOBIdiBDbldm4dKvUNKKIamX55mdeN0ivn8Ax5vN4/lKp2l9+lDJsqk6U+GRF+JYcCZ
         pbJIQm9p+6tqQh05wl/g7d81TxPPTFdcvP70A0eqQfP6Udwu3Ei+ef8ZCXqmPUOpMRUT
         0s4A==
X-Gm-Message-State: ABUngvcJ1OauQsVkJYTIQ9uRtRA+f1JCMe6bPnz5k77JiwmEUWXGonTM6VWYYdiVRQeATA==
X-Received: by 10.157.60.6 with SMTP id q6mr2063313otc.141.1477543958844;
        Wed, 26 Oct 2016 21:52:38 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.107.11.162 with SMTP id 34ls909323iol.13.gmail; Wed, 26 Oct
 2016 21:52:37 -0700 (PDT)
X-Received: by 10.36.196.194 with SMTP id v185mr807953itf.4.1477543957281;
        Wed, 26 Oct 2016 21:52:37 -0700 (PDT)
In-Reply-To: <01eb6560-8902-40e3-af54-c395f3d3d33d@isocpp.org>
X-Original-Sender: joseph.thomson@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:29147
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/29147>

------=_Part_278_933223176.1477543956105
Content-Type: multipart/alternative; 
	boundary="----=_Part_279_582691260.1477543956106"

------=_Part_279_582691260.1477543956106
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

On Thursday, 27 October 2016 04:28:17 UTC+8, mihailn...@gmail.com wrote:
>
> ...
>>
>> T t; // t default constructed (value-like)
>> polymorphic<T> p; // *p default constructed (value-like)
>> indirect<T> i; // i is empty (pointer-like)
>>
>> T t =3D tt; // t copy constructed (value-like)
>> polymorphic<T> p =3D tt; // *p copy constructed (value-like)
>> indirect<T> i =3D tt; // error: cannot assign from T (pointer-like)
>>
>> T t =3D std::move(tt); // t move constructed; tt moved from (value-like)
>> polymorphic<T> p =3D std::move(pp); // *p move constructed; *pp moved fr=
om=20
>> (value-like)
>> indirect<T> i =3D std::move(ii); // ownership transferred from ii to i; =
ii=20
>> now empty (pointer-like)
>>
>> T t{1, 2, 3}; // t constructed in-place with arguments (value-like)
>> polymorphic<T> p{in_place, 1, 2, 3}; // *p constructed in-place with=20
>> arguments (value-like)
>> indirect<T> i{new T{1, 2, 3}}; // i constructed from pointer that it=20
>> takes ownership of (pointer-like)
>>
>> // note: operator bool not defined for T
>> if (t) { =E2=80=A6 } // error: t cannot convert to bool (value-like)
>> if (p) { =E2=80=A6 } // error: p cannot convert to bool (value-like)
>> if (i) { =E2=80=A6 } // i checked for empty status (pointer-like)
>>
>
> I agree it is more close to pointer then to a value, but that's a good=20
> thing. It should feel, you are managing a remote recourse.  =20
>
=20
I have no problem with a cloned_ptr proposal (essentially unique_ptr + deep=
=20
copy (+ const-propagation, maybe). I just think the aims of the current=20
proposal are confused. If it wants to be a polymorphic value-like type, I=
=20
suggest something similar to what I presented. If it wants to be a=20
deep-copying pointer-like type, then the chosen name should suggest that (I=
=20
like deep_copy_ptr), and it should probably support the appropriate=20
pointer-like operations (e.g. p =3D nullptr, p.get(), p.reset(x)).

Also, note that indirect<>, is intended to be constructed with=20
> make_indirect NOT with the ctor with a pointer.=20
>
=20
This doesn't fix the fact that the only way to directly construct indirect,=
=20
a supposedly value-like type, is by passing it ownership of a raw pointer.

About polymorphic=20
> The way it is right now, you do many allocations, just to pretend it is a=
=20
> real variable on the stack - allocating default ctor, not empty after mov=
e,=20
> etc.=20
> All these I don't think are of benefit compared to the cost.
>
=20
That's the idea. It behaves just like a stack-allocated object, but with=20
polymorphism. If you can't afford the copies, then maybe you need a=20
deep_copy_ptr instead.

Assignment from raw value however might be useful, especially move=20
> assignment.=20
>
=20
Assignment from T is only really possible when you ditch the deleter and=20
copier (it is only safe when using default_delete and default_copy).

Lastly, I find custom copier and deleter to be essential for the class to=
=20
> be useful.=20
>

Copier and deleter do not make sense for a value-like type. The only way=20
you *might* be able to crowbar them in is if you disallow assignment from=
=20
T, and also have a "creator" and "mover". However, I still think if you are=
=20
going to support generic resource-management, a pointer-like type is what=
=20
you need.

--=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/6d03522b-39f0-4d96-8384-ef9210122168%40isocpp.or=
g.

------=_Part_279_582691260.1477543956106
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Thursday, 27 October 2016 04:28:17 UTC+8, mihailn...@gm=
ail.com  wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-=
left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><blockquote cla=
ss=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc=
 solid;padding-left:1ex"><div dir=3D"ltr"><div>...<br><br><div style=3D"bac=
kground-color:rgb(250,250,250);border-color:rgb(187,187,187);border-style:s=
olid;border-width:1px"><code><div><span style=3D"color:#000">T t</span><spa=
n style=3D"color:#660">;</span><span style=3D"color:#000"> </span><span sty=
le=3D"color:#800">// t default constructed (value-like)</span><span style=
=3D"color:#000"><br>polymorphic</span><span style=3D"color:#660">&lt;</span=
><span style=3D"color:#000">T</span><span style=3D"color:#660">&gt;</span><=
span style=3D"color:#000"> p</span><span style=3D"color:#660">;</span><span=
 style=3D"color:#000"> </span><span style=3D"color:#800">// *p default cons=
tructed (value-like)</span><span style=3D"color:#000"><br>indirect</span><s=
pan style=3D"color:#660">&lt;</span><span style=3D"color:#000">T</span><spa=
n style=3D"color:#660">&gt;</span><span style=3D"color:#000"> i</span><span=
 style=3D"color:#660">;</span><span style=3D"color:#000"> </span><span styl=
e=3D"color:#800">// i is empty (pointer-like)</span><span style=3D"color:#0=
00"><br><br>T t </span><span style=3D"color:#660">=3D</span><span style=3D"=
color:#000"> tt</span><span style=3D"color:#660">;</span><span style=3D"col=
or:#000"> </span><span style=3D"color:#800">// t copy constructed (value-li=
ke)</span><span style=3D"color:#000"><br>polymorphic</span><span style=3D"c=
olor:#660">&lt;</span><span style=3D"color:#000">T</span><span style=3D"col=
or:#660">&gt;</span><span style=3D"color:#000"> p </span><span style=3D"col=
or:#660">=3D</span><span style=3D"color:#000"> tt</span><span style=3D"colo=
r:#660">;</span><span style=3D"color:#000"> </span><span style=3D"color:#80=
0">// *p copy constructed (value-like)</span><span style=3D"color:#000"><br=
>indirect</span><span style=3D"color:#660">&lt;</span><span style=3D"color:=
#000">T</span><span style=3D"color:#660">&gt;</span><span style=3D"color:#0=
00"> i </span><span style=3D"color:#660">=3D</span><span style=3D"color:#00=
0"> tt</span><span style=3D"color:#660">;</span><span style=3D"color:#000">=
 </span><span style=3D"color:#800">// error: cannot assign from T (pointer-=
like)</span><span style=3D"color:#000"><br><br>T t </span><span style=3D"co=
lor:#660">=3D</span><span style=3D"color:#000"> std</span><span style=3D"co=
lor:#660">::</span><span style=3D"color:#000">move</span><span style=3D"col=
or:#660">(</span><span style=3D"color:#000">tt</span><span style=3D"color:#=
660">);</span><span style=3D"color:#000"> </span><span style=3D"color:#800"=
>// t move constructed; tt moved from (value-like)</span><span style=3D"col=
or:#000"><br>polymorphic</span><span style=3D"color:#660">&lt;</span><span =
style=3D"color:#000">T</span><span style=3D"color:#660">&gt;</span><span st=
yle=3D"color:#000"> p </span><span style=3D"color:#660">=3D</span><span sty=
le=3D"color:#000"> std</span><span style=3D"color:#660">::</span><span styl=
e=3D"color:#000">move</span><span style=3D"color:#660">(</span><span style=
=3D"color:#000">pp</span><span style=3D"color:#660">);</span><span style=3D=
"color:#000"> </span><span style=3D"color:#800">// *p move constructed; *pp=
 moved from (value-like)</span><span style=3D"color:#000"><br>indirect</spa=
n><span style=3D"color:#660">&lt;</span><span style=3D"color:#000">T</span>=
<span style=3D"color:#660">&gt;</span><span style=3D"color:#000"> i </span>=
<span style=3D"color:#660">=3D</span><span style=3D"color:#000"> std</span>=
<span style=3D"color:#660">::</span><span style=3D"color:#000">move</span><=
span style=3D"color:#660">(</span><span style=3D"color:#000">ii</span><span=
 style=3D"color:#660">);</span><span style=3D"color:#000"> </span><span sty=
le=3D"color:#800">// ownership transferred from ii to i; ii now empty (poin=
ter-like)</span><span style=3D"color:#000"><br><br>T t</span><span style=3D=
"color:#660">{</span><span style=3D"color:#066">1</span><span style=3D"colo=
r:#660">,</span><span style=3D"color:#000"> </span><span style=3D"color:#06=
6">2</span><span style=3D"color:#660">,</span><span style=3D"color:#000"> <=
/span><span style=3D"color:#066">3</span><span style=3D"color:#660">};</spa=
n><span style=3D"color:#000"> </span><span style=3D"color:#800">// t constr=
ucted in-place with arguments (value-like)</span><span style=3D"color:#000"=
><br>polymorphic</span><span style=3D"color:#660">&lt;</span><span style=3D=
"color:#000">T</span><span style=3D"color:#660">&gt;</span><span style=3D"c=
olor:#000"> p</span><span style=3D"color:#660">{</span><span style=3D"color=
:#000">in_place</span><span style=3D"color:#660">,</span><span style=3D"col=
or:#000"> </span><span style=3D"color:#066">1</span><span style=3D"color:#6=
60">,</span><span style=3D"color:#000"> </span><span style=3D"color:#066">2=
</span><span style=3D"color:#660">,</span><span style=3D"color:#000"> </spa=
n><span style=3D"color:#066">3</span><span style=3D"color:#660">};</span><s=
pan style=3D"color:#000"> </span><span style=3D"color:#800">// *p construct=
ed in-place with arguments (value-like)</span><span style=3D"color:#000"><b=
r>indirect</span><span style=3D"color:#660">&lt;</span><span style=3D"color=
:#000">T</span><span style=3D"color:#660">&gt;</span><span style=3D"color:#=
000"> i</span><span style=3D"color:#660">{</span><span style=3D"color:#008"=
>new</span><span style=3D"color:#000"> T</span><span style=3D"color:#660">{=
</span><span style=3D"color:#066">1</span><span style=3D"color:#660">,</spa=
n><span style=3D"color:#000"> </span><span style=3D"color:#066">2</span><sp=
an style=3D"color:#660">,</span><span style=3D"color:#000"> </span><span st=
yle=3D"color:#066">3</span><span style=3D"color:#660">}};</span><span style=
=3D"color:#000"> </span><span style=3D"color:#800">// i constructed from po=
inter that it takes ownership of (pointer-like)</span><span style=3D"color:=
#000"><br><br></span><span style=3D"color:#800">// note: operator bool not =
defined for T</span><span style=3D"color:#000"><br></span><span style=3D"co=
lor:#008">if</span><span style=3D"color:#000"> </span><span style=3D"color:=
#660">(</span><span style=3D"color:#000">t</span><span style=3D"color:#660"=
>)</span><span style=3D"color:#000"> </span><span style=3D"color:#660">{</s=
pan><span style=3D"color:#000"> </span><span style=3D"color:#660">=E2=80=A6=
</span><span style=3D"color:#000"> </span><span style=3D"color:#660">}</spa=
n><span style=3D"color:#000"> </span><span style=3D"color:#800">// error: t=
 cannot convert to bool (value-like)</span><span style=3D"color:#000"><br><=
/span><span style=3D"color:#008">if</span><span style=3D"color:#000"> </spa=
n><span style=3D"color:#660">(</span><span style=3D"color:#000">p</span><sp=
an style=3D"color:#660">)</span><span style=3D"color:#000"> </span><span st=
yle=3D"color:#660">{</span><span style=3D"color:#000"> </span><span style=
=3D"color:#660">=E2=80=A6</span><span style=3D"color:#000"> </span><span st=
yle=3D"color:#660">}</span><span style=3D"color:#000"> </span><span style=
=3D"color:#800">// error: p cannot convert to bool (value-like)</span><span=
 style=3D"color:#000"><br></span><span style=3D"color:#008">if</span><span =
style=3D"color:#000"> </span><span style=3D"color:#660">(</span><span style=
=3D"color:#000">i</span><span style=3D"color:#660">)</span><span style=3D"c=
olor:#000"> </span><span style=3D"color:#660">{</span><span style=3D"color:=
#000"> </span><span style=3D"color:#660">=E2=80=A6</span><span style=3D"col=
or:#000"> </span><span style=3D"color:#660">}</span><span style=3D"color:#0=
00"> </span><span style=3D"color:#800">// i checked for empty status (point=
er-like)</span></div></code></div></div></div></blockquote><div><br></div><=
div>I agree it is more close=C2=A0to pointer then to a value, but that&#39;=
s a good thing. It should feel, you are managing a remote recourse. =C2=A0 =
<br></div></blockquote><div>=C2=A0<br>I have no problem with a <span style=
=3D"font-family: courier new,monospace;">cloned_ptr</span> proposal (essent=
ially <span style=3D"font-family: courier new,monospace;">unique_ptr</span>=
 + deep copy (+ const-propagation, maybe). I just think the aims of the cur=
rent proposal are confused. If it wants to be a polymorphic value-like type=
, I suggest something similar to what I presented. If it wants to be a deep=
-copying pointer-like type, then the chosen name should suggest that (I lik=
e <span style=3D"font-family: courier new,monospace;">deep_copy_ptr</span>)=
, and it should probably support the appropriate pointer-like operations (e=
..g. <span style=3D"font-family: courier new,monospace;">p =3D nullptr</span=
>, <span style=3D"font-family: courier new,monospace;">p.get()</span>, <spa=
n style=3D"font-family: courier new,monospace;">p.reset(x)</span>).<br><br>=
</div><blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8=
ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div></div><div>Also, no=
te that indirect&lt;&gt;, is intended to be constructed with make_indirect =
NOT with the ctor with a pointer. </div></blockquote><div>=C2=A0<br>This do=
esn&#39;t fix the fact that the only way to directly construct indirect, a =
supposedly value-like type, is by passing it ownership of a raw pointer.<br=
><br></div><blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left=
: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div></div><div>Abo=
ut <font color=3D"#000000">polymorphic</font>=C2=A0</div><div>The way it is=
 right now, you do many allocations, just to pretend it is a real variable =
on the stack - allocating default ctor, not empty after move, etc. </div><d=
iv>All these I don&#39;t think are of benefit compared to the cost.</div></=
blockquote><div>=C2=A0<br>That&#39;s the idea. It behaves just like a stack=
-allocated object, but with polymorphism. If you can&#39;t afford the copie=
s, then maybe you need a <span style=3D"font-family: courier new,monospace;=
">deep_copy_ptr</span> instead.<br><br></div><blockquote class=3D"gmail_quo=
te" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;paddi=
ng-left: 1ex;"><div></div><div>Assignment from raw value however=C2=A0might=
 be useful, especially move assignment. </div></blockquote><div>=C2=A0<br>A=
ssignment from <span style=3D"font-family: courier new,monospace;">T</span>=
 is only really possible when you ditch the deleter and copier (it is only =
safe when using <span style=3D"font-family: courier new,monospace;">default=
_delete</span> and <span style=3D"font-family: courier new,monospace;">defa=
ult_copy</span>).<br><br></div><blockquote class=3D"gmail_quote" style=3D"m=
argin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"=
><div></div><div><font color=3D"#000000">Lastly, I find custom copier and d=
eleter to be essential for the class to be useful. </font></div></blockquot=
e><div><br>Copier and deleter do not make sense for a value-like type. The =
only way you <i>might</i> be able to crowbar them in is if you disallow ass=
ignment from T, and also have a &quot;creator&quot; and &quot;mover&quot;. =
However, I still think if you are going to support generic resource-managem=
ent, a pointer-like type is what you need.<br></div></div>

<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/6d03522b-39f0-4d96-8384-ef9210122168%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/6d03522b-39f0-4d96-8384-ef9210122168=
%40isocpp.org</a>.<br />

------=_Part_279_582691260.1477543956106--

------=_Part_278_933223176.1477543956105--

.
