Topic: Possible error in P0416R0: operator dot
Author: Nicol Bolas <jmckesson@gmail.com>
Date: Tue, 20 Sep 2016 22:12:26 -0700 (PDT)
Raw View
------=_Part_810_1348754204.1474434746508
Content-Type: multipart/alternative;
boundary="----=_Part_811_126154927.1474434746508"
------=_Part_811_126154927.1474434746508
Content-Type: text/plain; charset=UTF-8
I'm having some trouble undestanding section 4.9:
template<class X>
class Ref {
public:
Ref(const X& x) :p{new X{x}} {}
X& operator.() { /* ... */ return *p; }
Ref(const Ref& a); // copy constructor: clone *a.p
Ref(Ref&& a) // move constructor: replace p with a.p
:p{a.p} { a.p=nullptr; } //error: p = a.operator.().p ? that is,
p=a.p.p//
....
private:
X* p;
};
What I don't understand is why the error is an error. By the rules outlined
in 4.4, "an operation defined as a member of the handle is an operation on
the handle." `p` is a member of `Ref`. As such, `a.p` should be "an
operation on the handle", and therefore should access `p`.
Is there some special rule that constructors always forward everything to
the value type? Or is this a mistake in P0416, that it shouldn't error out?
--
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/c3cd7872-5eee-411f-83ac-9b6b555a7bb8%40isocpp.org.
------=_Part_811_126154927.1474434746508
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">I'm having some trouble undestanding section 4.9:<br><=
br><div class=3D"prettyprint" style=3D"background-color: rgb(250, 250, 250)=
; border-color: rgb(187, 187, 187); border-style: solid; border-width: 1px;=
word-wrap: break-word;"><code class=3D"prettyprint"><div class=3D"subprett=
yprint"><span style=3D"color: #008;" class=3D"styled-by-prettify">template<=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify"><</span>=
<span style=3D"color: #008;" class=3D"styled-by-prettify">class</span><span=
style=3D"color: #000;" class=3D"styled-by-prettify"> X</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">></span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #=
008;" class=3D"styled-by-prettify">class</span><span style=3D"color: #000;"=
class=3D"styled-by-prettify"> </span><span style=3D"color: #606;" class=3D=
"styled-by-prettify">Ref</span><span style=3D"color: #000;" class=3D"styled=
-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">{</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=
</span><span style=3D"color: #008;" class=3D"styled-by-prettify">public</sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">:</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 </span><span=
style=3D"color: #606;" class=3D"styled-by-prettify">Ref</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D"color=
: #008;" class=3D"styled-by-prettify">const</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"> X</span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">&</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"> x</span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">)</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">:</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify">p</span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">{</span><span style=3D"c=
olor: #008;" class=3D"styled-by-prettify">new</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify"> X</span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">{</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify">x</span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">}}</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">{}</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 X</sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">&</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #008;" class=3D"styled-by-prettify">operator</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">.()</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;=
" class=3D"styled-by-prettify">{</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span><span style=3D"color: #800;" class=3D"style=
d-by-prettify">/* ... */</span><span style=3D"color: #000;" class=3D"styled=
-by-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-prett=
ify">return</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">*</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify">p</span><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify">;</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;=
" class=3D"styled-by-prettify">}</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"><br>=C2=A0 </span><span style=3D"color: #606;" clas=
s=3D"styled-by-prettify">Ref</span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">(</span><span style=3D"color: #008;" class=3D"styled-by-p=
rettify">const</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"> </span><span style=3D"color: #606;" class=3D"styled-by-prettify">Ref</=
span><span style=3D"color: #660;" class=3D"styled-by-prettify">&</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify"> a</span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">);</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #80=
0;" class=3D"styled-by-prettify">// copy constructor: clone *a.p</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 </span><sp=
an style=3D"color: #606;" class=3D"styled-by-prettify">Ref</span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D"colo=
r: #606;" class=3D"styled-by-prettify">Ref</span><span style=3D"color: #660=
;" class=3D"styled-by-prettify">&&</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify"> a</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">)</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> </span><span style=3D"color: #800;" class=3D"styled-by-pret=
tify">// move constructor: replace p with a.p</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">:</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify">p</span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">{</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify">a</span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">.</span><span style=3D"color: #000;" class=3D"styled-by-prettify">p<=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">}</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">{</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"> a</span><span style=3D"color: #660;"=
class=3D"styled-by-prettify">.</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify">p</span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">=3D</span><span style=3D"color: #008;" class=3D"styled-by-prett=
ify">nullptr</span><span style=3D"color: #660;" class=3D"styled-by-prettify=
">;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span=
><span style=3D"color: #660;" class=3D"styled-by-prettify">}</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"co=
lor: #800;" class=3D"styled-by-prettify">//error: p =3D a.operator.().p ? t=
hat is, p=3Da.p.p// </span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"><br></span><span style=3D"color: #660;" class=3D"styled-by-pretti=
fy">...</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br=
></span><span style=3D"color: #008;" class=3D"styled-by-prettify">private</=
span><span style=3D"color: #660;" class=3D"styled-by-prettify">:</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 X</span><s=
pan style=3D"color: #660;" class=3D"styled-by-prettify">*</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> p</span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">;</span><span style=3D"color: #000;"=
class=3D"styled-by-prettify"><br></span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">};</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"><br></span></div></code></div><br>What I don't understa=
nd is why the error is an error. By the rules outlined in 4.4, "an ope=
ration defined as a member of the handle is an operation=C2=A0on the handle=
.." `p` is a member of `Ref`. As such, `a.p` should be "an operati=
on on the handle", and therefore should access `p`.<br><br>Is there so=
me special rule that constructors always forward everything to the value ty=
pe? Or is this a mistake in P0416, that it shouldn't error out?<br></di=
v>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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/c3cd7872-5eee-411f-83ac-9b6b555a7bb8%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/c3cd7872-5eee-411f-83ac-9b6b555a7bb8=
%40isocpp.org</a>.<br />
------=_Part_811_126154927.1474434746508--
------=_Part_810_1348754204.1474434746508--
.
Author: mihailnajdenov@gmail.com
Date: Wed, 21 Sep 2016 00:29:10 -0700 (PDT)
Raw View
------=_Part_2684_1920472676.1474442950963
Content-Type: multipart/alternative;
boundary="----=_Part_2685_612576502.1474442950963"
------=_Part_2685_612576502.1474442950963
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
When the user types a.p in the ctor body, he gets a X&, the result of the=
=20
operator.() and the tries a 'p' member of X, just like in every other=20
normal function body.=20
This is not what the user wants.
This design has no special rules for handle members, so the answer is =E2=
=80=9Cyes,=20
> operator.() will be called,=E2=80=9D so the definition of the move constr=
uctor is=20
> an error: a.p is interpreted as a.operator.().p which means a.p.p which i=
s=20
> a compile-time error. T
As for "an operation defined as a member of the handle is an operation on=
=20
the handle." here it means "rebind" as an operation. 'p' is a member, but=
=20
not an operation. I admit it is a bit misleading wording.=20
--=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/b43f8023-c20a-400f-a6c2-d3b74ca46220%40isocpp.or=
g.
------=_Part_2685_612576502.1474442950963
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">When the user types a.p in the ctor body, he gets a X&=
, the result of the=C2=A0<span style=3D"font-family: monospace; background-=
color: rgb(250, 250, 250); color: rgb(0, 0, 136);">operator</span><span sty=
le=3D"background-color: rgb(250, 250, 250);"><font color=3D"#666600" face=
=3D"monospace">.() and the tries a 'p' member of X, just like in ev=
ery other normal function body.=C2=A0</font></span><div><span style=3D"back=
ground-color: rgb(250, 250, 250);"><font color=3D"#666600" face=3D"monospac=
e">This is not what the user wants.</font></span></div><div><span style=3D"=
background-color: rgb(250, 250, 250);"><font color=3D"#666600" face=3D"mono=
space"><br></font></span></div><blockquote class=3D"gmail_quote" style=3D"m=
argin: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(204, 204, 204); paddin=
g-left: 1ex;">This design has no special rules for handle members, so the a=
nswer is =E2=80=9Cyes, operator.() will be called,=E2=80=9D so=09
the definition of the move constructor is an error: a.p is inter=
preted as a.operator.().p which means=09
a.p.p which is a compile-time error. T</blockquote><div><br></div><div>As f=
or =C2=A0"an operation defined as a member of the handle is an operati=
on=C2=A0on the handle." here it means "rebind" as an operati=
on. 'p' is a member, but not an operation. I admit it is a bit misl=
eading wording.=C2=A0</div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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/b43f8023-c20a-400f-a6c2-d3b74ca46220%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/b43f8023-c20a-400f-a6c2-d3b74ca46220=
%40isocpp.org</a>.<br />
------=_Part_2685_612576502.1474442950963--
------=_Part_2684_1920472676.1474442950963--
.
Author: Nicol Bolas <jmckesson@gmail.com>
Date: Wed, 21 Sep 2016 06:38:17 -0700 (PDT)
Raw View
------=_Part_1735_2059038799.1474465097739
Content-Type: multipart/alternative;
boundary="----=_Part_1736_1011432652.1474465097739"
------=_Part_1736_1011432652.1474465097739
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
On Wednesday, September 21, 2016 at 3:29:11 AM UTC-4, mihailn...@gmail.com=
=20
wrote:
>
> When the user types a.p in the ctor body, he gets a X&, the result of the=
=20
> operator.() and the tries a 'p' member of X, just like in every other=20
> normal function body.=20
> This is not what the user wants.
>
> This design has no special rules for handle members, so the answer is=20
>> =E2=80=9Cyes, operator.() will be called,=E2=80=9D so the definition of =
the move=20
>> constructor is an error: a.p is interpreted as a.operator.().p which mea=
ns=20
>> a.p.p which is a compile-time error. T
>
>
> As for "an operation defined as a member of the handle is an operation o=
n=20
> the handle." here it means "rebind" as an operation. 'p' is a member, but=
=20
> not an operation. I admit it is a bit misleading wording.
>
Wait: calling a member function is an "operation", but getting a member=20
*variable* is not? That is a rather surprising distinction, and one that's=
=20
highly unnecessary.
It seems to me that the simpler rule is that if you have a Ref<X>, and you=
=20
do `a.name`, *regardless* of what `name` is, if `Ref<X>` provides `name`=20
then you should get `Ref<X>`'s `name` (overload resolution of function=20
calls aside).
To do otherwise forces people into using `std::addressof` gymnastics=20
needlessly.
--=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/93658b4c-758c-46ec-94c8-d5a56730938c%40isocpp.or=
g.
------=_Part_1736_1011432652.1474465097739
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">On Wednesday, September 21, 2016 at 3:29:11 AM UTC-4, miha=
iln...@gmail.com wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0=
;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div di=
r=3D"ltr">When the user types a.p in the ctor body, he gets a X&, the r=
esult of the=C2=A0<span style=3D"font-family:monospace;background-color:rgb=
(250,250,250);color:rgb(0,0,136)">operator</span><span style=3D"background-=
color:rgb(250,250,250)"><font color=3D"#666600" face=3D"monospace">.() and =
the tries a 'p' member of X, just like in every other normal functi=
on body.=C2=A0</font></span><div><span style=3D"background-color:rgb(250,25=
0,250)"><font color=3D"#666600" face=3D"monospace">This is not what the use=
r wants.</font></span></div><div><span style=3D"background-color:rgb(250,25=
0,250)"><font color=3D"#666600" face=3D"monospace"><br></font></span></div>=
<blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-=
left:1px solid rgb(204,204,204);padding-left:1ex">This design has no specia=
l rules for handle members, so the answer is =E2=80=9Cyes, operator.() will=
be called,=E2=80=9D so=09
the definition of the move constructor is an error: a.p is inter=
preted as a.operator.().p which means=09
a.p.p which is a compile-time error. T</blockquote><div><br></div><div>As f=
or =C2=A0"an operation defined as a member of the handle is an operati=
on=C2=A0on the handle." here it means "rebind" as an operati=
on. 'p' is a member, but not an operation. I admit it is a bit misl=
eading wording.</div></div></blockquote><div><br>Wait: calling a member fun=
ction is an "operation", but getting a member <i>variable</i> is =
not? That is a rather surprising distinction, and one that's highly unn=
ecessary.<br><br>It seems to me that the simpler rule is that if you have a=
Ref<X>, and you do `a.name`, <i>regardless</i> of what `name` is, if=
`Ref<X>` provides `name` then you should get `Ref<X>`'s `n=
ame` (overload resolution of function calls aside).<br><br>To do otherwise =
forces people into using `std::addressof` gymnastics needlessly.<br></div><=
/div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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/93658b4c-758c-46ec-94c8-d5a56730938c%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/93658b4c-758c-46ec-94c8-d5a56730938c=
%40isocpp.org</a>.<br />
------=_Part_1736_1011432652.1474465097739--
------=_Part_1735_2059038799.1474465097739--
.
Author: "D. B." <db0451@gmail.com>
Date: Wed, 21 Sep 2016 14:51:59 +0100
Raw View
--e89a8f3ba1f569ed2f053d04d99b
Content-Type: text/plain; charset=UTF-8
On Wed, Sep 21, 2016 at 2:38 PM, Nicol Bolas <jmckesson@gmail.com> wrote:
>
>
> Wait: calling a member function is an "operation", but getting a member
> *variable* is not? That is a rather surprising distinction, and one
> that's highly unnecessary.
>
> It seems to me that the simpler rule is that *if you have a Ref<X>, and
> you do `a.name <http://a.name>`, regardless of what `name` is, if `Ref<X>`
> provides `name` then you should get `Ref<X>`'s `name`* (overload
> resolution of function calls aside).
>
> To do otherwise forces people into using `std::addressof` gymnastics
> needlessly.
>
Totally agreed. Members of the contained object/reference should not take
priority over members of the containing smart reference itself. Is that
really what's currently meant to happen here?
Anyway, semantically by my understanding, that *should* be an operation, as
it's using the member-access operator.
I've been pretty excited for operator.() possibly getting into the language
sometime soon, but that's dampened if it's subject to self-contradictory
rules like this. :/
--
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/CACGiwhHZjpOGK%3DLNC8bKsHcxPNvZEU6w4W%2B_HHyRjsrUv%2B0z9Q%40mail.gmail.com.
--e89a8f3ba1f569ed2f053d04d99b
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div class=3D"gmail_extra"><div class=3D"gmail_quote">On W=
ed, Sep 21, 2016 at 2:38 PM, Nicol Bolas <span dir=3D"ltr"><<a href=3D"m=
ailto:jmckesson@gmail.com" target=3D"_blank">jmckesson@gmail.com</a>></s=
pan> wrote:=C2=A0<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8=
ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><span clas=
s=3D""></span><div><br>Wait: calling a member function is an "operatio=
n", but getting a member <i>variable</i> is not? That is a rather surp=
rising distinction, and one that's highly unnecessary.<br><br>It seems =
to me that the simpler rule is that <b>if you have a Ref<X>, and you =
do `<a href=3D"http://a.name" target=3D"_blank">a.name</a>`, <i>regardless<=
/i> of what `name` is, if `Ref<X>` provides `name` then you should ge=
t `Ref<X>`'s `name`</b> (overload resolution of function calls as=
ide).<br><br>To do otherwise forces people into using `std::addressof` gymn=
astics needlessly.<br></div></div></blockquote><br><br>Totally agreed. Memb=
ers of the contained object/reference should not take priority over members=
of the containing smart reference itself. Is that really what's curren=
tly meant to happen here?<br><br>Anyway, semantically by my understanding, =
that <i>should</i> be an operation, as it's using the member-access ope=
rator.<br><br></div><div class=3D"gmail_quote">I've been pretty excited=
for operator.() possibly getting into the language sometime soon, but that=
's dampened if it's subject to self-contradictory rules like this. =
:/<br><br><br></div></div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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/CACGiwhHZjpOGK%3DLNC8bKsHcxPNvZEU6w4W=
%2B_HHyRjsrUv%2B0z9Q%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfoote=
r">https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CACGiwhHZjp=
OGK%3DLNC8bKsHcxPNvZEU6w4W%2B_HHyRjsrUv%2B0z9Q%40mail.gmail.com</a>.<br />
--e89a8f3ba1f569ed2f053d04d99b--
.
Author: mihailnajdenov@gmail.com
Date: Wed, 21 Sep 2016 08:02:43 -0700 (PDT)
Raw View
------=_Part_2665_839486403.1474470163692
Content-Type: multipart/alternative;
boundary="----=_Part_2666_870679947.1474470163693"
------=_Part_2666_870679947.1474470163693
Content-Type: text/plain; charset=UTF-8
>
> Totally agreed. Members of the contained object/reference should not take
> priority over members of the containing smart reference itself. Is that
> really what's currently meant to happen here?
>
It is not that the member of the contained object is of having a priority.
It is the fact the the operator.() is always evaluated first.
> It seems to me that the simpler rule is that if you have a Ref<X>, and you
> do `a.name`, *regardless* of what `name` is, if `Ref<X>` provides `name`
> then you should get `Ref<X>`'s `name` (overload resolution of function
> calls aside).
>
The idea is to have the smart references be as the standard c++ references
- indistinguishable as the object they point to. This is why they always
redirect.
The other requirement is to be able to have additional features like
rebind() - the "smart" part. Functions on the handle will be called on it
with priority.
If members had priority it will be very hard for the user to avid conflicts
because this is a detail of the Ref and might even differ b/w
implementations, where functions are public interface.
In any case the cctor and mctor will I think always be a bit hard, because
you want the rare case to act on the container, not the contained item, but
references are designed to be indistinguishable from contained item. These
are rare case however, compared to all reference usage scenarios. Also the
solution is not that weird - just avoid typing '.' by using a pointer and
->.
--
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/c26c671c-f681-4990-92c5-fdae0c65e2d6%40isocpp.org.
------=_Part_2666_870679947.1474470163693
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><blockquote class=3D"gmail_quote" style=3D"margin: 0px 0px=
0px 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">=
<div class=3D"gmail_quote">Totally agreed. Members of the contained object/=
reference should not take priority over members of the containing smart ref=
erence itself. Is that really what's currently meant to happen here?<br=
></div></blockquote><div><br></div><div>It is not that the member of the co=
ntained object is of having a priority. It is the fact the the operator.() =
is always evaluated first.=C2=A0</div><div>=C2=A0</div><blockquote class=3D=
"gmail_quote" style=3D"margin: 0px 0px 0px 0.8ex; border-left: 1px solid rg=
b(204, 204, 204); padding-left: 1ex;"><div class=3D"gmail_quote"></div></bl=
ockquote><blockquote class=3D"gmail_quote" style=3D"margin: 0px 0px 0px 0.8=
ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">It seems=
to me that the simpler rule is that if you have a Ref<X>, and you do=
`<a href=3D"http://a.name/" target=3D"_blank" rel=3D"nofollow" style=3D"cu=
rsor: pointer;">a.name</a>`,=C2=A0<i>regardless</i>=C2=A0of what `name` is,=
if `Ref<X>` provides `name` then you should get `Ref<X>`'s=
`name` (overload resolution of function calls aside).<br></blockquote><div=
><br></div><div>The idea is to have the smart references be as the standard=
c++ references - indistinguishable as the object they point to. This is wh=
y they always redirect.</div><div>The other requirement is to be able to ha=
ve additional features like rebind() - the "smart" part. Function=
s on the handle will be called on it with priority.=C2=A0</div><div><br></d=
iv><div>If members had priority it will be very hard for the user to avid c=
onflicts because this is a detail of the Ref and might even differ b/w impl=
ementations, where functions are public interface. =C2=A0</div><div><br></d=
iv><div>In any case the cctor and mctor will I think always be a bit hard, =
because you want the rare case to act on the container, not the contained i=
tem, but references are designed to be indistinguishable from contained ite=
m. These are rare case however, compared to all reference usage scenarios. =
Also the solution is not that weird - just avoid typing '.' by usin=
g a pointer and ->.=C2=A0</div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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/c26c671c-f681-4990-92c5-fdae0c65e2d6%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/c26c671c-f681-4990-92c5-fdae0c65e2d6=
%40isocpp.org</a>.<br />
------=_Part_2666_870679947.1474470163693--
------=_Part_2665_839486403.1474470163692--
.
Author: Nicol Bolas <jmckesson@gmail.com>
Date: Wed, 21 Sep 2016 11:41:26 -0700 (PDT)
Raw View
------=_Part_266_1801910243.1474483286683
Content-Type: multipart/alternative;
boundary="----=_Part_267_1710983013.1474483286684"
------=_Part_267_1710983013.1474483286684
Content-Type: text/plain; charset=UTF-8
On Wednesday, September 21, 2016 at 11:02:44 AM UTC-4, mihailn...@gmail.com
wrote:
>
> Totally agreed. Members of the contained object/reference should not take
>> priority over members of the containing smart reference itself. Is that
>> really what's currently meant to happen here?
>>
>
> It is not that the member of the contained object is of having a priority.
> It is the fact the the operator.() is always evaluated first.
>
.... huh? Section 4.4 makes it perfectly clear that `a.rebind()` will call
`Ref<X>::rebind()`, not `X::rebind()`. So how can `operator.()` be "always
evaluated first"?
It seems to me that the simpler rule is that if you have a Ref<X>, and you
>> do `a.name`, *regardless* of what `name` is, if `Ref<X>` provides `name`
>> then you should get `Ref<X>`'s `name` (overload resolution of function
>> calls aside).
>>
>
> The idea is to have the smart references be as the standard c++ references
> - indistinguishable as the object they point to.
>
This is why they always redirect.
>
The other requirement is to be able to have additional features like
> rebind() - the "smart" part. Functions on the handle will be called on it
> with priority.
>
If members had priority it will be very hard for the user to avid conflicts
> because this is a detail of the Ref and might even differ b/w
> implementations, where functions are public interface.
>
OK, so the problem is with private members whose names could conflict with
public ones on the contained value. So... why not fix *that*? Just have a
rule that says that if the name in the handle is not accessible from the
location where it is used, `operator.()` will be checked instead of making
the program il-formed.
After all, classes have private member *functions* too. And we don't want
collisions between them and the public interface of the value type. You
wouldn't want to restrict implementations of such types to having no
private member functions, would you? After all, not all of these types are
going to be in the standard library, so not all of them can use the
`_C`apital syntax reserved for standard library privates. Indeed, some of
them might want to privately inherit from something (a CRTP base class, for
example), which would expose its own private functions.
So it seems clear that we need a way to resolve the public/private issue
*regardless* of member variable/function priority. Once the public/private
issues is resolved, there's no real reason to deny member variables from
having the same priority as member functions.
To be sure, the rule will have to be finagled to deal with overloading
between public and private interfaces.
Ultimately, it seems wrongheaded to me to say that member variable
forwarding isn't important just because smart references/handles are what
this feature is for, and they probably wouldn't use them. We shouldn't gimp
a language feature just because the intended usage scenario wouldn't need
it.
I mean, `operator->` and `operator*` get used for things that aren't "smart
pointers" all the time (iterators, for example). Let's not make decisions
based on what smart references/handles would do with the feature.
In any case the cctor and mctor will I think always be a bit hard, because
> you want the rare case to act on the container, not the contained item, but
> references are designed to be indistinguishable from contained item. These
> are rare case however, compared to all reference usage scenarios.
>
>
Also the solution is not that weird - just avoid typing '.' by using a
> pointer and ->.
>
Um, yes, it is rather weird to have what is clearly a *value type* and not
be able to access its members using `.`. That's what `.` *is for*.
Furthermore, "using a pointer and ->" means `std::addressof(a)->blah`.
Which is extremely cumbersome.
--
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/5f65dc7e-b808-4d23-96e9-83bc1015d3a6%40isocpp.org.
------=_Part_267_1710983013.1474483286684
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">On Wednesday, September 21, 2016 at 11:02:44 AM UTC-4, mih=
ailn...@gmail.com wrote:<blockquote class=3D"gmail_quote" style=3D"margin: =
0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div d=
ir=3D"ltr"><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.=
8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class=3D"=
gmail_quote">Totally agreed. Members of the contained object/reference shou=
ld not take priority over members of the containing smart reference itself.=
Is that really what's currently meant to happen here?<br></div></block=
quote><div><br></div><div>It is not that the member of the contained object=
is of having a priority. It is the fact the the operator.() is always eval=
uated first.</div></div></blockquote><div><br>... huh? Section 4.4 makes it=
perfectly clear that `a.rebind()` will call `Ref<X>::rebind()`, not =
`X::rebind()`. So how can `operator.()` be "always evaluated first&quo=
t;?<br><br></div><blockquote class=3D"gmail_quote" style=3D"margin: 0;margi=
n-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"l=
tr"><div></div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0p=
x 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class=
=3D"gmail_quote"></div></blockquote><blockquote class=3D"gmail_quote" style=
=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding=
-left:1ex">It seems to me that the simpler rule is that if you have a Ref&l=
t;X>, and you do `<a href=3D"http://a.name/" rel=3D"nofollow" target=3D"=
_blank" onmousedown=3D"this.href=3D'http://www.google.com/url?q\x3dhttp=
%3A%2F%2Fa.name%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNH1Br6g2yzb59MPlT=
6dkW55e76NqQ';return true;" onclick=3D"this.href=3D'http://www.goog=
le.com/url?q\x3dhttp%3A%2F%2Fa.name%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAF=
QjCNH1Br6g2yzb59MPlT6dkW55e76NqQ';return true;">a.name</a>`,=C2=A0<i>re=
gardless</i>=C2=A0of what `name` is, if `Ref<X>` provides `name` then=
you should get `Ref<X>`'s `name` (overload resolution of functio=
n calls aside).<br></blockquote><div><br></div><div>The idea is to have the=
smart references be as the standard c++ references - indistinguishable as =
the object they point to.=C2=A0</div></div></blockquote><blockquote class=
=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #cc=
c solid;padding-left: 1ex;"><div dir=3D"ltr"><div> This is why they always =
redirect.</div></div></blockquote><div></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 dir=3D"ltr"><div>The other requirement is to be able to=
have additional features like rebind() - the "smart" part. Funct=
ions on the handle will be called on it with priority.<br></div></div></blo=
ckquote><blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0=
..8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"><div>=
If members had priority it will be very hard for the user to avid conflicts=
because this is a detail of the Ref and might even differ b/w implementati=
ons, where functions are public interface. </div></div></blockquote><div><b=
r>OK, so the problem is with private members whose names could conflict wit=
h public ones on the contained value. So... why not fix <i>that</i>? Just h=
ave a rule that says that if the name in the handle is not accessible from =
the location where it is used, `operator.()` will be checked instead of mak=
ing the program il-formed.<br><br>After all, classes have private member <i=
>functions</i> too. And we don't want collisions between them and the p=
ublic interface of the value type. You wouldn't want to restrict implem=
entations of such types to having no private member functions, would you? A=
fter all, not all of these types are going to be in the standard library, s=
o not all of them can use the `_C`apital syntax reserved for standard libra=
ry privates. Indeed, some of them might want to privately inherit from some=
thing (a CRTP base class, for example), which would expose its own private =
functions.<br><br>So it seems clear that we need a way to resolve the publi=
c/private issue <i>regardless</i> of member variable/function priority. Onc=
e the public/private issues is resolved, there's no real reason to deny=
member variables from having the same priority as member functions.<br><br=
>To be sure, the rule will have to be finagled to deal with overloading bet=
ween public and private interfaces.<br><br>Ultimately, it seems wrongheaded=
to me to say that member variable forwarding isn't important just beca=
use smart references/handles are what this feature is for, and they probabl=
y wouldn't use them. We shouldn't gimp a=20
language feature just because the intended usage scenario wouldn't need=
=20
it.<br><br>I mean, `operator->` and `operator*` get used for things=20
that aren't "smart pointers" all the time (iterators, for exa=
mple). Let's=20
not make decisions based on what smart references/handles would do with=20
the feature.<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=
dir=3D"ltr"><div></div><div></div><div>In any case the cctor and mctor wil=
l I think always be a bit hard, because you want the rare case to act on th=
e container, not the contained item, but references are designed to be indi=
stinguishable from contained item. These are rare case however, compared to=
all reference usage scenarios.</div></div></blockquote><blockquote style=
=3D"margin: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(204, 204, 204); p=
adding-left: 1ex;" class=3D"gmail_quote"><div>=C2=A0</div></blockquote><blo=
ckquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-=
left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"><div>Also the sol=
ution is not that weird - just avoid typing '.' by using a pointer =
and ->.</div></div></blockquote><div><br>Um, yes, it is rather weird to =
have what is clearly a <i>value type</i> and not be able to access its memb=
ers using `.`. That's what `.` <i>is for</i>.<br><br>Furthermore, "=
;using a pointer and ->" means `std::addressof(a)->blah`. Which =
is extremely cumbersome.<br></div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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/5f65dc7e-b808-4d23-96e9-83bc1015d3a6%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/5f65dc7e-b808-4d23-96e9-83bc1015d3a6=
%40isocpp.org</a>.<br />
------=_Part_267_1710983013.1474483286684--
------=_Part_266_1801910243.1474483286683--
.
Author: "D. B." <db0451@gmail.com>
Date: Wed, 21 Sep 2016 19:58:13 +0100
Raw View
--001a114a4888971538053d0920ac
Content-Type: text/plain; charset=UTF-8
Having looked at the section in detail, my conclusion is that I need to
spend a week reading this before I can draw any conclusions. :D So I will
optimistically recant my previous pessimism and wait to see how it turns
out.
I'm definitely glad to see people with better understanding than me are
applying critical analysis, either way.
--
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/CACGiwhELO6unQ%3DkGsvm%3DVyVb_uTru7XLB19wsgMXSX-nsHz86Q%40mail.gmail.com.
--001a114a4888971538053d0920ac
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div>Having looked at the section in detail, my conclusion=
is that I need to spend a week reading this before I can draw any conclusi=
ons. :D So I will optimistically recant my previous pessimism and wait to s=
ee how it turns out.<br><br></div>I'm definitely glad to see people wit=
h better understanding than me are applying critical analysis, either way.<=
br></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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/CACGiwhELO6unQ%3DkGsvm%3DVyVb_uTru7XL=
B19wsgMXSX-nsHz86Q%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter"=
>https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CACGiwhELO6un=
Q%3DkGsvm%3DVyVb_uTru7XLB19wsgMXSX-nsHz86Q%40mail.gmail.com</a>.<br />
--001a114a4888971538053d0920ac--
.
Author: mihailnajdenov@gmail.com
Date: Wed, 21 Sep 2016 12:37:33 -0700 (PDT)
Raw View
------=_Part_60_1282868100.1474486653497
Content-Type: multipart/alternative;
boundary="----=_Part_61_948825282.1474486653498"
------=_Part_61_948825282.1474486653498
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
It says:
rebind() =E2=80=93 does a named function apply to the handle or the value? =
This=20
> design makes* a handle member functions apply to the handle and all=20
> others apply to the value**.*
*Although *it also says:
Note that the priority is simply =E2=80=9Chas a member of that name been de=
clared=20
> in the handle?=E2=80=9D Like for access control, *we don=E2=80=99t distin=
guish based on=20
> the type of the member (e.g., function vs. data member) * or try to do=20
> overload resolution between scopes. Thus an =E2=80=9Cobviously irrelevant=
=E2=80=9D member=20
> of the handle (e.g., a private member or a type name) can hide a member o=
f=20
> the value. =20
And also this, as said before, is not very clear.
> This design took what seems the simplest approach: an *operation defined=
=20
> as a member* of the handle *is an operation* on the handle. Otherwise,=20
> the operation is forwarded.=20
The proposal needs a bit better wording/clarifications.=20
--=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/ccab65c2-1bbe-4e5a-836a-6948be0e9ef2%40isocpp.or=
g.
------=_Part_61_948825282.1474486653498
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div><br></div><div><div>It says:</div><div><br></div><blo=
ckquote class=3D"gmail_quote" style=3D"margin: 0px 0px 0px 0.8ex; border-le=
ft: 1px solid rgb(204, 204, 204); padding-left: 1ex;">rebind() =E2=80=93 do=
es a named function apply to the handle or the value? This design makes<i> =
a handle member <b>functions </b>apply to the handle and<b> all others appl=
y to the value</b></i><b>.</b></blockquote></div><div><br></div><b>Although=
</b>it also says:<div><br><blockquote class=3D"gmail_quote" style=3D"margi=
n: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-le=
ft: 1ex;">Note that the priority is simply =E2=80=9Chas a member o=
f that name been declared in the handle?=E2=80=9D Like for=09
access control, <b>we don=E2=80=99t distinguish based on the type of the me=
mber (e.g., function vs. data member) </b>
or try to do overload resolution between scopes. Thus an =E2=80=9Cobviously=
irrelevant=E2=80=9D member of the handle=09
(e.g., a private member or a type name) can hide a member of the value. =C2=
=A0</blockquote><div><br></div></div><div><div>And also this, as said befor=
e, is not very clear.</div><blockquote class=3D"gmail_quote" style=3D"borde=
r-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">This design took =
what seems the simplest approach: an <i>operation defined as a member</i> o=
f the handle <i>is an operation</i> on the handle. Otherwise, the operation=
is forwarded.=C2=A0</blockquote></div><div><br></div><div>The proposal nee=
ds a bit better wording/clarifications.=C2=A0</div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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/ccab65c2-1bbe-4e5a-836a-6948be0e9ef2%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/ccab65c2-1bbe-4e5a-836a-6948be0e9ef2=
%40isocpp.org</a>.<br />
------=_Part_61_948825282.1474486653498--
------=_Part_60_1282868100.1474486653497--
.
Author: mihailnajdenov@gmail.com
Date: Sun, 2 Oct 2016 07:58:01 -0700 (PDT)
Raw View
------=_Part_152_1963529075.1475420281595
Content-Type: multipart/alternative;
boundary="----=_Part_153_260418489.1475420281596"
------=_Part_153_260418489.1475420281596
Content-Type: text/plain; charset=UTF-8
Turned out, there are two other proposals as well:
http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2015/p0060r0.html
(I don't like it)
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0352r0.pdf
(I like it very much)
--
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/2e1ee637-b061-48b9-8493-22a46c1d12d3%40isocpp.org.
------=_Part_153_260418489.1475420281596
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">Turned out, there are two other proposals as well:<div><br=
><div>http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2015/p0060r0.html=
=C2=A0</div><div>(I don't like it)</div><div><br></div><div>http://www.=
open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0352r0.pdf<br></div></div><di=
v>(I like it very much)</div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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/2e1ee637-b061-48b9-8493-22a46c1d12d3%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/2e1ee637-b061-48b9-8493-22a46c1d12d3=
%40isocpp.org</a>.<br />
------=_Part_153_260418489.1475420281596--
------=_Part_152_1963529075.1475420281595--
.
Author: Farid Mehrabi <farid.mehrabi@gmail.com>
Date: Mon, 3 Oct 2016 22:30:10 +0330
Raw View
--94eb2c0602660526ff053dfa90f6
Content-Type: text/plain; charset=UTF-8
what if I want a smart ref which is also a smart ptr?
what if the content of smart ref is a smart ptr?
what happens if the content is yet another smart ref?
the last question applies to smart ptrs as well what if the object of a
smart ptr is another smart ptr? smart ptrs have had this annoying defect
and I am one of those who like it eliminated.
regards,
FM.
2016-09-21 22:11 GMT+03:30 Nicol Bolas <jmckesson@gmail.com>:
> On Wednesday, September 21, 2016 at 11:02:44 AM UTC-4,
> mihailn...@gmail.com wrote:
>>
>> Totally agreed. Members of the contained object/reference should not take
>>> priority over members of the containing smart reference itself. Is that
>>> really what's currently meant to happen here?
>>>
>>
>> It is not that the member of the contained object is of having a
>> priority. It is the fact the the operator.() is always evaluated first.
>>
>
> ... huh? Section 4.4 makes it perfectly clear that `a.rebind()` will call
> `Ref<X>::rebind()`, not `X::rebind()`. So how can `operator.()` be "always
> evaluated first"?
>
> It seems to me that the simpler rule is that if you have a Ref<X>, and you
>>> do `a.name`, *regardless* of what `name` is, if `Ref<X>` provides
>>> `name` then you should get `Ref<X>`'s `name` (overload resolution of
>>> function calls aside).
>>>
>>
>> The idea is to have the smart references be as the standard c++
>> references - indistinguishable as the object they point to.
>>
> This is why they always redirect.
>>
> The other requirement is to be able to have additional features like
>> rebind() - the "smart" part. Functions on the handle will be called on it
>> with priority.
>>
> If members had priority it will be very hard for the user to avid
>> conflicts because this is a detail of the Ref and might even differ b/w
>> implementations, where functions are public interface.
>>
>
> OK, so the problem is with private members whose names could conflict with
> public ones on the contained value. So... why not fix *that*? Just have a
> rule that says that if the name in the handle is not accessible from the
> location where it is used, `operator.()` will be checked instead of making
> the program il-formed.
>
> After all, classes have private member *functions* too. And we don't want
> collisions between them and the public interface of the value type. You
> wouldn't want to restrict implementations of such types to having no
> private member functions, would you? After all, not all of these types are
> going to be in the standard library, so not all of them can use the
> `_C`apital syntax reserved for standard library privates. Indeed, some of
> them might want to privately inherit from something (a CRTP base class, for
> example), which would expose its own private functions.
>
> So it seems clear that we need a way to resolve the public/private issue
> *regardless* of member variable/function priority. Once the
> public/private issues is resolved, there's no real reason to deny member
> variables from having the same priority as member functions.
>
> To be sure, the rule will have to be finagled to deal with overloading
> between public and private interfaces.
>
> Ultimately, it seems wrongheaded to me to say that member variable
> forwarding isn't important just because smart references/handles are what
> this feature is for, and they probably wouldn't use them. We shouldn't gimp
> a language feature just because the intended usage scenario wouldn't need
> it.
>
> I mean, `operator->` and `operator*` get used for things that aren't
> "smart pointers" all the time (iterators, for example). Let's not make
> decisions based on what smart references/handles would do with the feature.
>
> In any case the cctor and mctor will I think always be a bit hard, because
>> you want the rare case to act on the container, not the contained item, but
>> references are designed to be indistinguishable from contained item. These
>> are rare case however, compared to all reference usage scenarios.
>>
>
>>
> Also the solution is not that weird - just avoid typing '.' by using a
>> pointer and ->.
>>
>
> Um, yes, it is rather weird to have what is clearly a *value type* and
> not be able to access its members using `.`. That's what `.` *is for*.
>
> Furthermore, "using a pointer and ->" means `std::addressof(a)->blah`.
> Which is extremely cumbersome.
>
> --
> 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/5f65dc7e-b808-4d23-
> 96e9-83bc1015d3a6%40isocpp.org
> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/5f65dc7e-b808-4d23-96e9-83bc1015d3a6%40isocpp.org?utm_medium=email&utm_source=footer>
> .
>
--
how am I supposed to end the twisted road of your hair in such a dark
night??
unless the candle of your face does shed some light upon my way!!!
--
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/CALDL7dGhXRZ6dyep6g0HhxOa8H0z1VyUFyv_vFHHyYGz%3DSE9RA%40mail.gmail.com.
--94eb2c0602660526ff053dfa90f6
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"rtl"><div class=3D"gmail_default" style=3D"text-align:left;font=
-family:"arial narrow",sans-serif;font-size:large" dir=3D"ltr">wh=
at if I want a smart ref which is also a smart ptr?</div><div class=3D"gmai=
l_default" style=3D"text-align:left;font-family:"arial narrow",sa=
ns-serif;font-size:large" dir=3D"ltr">what if the content of smart ref is a=
smart ptr?</div><div class=3D"gmail_default" style=3D"text-align:left;font=
-family:"arial narrow",sans-serif;font-size:large" dir=3D"ltr">wh=
at happens if the content is yet another smart ref?</div><div class=3D"gmai=
l_default" style=3D"text-align:left;font-family:"arial narrow",sa=
ns-serif;font-size:large" dir=3D"ltr">the last question applies to smart pt=
rs as well what if the object of a smart ptr is another smart ptr? smart pt=
rs have had this annoying defect and I am one of those who like it eliminat=
ed.</div><div class=3D"gmail_default" style=3D"text-align:right;font-family=
:"arial narrow",sans-serif;font-size:large" dir=3D"ltr">regards,<=
/div><div class=3D"gmail_default" style=3D"text-align:right;font-family:&qu=
ot;arial narrow",sans-serif;font-size:large" dir=3D"ltr">FM.</div></di=
v><div class=3D"gmail_extra"><br><div class=3D"gmail_quote"><div dir=3D"ltr=
">2016-09-21 22:11 GMT+03:30 Nicol Bolas <span dir=3D"ltr"><<a href=3D"m=
ailto:jmckesson@gmail.com" target=3D"_blank">jmckesson@gmail.com</a>></s=
pan>:</div><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;bor=
der-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><span class=3D""=
>On Wednesday, September 21, 2016 at 11:02:44 AM UTC-4, <a href=3D"mailto:m=
ihailn...@gmail.com" target=3D"_blank">mihailn...@gmail.com</a> wrote:<bloc=
kquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-lef=
t:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><blockquote class=3D"gm=
ail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,=
204,204);padding-left:1ex"><div class=3D"gmail_quote">Totally agreed. Membe=
rs of the contained object/reference should not take priority over members =
of the containing smart reference itself. Is that really what's current=
ly meant to happen here?<br></div></blockquote><div><br></div><div>It is no=
t that the member of the contained object is of having a priority. It is th=
e fact the the operator.() is always evaluated first.</div></div></blockquo=
te></span><div><br>... huh? Section 4.4 makes it perfectly clear that `a.re=
bind()` will call `Ref<X>::rebind()`, not `X::rebind()`. So how can `=
operator.()` be "always evaluated first"?<br><br></div><span clas=
s=3D""><blockquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8e=
x;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div></div>=
<blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-=
left:1px solid rgb(204,204,204);padding-left:1ex"><div class=3D"gmail_quote=
"></div></blockquote><blockquote class=3D"gmail_quote" style=3D"margin:0px =
0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">It s=
eems to me that the simpler rule is that if you have a Ref<X>, and yo=
u do `<a href=3D"http://a.name/" rel=3D"nofollow" target=3D"_blank">a.name<=
/a>`,=C2=A0<i>regardless</i>=C2=A0of what `name` is, if `Ref<X>` prov=
ides `name` then you should get `Ref<X>`'s `name` (overload resol=
ution of function calls aside).<br></blockquote><div><br></div><div>The ide=
a is to have the smart references be as the standard c++ references - indis=
tinguishable as the object they point to.=C2=A0</div></div></blockquote><bl=
ockquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-l=
eft:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div> This is why the=
y always redirect.</div></div></blockquote><div></div><blockquote class=3D"=
gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid=
;padding-left:1ex"><div dir=3D"ltr"><div>The other requirement is to be abl=
e to have additional features like rebind() - the "smart" part. F=
unctions on the handle will be called on it with priority.<br></div></div><=
/blockquote><blockquote class=3D"gmail_quote" style=3D"margin:0;margin-left=
:0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div>I=
f members had priority it will be very hard for the user to avid conflicts =
because this is a detail of the Ref and might even differ b/w implementatio=
ns, where functions are public interface. </div></div></blockquote></span><=
div><br>OK, so the problem is with private members whose names could confli=
ct with public ones on the contained value. So... why not fix <i>that</i>? =
Just have a rule that says that if the name in the handle is not accessible=
from the location where it is used, `operator.()` will be checked instead =
of making the program il-formed.<br><br>After all, classes have private mem=
ber <i>functions</i> too. And we don't want collisions between them and=
the public interface of the value type. You wouldn't want to restrict =
implementations of such types to having no private member functions, would =
you? After all, not all of these types are going to be in the standard libr=
ary, so not all of them can use the `_C`apital syntax reserved for standard=
library privates. Indeed, some of them might want to privately inherit fro=
m something (a CRTP base class, for example), which would expose its own pr=
ivate functions.<br><br>So it seems clear that we need a way to resolve the=
public/private issue <i>regardless</i> of member variable/function priorit=
y. Once the public/private issues is resolved, there's no real reason t=
o deny member variables from having the same priority as member functions.<=
br><br>To be sure, the rule will have to be finagled to deal with overloadi=
ng between public and private interfaces.<br><br>Ultimately, it seems wrong=
headed to me to say that member variable forwarding isn't important jus=
t because smart references/handles are what this feature is for, and they p=
robably wouldn't use them. We shouldn't gimp a=20
language feature just because the intended usage scenario wouldn't need=
=20
it.<br><br>I mean, `operator->` and `operator*` get used for things=20
that aren't "smart pointers" all the time (iterators, for exa=
mple). Let's=20
not make decisions based on what smart references/handles would do with=20
the feature.<br><br></div><span class=3D""><blockquote class=3D"gmail_quote=
" style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-le=
ft:1ex"><div dir=3D"ltr"><div></div><div></div><div>In any case the cctor a=
nd mctor will I think always be a bit hard, because you want the rare case =
to act on the container, not the contained item, but references are designe=
d to be indistinguishable from contained item. These are rare case however,=
compared to all reference usage scenarios.</div></div></blockquote><blockq=
uote style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,20=
4);padding-left:1ex" class=3D"gmail_quote"><div>=C2=A0</div></blockquote><b=
lockquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-=
left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div>Also the soluti=
on is not that weird - just avoid typing '.' by using a pointer and=
->.</div></div></blockquote></span><div><br>Um, yes, it is rather weird=
to have what is clearly a <i>value type</i> and not be able to access its =
members using `.`. That's what `.` <i>is for</i>.<br><br>Furthermore, &=
quot;using a pointer and ->" means `std::addressof(a)->blah`. Wh=
ich is extremely cumbersome.<br></div></div><span class=3D"">
<p></p>
-- <br>
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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" target=3D"_=
blank">std-proposals+unsubscribe@<wbr>isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">std-proposals@isocpp.org</a>.<br></span>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/5f65dc7e-b808-4d23-96e9-83bc1015d3a6%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter" target=3D"_blank">=
https://groups.google.com/a/<wbr>isocpp.org/d/msgid/std-<wbr>proposals/5f65=
dc7e-b808-4d23-<wbr>96e9-83bc1015d3a6%40isocpp.org</a><wbr>.<br>
</blockquote></div><br><br clear=3D"all"><div><br></div>-- <br><div class=
=3D"gmail_signature" data-smartmail=3D"gmail_signature"><div dir=3D"rtl"><d=
iv><div dir=3D"ltr">how am I supposed to end the twisted road of=C2=A0 your=
hair in such a dark night??<br>unless the candle of your face does shed so=
me light upon my way!!!<br></div></div></div></div>
</div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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/CALDL7dGhXRZ6dyep6g0HhxOa8H0z1VyUFyv_=
vFHHyYGz%3DSE9RA%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">h=
ttps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CALDL7dGhXRZ6dy=
ep6g0HhxOa8H0z1VyUFyv_vFHHyYGz%3DSE9RA%40mail.gmail.com</a>.<br />
--94eb2c0602660526ff053dfa90f6--
.
Author: Nicol Bolas <jmckesson@gmail.com>
Date: Mon, 3 Oct 2016 13:07:33 -0700 (PDT)
Raw View
------=_Part_254_458385280.1475525253566
Content-Type: multipart/alternative;
boundary="----=_Part_255_299570052.1475525253566"
------=_Part_255_299570052.1475525253566
Content-Type: text/plain; charset=UTF-8
On Monday, October 3, 2016 at 3:01:00 PM UTC-4, Farid Mehrabi wrote:
>
> what if I want a smart ref which is also a smart ptr?
>
.... why would you want to? Why would you want a smart reference to act like
a smart pointer? That doesn't make any sense.
> what if the content of smart ref is a smart ptr?
>
So what if it is? In accord with the aforementioned specification, an
"operation" (which for some reason member function calls qualify as but
data member access do not) on the smart reference type will use operator.
to call the referenced object if the smart reference itself doesn't have an
appropriate function.
So if a smart reference type doesn't have an operator-> or operator*, then
using those operators will attempt to call the referenced type's versions.
If it has none, then it's a compile error. If it has one, then it will be
called.
What's the problem?
what happens if the content is yet another smart ref?
> the last question applies to smart ptrs as well what if the object of a
> smart ptr is another smart ptr? smart ptrs have had this annoying defect
> and I am one of those who like it eliminated.
>
What defect are you talking about?
If you have a non-smart-pointer that points to a non-smart-pointer that
points to T, it works like this:
using ptrT = T*;
using ptrptrT = ptrT*;
ptrptrT ppT = ...;
*ppT //of type ptrT&
**ppT //of type T&
Smart pointers work the *exact same way*:
using unique_ptrT = unique_ptr<T>;
using unique_ptrptrT = unique_ptr<unique_ptrT>;
unique_ptrptrT ppT = ...;
*ppT //of type unique_ptrT&
**ppT //of type T&
There's no defect here with regard to smart pointers.
Now, you might be right that smart references shouldn't be able to do that.
But then, what I would say is that they should work exactly like regular
references: a reference to a reference to T doesn't exist. And therefore,
attempting to get a smart reference to a smart reference should be
explicitly forbidden by that type. So if there is some `unique_ref<T>`, it
should static_assert or something if you try to make a
`unique_ref<unique_ref<T>>`.
--
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/d82bf9d3-cde0-4b0f-8975-fb2754c65d92%40isocpp.org.
------=_Part_255_299570052.1475525253566
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">On Monday, October 3, 2016 at 3:01:00 PM UTC-4, Farid Mehr=
abi wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left:=
0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"rtl"><di=
v style=3D"text-align:left;font-family:"arial narrow",sans-serif;=
font-size:large" dir=3D"ltr">what if I want a smart ref which is also a sma=
rt ptr?</div></div></blockquote><div><br>... why would you want to? Why wou=
ld you want a smart reference to act like a smart pointer? That doesn't=
make any sense.<br>=C2=A0</div><blockquote class=3D"gmail_quote" style=3D"=
margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;=
"><div dir=3D"rtl"><div style=3D"text-align:left;font-family:"arial na=
rrow",sans-serif;font-size:large" dir=3D"ltr">what if the content of s=
mart ref is a smart ptr?</div></div></blockquote><div><br>So what if it is?=
In accord with the aforementioned specification, an "operation" =
(which for some reason member function calls qualify as but data member acc=
ess do not) on the smart reference type will use operator. to call the refe=
renced object if the smart reference itself doesn't have an appropriate=
function.<br><br>So if a smart reference type doesn't have an operator=
-> or operator*, then using those operators will attempt to call the ref=
erenced type's versions. If it has none, then it's a compile error.=
If it has one, then it will be called.<br><br>What's the problem?<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 dir=3D"rtl"><div=
style=3D"text-align:left;font-family:"arial narrow",sans-serif;f=
ont-size:large" dir=3D"ltr">what happens if the content is yet another smar=
t ref?</div><div style=3D"text-align:left;font-family:"arial narrow&qu=
ot;,sans-serif;font-size:large" dir=3D"ltr">the last question applies to sm=
art ptrs as well what if the object of a smart ptr is another smart ptr? sm=
art ptrs have had this annoying defect and I am one of those who like it el=
iminated.<br></div></div></blockquote><div><br>What defect are you talking =
about?<br><br>If you have a non-smart-pointer that points to a non-smart-po=
inter that points to T, it works like this:<br><br><div style=3D"background=
-color: rgb(250, 250, 250); border-color: rgb(187, 187, 187); border-style:=
solid; border-width: 1px; overflow-wrap: break-word;" class=3D"prettyprint=
"><code class=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D"=
color: #008;" class=3D"styled-by-prettify">using</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"> ptrT </span><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">=3D</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"> T</span><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">*;</span><span style=3D"color: #000;" class=3D"styled-by=
-prettify"><br></span><span style=3D"color: #008;" class=3D"styled-by-prett=
ify">using</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
ptrptrT </span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
=3D</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> ptrT</=
span><span style=3D"color: #660;" class=3D"styled-by-prettify">*;</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"><br><br>ptrptrT ppT =
</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=3D</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify">...;</span><span style=3D"=
color: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"color:=
#660;" class=3D"styled-by-prettify">*</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify">ppT </span><span style=3D"color: #800;" class=
=3D"styled-by-prettify">//of type ptrT&</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">**</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify">ppT </span><span style=3D"color: #800;" class=3D"styled-=
by-prettify">//of type T&</span></div></code></div><br>Smart pointers w=
ork the <i>exact same way</i>:<br><br><div style=3D"background-color: rgb(2=
50, 250, 250); border-color: rgb(187, 187, 187); border-style: solid; borde=
r-width: 1px; overflow-wrap: break-word;" class=3D"prettyprint"><code class=
=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D"color: #008;"=
class=3D"styled-by-prettify">using</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify"> unique_ptrT </span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">=3D</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify"> unique_ptr</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify"><</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify">T</span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">>;</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"><br></span><span style=3D"color: #008;" class=3D"styled-by-prettify">us=
ing</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> unique=
_ptrptrT </span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
=3D</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> unique=
_ptr</span><span style=3D"color: #080;" class=3D"styled-by-prettify"><un=
ique_ptrT></span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br><b=
r>unique_ptrptrT ppT </span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">=3D</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">...;<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span>=
<span style=3D"color: #660;" class=3D"styled-by-prettify">*</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify">ppT </span><span style=3D"=
color: #800;" class=3D"styled-by-prettify">//of type unique_ptrT&</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span=
style=3D"color: #660;" class=3D"styled-by-prettify">**</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify">ppT </span><span style=3D"co=
lor: #800;" class=3D"styled-by-prettify">//of type T&</span></div></cod=
e></div><br>There's no defect here with regard to smart pointers.<br><b=
r>Now, you might be right that smart references shouldn't be able to do=
that. But then, what I would say is that they should work exactly like reg=
ular references: a reference to a reference to T doesn't exist. And the=
refore, attempting to get a smart reference to a smart reference should be =
explicitly forbidden by that type. So if there is some `unique_ref<T>=
`, it should static_assert or something if you try to make a `unique_ref<=
;unique_ref<T>>`.<br>=C2=A0</div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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/d82bf9d3-cde0-4b0f-8975-fb2754c65d92%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/d82bf9d3-cde0-4b0f-8975-fb2754c65d92=
%40isocpp.org</a>.<br />
------=_Part_255_299570052.1475525253566--
------=_Part_254_458385280.1475525253566--
.
Author: Farid Mehrabi <farid.mehrabi@gmail.com>
Date: Tue, 4 Oct 2016 20:41:25 +0330
Raw View
--001a11458f84eaf193053e0d28dd
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
2016-10-03 23:37 GMT+03:30 Nicol Bolas <jmckesson@gmail.com>:
> On Monday, October 3, 2016 at 3:01:00 PM UTC-4, Farid Mehrabi wrote:
>>
>> what if I want a smart ref which is also a smart ptr?
>>
>
> ... why would you want to? Why would you want a smart reference to act
> like a smart pointer? That doesn't make any sense.
>
>
>> what if the content of smart ref is a smart ptr?
>>
>
> So what if it is? In accord with the aforementioned specification, an
> "operation" (which for some reason member function calls qualify as but
> data member access do not) on the smart reference type will use operator.
> to call the referenced object if the smart reference itself doesn't have =
an
> appropriate function.
>
> So if a smart reference type doesn't have an operator-> or operator*, the=
n
> using those operators will attempt to call the referenced type's versions=
..
> If it has none, then it's a compile error. If it has one, then it will be
> called.
>
> What's the problem?
>
> what happens if the content is yet another smart ref?
>> the last question applies to smart ptrs as well what if the object of a
>> smart ptr is another smart ptr? smart ptrs have had this annoying defect
>> and I am one of those who like it eliminated.
>>
>
> What defect are you talking about?
>
>
try this one:=E2=80=8B
struct
=E2=80=8B=E2=80=8B
test
{
void get() {};
};
struct smart_ptr {
std::unique_ptr<test> ptr;
auto& operator ->() { return ptr; };
};
smart_ptr ptr;
ptr->get();//
=E2=80=8B
test::get not unique_ptr::get.
this bugs (at least me).
regards,
FM.
=E2=80=8B
--=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/CALDL7dEPmqERgY2DycEVQbo_PDW4Lz3Oi6h1HJ63fWrjuMm=
-iQ%40mail.gmail.com.
--001a11458f84eaf193053e0d28dd
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"rtl"><div class=3D"gmail_default" style=3D"text-align:left"><di=
v class=3D"gmail_default" style=3D"direction:ltr">2016-10-03 23:37 GMT+03:3=
0 Nicol Bolas <span dir=3D"ltr"><<a href=3D"mailto:jmckesson@gmail.com" =
target=3D"_blank">jmckesson@gmail.com</a>></span>:<br></div></div><div c=
lass=3D"gmail_extra"><div class=3D"gmail_quote"><blockquote class=3D"gmail_=
quote" style=3D"margin:0px 0.8ex;border-left:1px solid rgb(204,204,204);bor=
der-right:1px solid rgb(204,204,204);padding-left:1ex;padding-right:1ex"><d=
iv dir=3D"ltr"><span class=3D"gmail-">On Monday, October 3, 2016 at 3:01:00=
PM UTC-4, Farid Mehrabi wrote:<blockquote class=3D"gmail_quote" style=3D"m=
argin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left=
:1ex"><div dir=3D"rtl"><div style=3D"text-align:left;font-family:"aria=
l narrow",sans-serif;font-size:large" dir=3D"ltr">what if I want a sma=
rt ref which is also a smart ptr?</div></div></blockquote></span><div><br>.=
... why would you want to? Why would you want a smart reference to act like =
a smart pointer? That doesn't make any sense.<br>=C2=A0</div><span clas=
s=3D"gmail-"><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px =
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir=3D"=
rtl"><div style=3D"text-align:left;font-family:"arial narrow",san=
s-serif;font-size:large" dir=3D"ltr">what if the content of smart ref is a =
smart ptr?</div></div></blockquote></span><div><br>So what if it is? In acc=
ord with the aforementioned specification, an "operation" (which =
for some reason member function calls qualify as but data member access do =
not) on the smart reference type will use operator. to call the referenced =
object if the smart reference itself doesn't have an appropriate functi=
on.<br><br>So if a smart reference type doesn't have an operator-> o=
r operator*, then using those operators will attempt to call the referenced=
type's versions. If it has none, then it's a compile error. If it =
has one, then it will be called.<br><br>What's the problem?<br><br></di=
v><span class=3D"gmail-"><blockquote class=3D"gmail_quote" style=3D"margin:=
0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">=
<div dir=3D"rtl"><div style=3D"text-align:left;font-family:"arial narr=
ow",sans-serif;font-size:large" dir=3D"ltr">what happens if the conten=
t is yet another smart ref?</div><div style=3D"text-align:left;font-family:=
"arial narrow",sans-serif;font-size:large" dir=3D"ltr">the last q=
uestion applies to smart ptrs as well what if the object of a smart ptr is =
another smart ptr? smart ptrs have had this annoying defect and I am one of=
those who like it eliminated.<br></div></div></blockquote></span><div><br>=
What defect are you talking about?<br><br></div></div></blockquote><div>=C2=
=A0</div><div style=3D"text-align:left"><div class=3D"gmail_default" style=
=3D"font-family:"arial narrow",sans-serif;font-size:large;display=
:inline" dir=3D"ltr">try this one:=E2=80=8B</div></div><div style=3D"text-a=
lign:left"><span style=3D"font-family:"arial narrow",sans-serif;f=
ont-size:large">struct <div class=3D"gmail_default" style=3D"font-family:&q=
uot;arial narrow",sans-serif;font-size:large;display:inline">=E2=80=8B=
=E2=80=8B</div>test</span></div><div class=3D"gmail_default"><div class=3D"=
gmail_default" style=3D"direction:ltr"><font face=3D"arial narrow, sans-ser=
if" size=3D"4">{</font></div><div class=3D"gmail_default" style=3D"directio=
n:ltr"><font face=3D"arial narrow, sans-serif" size=3D"4"><span class=3D"gm=
ail-Apple-tab-span" style=3D"white-space:pre"> </span>void get() {};</font>=
</div><div class=3D"gmail_default" style=3D"direction:ltr"><font face=3D"ar=
ial narrow, sans-serif" size=3D"4">};</font></div><div class=3D"gmail_defau=
lt" style=3D"direction:ltr"><font face=3D"arial narrow, sans-serif" size=3D=
"4"><br></font></div><div class=3D"gmail_default" style=3D"direction:ltr"><=
font face=3D"arial narrow, sans-serif" size=3D"4">struct<span class=3D"gmai=
l-Apple-tab-span" style=3D"white-space:pre"> </span>=C2=A0=C2=A0smart_ptr {=
</font></div><div class=3D"gmail_default" style=3D"direction:ltr"><font fac=
e=3D"arial narrow, sans-serif" size=3D"4"><span class=3D"gmail-Apple-tab-sp=
an" style=3D"white-space:pre"> </span>std::unique_ptr<test> ptr;</fon=
t></div><div class=3D"gmail_default" style=3D"direction:ltr"><font face=3D"=
arial narrow, sans-serif" size=3D"4"><span class=3D"gmail-Apple-tab-span" s=
tyle=3D"white-space:pre"> </span>auto& operator ->() { return ptr; }=
;</font></div><div class=3D"gmail_default" style=3D"direction:ltr"><font fa=
ce=3D"arial narrow, sans-serif" size=3D"4">};</font></div><div class=3D"gma=
il_default" style=3D"direction:ltr"><font face=3D"arial narrow, sans-serif"=
size=3D"4"><br></font></div><div class=3D"gmail_default" style=3D"directio=
n:ltr"><span class=3D"gmail-Apple-tab-span" style=3D"font-family:"aria=
l narrow",sans-serif;font-size:large;white-space:pre"> </span><span st=
yle=3D"font-family:"arial narrow",sans-serif;font-size:large">sma=
rt_ptr ptr;</span><br></div><div class=3D"gmail_default" style=3D"direction=
:ltr"><font face=3D"arial narrow, sans-serif" size=3D"4"><span class=3D"gma=
il-Apple-tab-span" style=3D"white-space:pre"> </span>ptr->get();//</font=
><div class=3D"gmail_default" style=3D"font-family:"arial narrow"=
,sans-serif;font-size:large;display:inline">=E2=80=8B</div><span style=3D"f=
ont-family:"arial narrow",sans-serif;font-size:large">test::get n=
ot=C2=A0</span><span style=3D"font-family:"arial narrow",sans-ser=
if;font-size:large">unique_ptr::get.=C2=A0</span></div><div class=3D"gmail_=
default" style=3D"direction:ltr"><span style=3D"font-family:"arial nar=
row",sans-serif;font-size:large"><br></span></div><div class=3D"gmail_=
default" dir=3D"ltr"><span style=3D"font-family:"arial narrow",sa=
ns-serif;font-size:large">this bugs (at least me).=C2=A0</span></div><div s=
tyle=3D"direction:ltr;font-family:"arial narrow",sans-serif;font-=
size:large"><br></div><div style=3D"text-align:right;font-family:"aria=
l narrow",sans-serif;font-size:large" dir=3D"ltr">regards,</div><div s=
tyle=3D"text-align:right;font-family:"arial narrow",sans-serif;fo=
nt-size:large" dir=3D"ltr">FM.</div></div><div class=3D"gmail_extra"><br><d=
iv class=3D"gmail_quote"></div></div><div style=3D"text-align:left"><div cl=
ass=3D"gmail_default" style=3D"font-family:"arial narrow",sans-se=
rif;font-size:large;display:inline">=E2=80=8B</div>=C2=A0</div></div>
</div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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/CALDL7dEPmqERgY2DycEVQbo_PDW4Lz3Oi6h1=
HJ63fWrjuMm-iQ%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">htt=
ps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CALDL7dEPmqERgY2D=
ycEVQbo_PDW4Lz3Oi6h1HJ63fWrjuMm-iQ%40mail.gmail.com</a>.<br />
--001a11458f84eaf193053e0d28dd--
.
Author: Tony V E <tvaneerd@gmail.com>
Date: Tue, 4 Oct 2016 13:21:37 -0400
Raw View
--94eb2c12fb8a0764a5053e0d4b2f
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
On Tue, Oct 4, 2016 at 1:11 PM, Farid Mehrabi <farid.mehrabi@gmail.com>
wrote:
> 2016-10-03 23:37 GMT+03:30 Nicol Bolas <jmckesson@gmail.com>:
>
>> On Monday, October 3, 2016 at 3:01:00 PM UTC-4, Farid Mehrabi wrote:
>>>
>>> what if I want a smart ref which is also a smart ptr?
>>>
>>
>> ... why would you want to? Why would you want a smart reference to act
>> like a smart pointer? That doesn't make any sense.
>>
>>
>>> what if the content of smart ref is a smart ptr?
>>>
>>
>> So what if it is? In accord with the aforementioned specification, an
>> "operation" (which for some reason member function calls qualify as but
>> data member access do not) on the smart reference type will use operator=
..
>> to call the referenced object if the smart reference itself doesn't have=
an
>> appropriate function.
>>
>> So if a smart reference type doesn't have an operator-> or operator*,
>> then using those operators will attempt to call the referenced type's
>> versions. If it has none, then it's a compile error. If it has one, then=
it
>> will be called.
>>
>> What's the problem?
>>
>> what happens if the content is yet another smart ref?
>>> the last question applies to smart ptrs as well what if the object of a
>>> smart ptr is another smart ptr? smart ptrs have had this annoying defec=
t
>>> and I am one of those who like it eliminated.
>>>
>>
>> What defect are you talking about?
>>
>>
> try this one:=E2=80=8B
> struct
> =E2=80=8B=E2=80=8B
> test
> {
> void get() {};
> };
>
> struct smart_ptr {
> std::unique_ptr<test> ptr;
> auto& operator ->() { return ptr; };
> };
>
> smart_ptr ptr;
> ptr->get();//
> =E2=80=8B
> test::get not unique_ptr::get.
>
> this bugs (at least me).
>
Given that this "defect" has been there - as part of the design - since the
beginning of overloading ->, it isn't likely to be changed;
so what then do you think we should do with operator dot? - mirroring the
same behaviour seems sensible to me.
--=20
Be seeing you,
Tony
--=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/CAOHCbitTRkx9O01GK%2BvaKSDGrejJO%2Bq15pNAsCzhjap=
neRYCxQ%40mail.gmail.com.
--94eb2c12fb8a0764a5053e0d4b2f
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><br><div class=3D"gmail_extra"><br><div class=3D"gmail_quo=
te">On Tue, Oct 4, 2016 at 1:11 PM, Farid Mehrabi <span dir=3D"ltr"><<a =
href=3D"mailto:farid.mehrabi@gmail.com" target=3D"_blank">farid.mehrabi@gma=
il.com</a>></span> wrote:<br><blockquote class=3D"gmail_quote" style=3D"=
margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"=
rtl"><span class=3D""><div style=3D"text-align:left"><div style=3D"directio=
n:ltr">2016-10-03 23:37 GMT+03:30 Nicol Bolas <span dir=3D"ltr"><<a href=
=3D"mailto:jmckesson@gmail.com" target=3D"_blank">jmckesson@gmail.com</a>&g=
t;</span>:<br></div></div></span><div class=3D"gmail_extra"><div class=3D"g=
mail_quote"><span class=3D""><blockquote class=3D"gmail_quote" style=3D"mar=
gin:0px 0.8ex;border-left:1px solid rgb(204,204,204);border-right:1px solid=
rgb(204,204,204);padding-left:1ex;padding-right:1ex"><div dir=3D"ltr"><spa=
n class=3D"m_-6161057886578964202gmail-">On Monday, October 3, 2016 at 3:01=
:00 PM UTC-4, Farid Mehrabi wrote:<blockquote class=3D"gmail_quote" style=
=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding=
-left:1ex"><div dir=3D"rtl"><div style=3D"text-align:left;font-family:"=
;arial narrow",sans-serif;font-size:large" dir=3D"ltr">what if I want =
a smart ref which is also a smart ptr?</div></div></blockquote></span><div>=
<br>... why would you want to? Why would you want a smart reference to act =
like a smart pointer? That doesn't make any sense.<br>=C2=A0</div><span=
class=3D"m_-6161057886578964202gmail-"><blockquote class=3D"gmail_quote" s=
tyle=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);pad=
ding-left:1ex"><div dir=3D"rtl"><div style=3D"text-align:left;font-family:&=
quot;arial narrow",sans-serif;font-size:large" dir=3D"ltr">what if the=
content of smart ref is a smart ptr?</div></div></blockquote></span><div><=
br>So what if it is? In accord with the aforementioned specification, an &q=
uot;operation" (which for some reason member function calls qualify as=
but data member access do not) on the smart reference type will use operat=
or. to call the referenced object if the smart reference itself doesn't=
have an appropriate function.<br><br>So if a smart reference type doesn=
9;t have an operator-> or operator*, then using those operators will att=
empt to call the referenced type's versions. If it has none, then it=
9;s a compile error. If it has one, then it will be called.<br><br>What'=
;s the problem?<br><br></div><span class=3D"m_-6161057886578964202gmail-"><=
blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-l=
eft:1px solid rgb(204,204,204);padding-left:1ex"><div dir=3D"rtl"><div styl=
e=3D"text-align:left;font-family:"arial narrow",sans-serif;font-s=
ize:large" dir=3D"ltr">what happens if the content is yet another smart ref=
?</div><div style=3D"text-align:left;font-family:"arial narrow",s=
ans-serif;font-size:large" dir=3D"ltr">the last question applies to smart p=
trs as well what if the object of a smart ptr is another smart ptr? smart p=
trs have had this annoying defect and I am one of those who like it elimina=
ted.<br></div></div></blockquote></span><div><br>What defect are you talkin=
g about?<br><br></div></div></blockquote><div>=C2=A0</div></span><div style=
=3D"text-align:left"><div style=3D"font-family:"arial narrow",san=
s-serif;font-size:large;display:inline" dir=3D"ltr">try this one:=E2=80=8B<=
/div></div><div style=3D"text-align:left"><span style=3D"font-family:"=
arial narrow",sans-serif;font-size:large">struct <div style=3D"font-fa=
mily:"arial narrow",sans-serif;font-size:large;display:inline">=
=E2=80=8B=E2=80=8B</div>test</span></div><div><div style=3D"direction:ltr">=
<font size=3D"4" face=3D"arial narrow, sans-serif">{</font></div><div style=
=3D"direction:ltr"><font size=3D"4" face=3D"arial narrow, sans-serif"><span=
class=3D"m_-6161057886578964202gmail-Apple-tab-span" style=3D"white-space:=
pre-wrap"> </span>void get() {};</font></div><div style=3D"direction:ltr"><=
font size=3D"4" face=3D"arial narrow, sans-serif">};</font></div><div style=
=3D"direction:ltr"><font size=3D"4" face=3D"arial narrow, sans-serif"><br><=
/font></div><div style=3D"direction:ltr"><font size=3D"4" face=3D"arial nar=
row, sans-serif">struct<span class=3D"m_-6161057886578964202gmail-Apple-tab=
-span" style=3D"white-space:pre-wrap"> </span>=C2=A0=C2=A0smart_ptr {</font=
></div><div style=3D"direction:ltr"><font size=3D"4" face=3D"arial narrow, =
sans-serif"><span class=3D"m_-6161057886578964202gmail-Apple-tab-span" styl=
e=3D"white-space:pre-wrap"> </span>std::unique_ptr<test> ptr;</font><=
/div><div style=3D"direction:ltr"><font size=3D"4" face=3D"arial narrow, sa=
ns-serif"><span class=3D"m_-6161057886578964202gmail-Apple-tab-span" style=
=3D"white-space:pre-wrap"> </span>auto& operator ->() { return ptr; =
};</font></div><div style=3D"direction:ltr"><font size=3D"4" face=3D"arial =
narrow, sans-serif">};</font></div><div style=3D"direction:ltr"><font size=
=3D"4" face=3D"arial narrow, sans-serif"><br></font></div><div style=3D"dir=
ection:ltr"><span class=3D"m_-6161057886578964202gmail-Apple-tab-span" styl=
e=3D"font-family:"arial narrow",sans-serif;font-size:large;white-=
space:pre-wrap"> </span><span style=3D"font-family:"arial narrow"=
,sans-serif;font-size:large">smart_ptr ptr;</span><br></div><div style=3D"d=
irection:ltr"><font size=3D"4" face=3D"arial narrow, sans-serif"><span clas=
s=3D"m_-6161057886578964202gmail-Apple-tab-span" style=3D"white-space:pre-w=
rap"> </span>ptr->get();//</font><div style=3D"font-family:"arial n=
arrow",sans-serif;font-size:large;display:inline">=E2=80=8B</div><span=
style=3D"font-family:"arial narrow",sans-serif;font-size:large">=
test::get not=C2=A0</span><span style=3D"font-family:"arial narrow&quo=
t;,sans-serif;font-size:large">unique_ptr::get.=C2=A0</span></div><div styl=
e=3D"direction:ltr"><span style=3D"font-family:"arial narrow",san=
s-serif;font-size:large"><br></span></div><div dir=3D"ltr"><span style=3D"f=
ont-family:"arial narrow",sans-serif;font-size:large">this bugs (=
at least me).=C2=A0</span></div></div></div></div></div></blockquote><div><=
br><br></div><div>Given that this "defect" has been there - as pa=
rt of the design - since the beginning of overloading ->, it isn't l=
ikely to be changed;<br>so what then do you think we should do with operato=
r dot? - mirroring the same behaviour seems sensible to me.<br><br></div></=
div>-- <br><div class=3D"gmail_signature" data-smartmail=3D"gmail_signature=
"><div dir=3D"ltr"><div>Be seeing you,<br></div>Tony<br></div></div>
</div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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/CAOHCbitTRkx9O01GK%2BvaKSDGrejJO%2Bq1=
5pNAsCzhjapneRYCxQ%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter"=
>https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAOHCbitTRkx9=
O01GK%2BvaKSDGrejJO%2Bq15pNAsCzhjapneRYCxQ%40mail.gmail.com</a>.<br />
--94eb2c12fb8a0764a5053e0d4b2f--
.
Author: Ville Voutilainen <ville.voutilainen@gmail.com>
Date: Tue, 4 Oct 2016 20:40:45 +0300
Raw View
On 4 October 2016 at 20:21, Tony V E <tvaneerd@gmail.com> wrote:
>> try this one:
>> struct
>> test
>> {
>> void get() {};
>> };
>>
>> struct smart_ptr {
>> std::unique_ptr<test> ptr;
>> auto& operator ->() { return ptr; };
>> };
>>
>> smart_ptr ptr;
>> ptr->get();//
>> test::get not unique_ptr::get.
>>
>> this bugs (at least me).
>
>
>
> Given that this "defect" has been there - as part of the design - since the
> beginning of overloading ->, it isn't likely to be changed;
> so what then do you think we should do with operator dot? - mirroring the
> same behaviour seems sensible to me.
The operator dot proposals have never proposed mirroring that
behavior. They have consistently
suggested that if the operation is found by lookup in the handle's
hierarchy, the handle's operation
is used, not the operation of the referred-to entity.
--
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/CAFk2RUbYB0Mt%2B9p7ZsD%3DspZBn8yCZ%3DSqRWZXxM5QawXFOmDnXQ%40mail.gmail.com.
.
Author: Nicol Bolas <jmckesson@gmail.com>
Date: Tue, 4 Oct 2016 15:35:52 -0700 (PDT)
Raw View
------=_Part_744_578175786.1475620552770
Content-Type: multipart/alternative;
boundary="----=_Part_745_1560402565.1475620552770"
------=_Part_745_1560402565.1475620552770
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
On Tuesday, October 4, 2016 at 1:12:11 PM UTC-4, Farid Mehrabi wrote:
>
> 2016-10-03 23:37 GMT+03:30 Nicol Bolas <jmck...@gmail.com <javascript:>>:
>
>> On Monday, October 3, 2016 at 3:01:00 PM UTC-4, Farid Mehrabi wrote:
>>>
>>> what if I want a smart ref which is also a smart ptr?
>>>
>>
>> ... why would you want to? Why would you want a smart reference to act=
=20
>> like a smart pointer? That doesn't make any sense.
>> =20
>>
>>> what if the content of smart ref is a smart ptr?
>>>
>>
>> So what if it is? In accord with the aforementioned specification, an=20
>> "operation" (which for some reason member function calls qualify as but=
=20
>> data member access do not) on the smart reference type will use operator=
..=20
>> to call the referenced object if the smart reference itself doesn't have=
an=20
>> appropriate function.
>>
>> So if a smart reference type doesn't have an operator-> or operator*,=20
>> then using those operators will attempt to call the referenced type's=20
>> versions. If it has none, then it's a compile error. If it has one, then=
it=20
>> will be called.
>>
>> What's the problem?
>>
>> what happens if the content is yet another smart ref?
>>> the last question applies to smart ptrs as well what if the object of a=
=20
>>> smart ptr is another smart ptr? smart ptrs have had this annoying defec=
t=20
>>> and I am one of those who like it eliminated.
>>>
>>
>> What defect are you talking about?
>>
>> =20
> try this one:=E2=80=8B
> struct=20
> =E2=80=8B=E2=80=8B
> test
> {
> void get() {};
> };
>
> struct smart_ptr {
> std::unique_ptr<test> ptr;
> auto& operator ->() { return ptr; };
> };
>
> smart_ptr ptr;
> ptr->get();//
> =E2=80=8B
> test::get not unique_ptr::get.=20
>
> this bugs (at least me).
>
That bugs you? That is literally the *whole point* of overloading=20
`operator->`: so that it accesses the value held by the smart pointer=20
rather than the smart pointer object itself. It takes syntax that would=20
have been a compile error and turns it into syntax with a well-defined=20
meaning.
If you want to access the object, you use `.`. If you want to access what=
=20
it points to, you use `->`. This is exactly as it *should be*; otherwise,=
=20
smart pointers would hide elements of the interface of the objects they=20
point to. It also makes it clear to a user reading the code what the writer=
=20
intended. If you see `.`, then you know the code is accessing the smart=20
pointer object. If you see `->`, then you know the code is accessing the=20
object being pointed to.
--=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/299fbbb7-c4b2-434d-972c-556f07dfb3fd%40isocpp.or=
g.
------=_Part_745_1560402565.1475620552770
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><br><br>On Tuesday, October 4, 2016 at 1:12:11 PM UTC-4, F=
arid Mehrabi wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;mar=
gin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D=
"rtl"><div style=3D"text-align:left"><div style=3D"direction:ltr">2016-10-0=
3 23:37 GMT+03:30 Nicol Bolas <span dir=3D"ltr"><<a href=3D"javascript:"=
target=3D"_blank" gdf-obfuscated-mailto=3D"s_yNZvUzBwAJ" rel=3D"nofollow" =
onmousedown=3D"this.href=3D'javascript:';return true;" onclick=3D"t=
his.href=3D'javascript:';return true;">jmck...@gmail.com</a>></s=
pan>:<br></div></div><div><div class=3D"gmail_quote"><blockquote class=3D"g=
mail_quote" style=3D"margin:0px 0.8ex;border-left:1px solid rgb(204,204,204=
);border-right:1px solid rgb(204,204,204);padding-left:1ex;padding-right:1e=
x"><div dir=3D"ltr"><span>On Monday, October 3, 2016 at 3:01:00 PM UTC-4, F=
arid Mehrabi wrote:<blockquote class=3D"gmail_quote" style=3D"margin:0px 0p=
x 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div d=
ir=3D"rtl"><div style=3D"text-align:left;font-family:"arial narrow&quo=
t;,sans-serif;font-size:large" dir=3D"ltr">what if I want a smart ref which=
is also a smart ptr?</div></div></blockquote></span><div><br>... why would=
you want to? Why would you want a smart reference to act like a smart poin=
ter? That doesn't make any sense.<br>=C2=A0</div><span><blockquote clas=
s=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid r=
gb(204,204,204);padding-left:1ex"><div dir=3D"rtl"><div style=3D"text-align=
:left;font-family:"arial narrow",sans-serif;font-size:large" dir=
=3D"ltr">what if the content of smart ref is a smart ptr?</div></div></bloc=
kquote></span><div><br>So what if it is? In accord with the aforementioned =
specification, an "operation" (which for some reason member funct=
ion calls qualify as but data member access do not) on the smart reference =
type will use operator. to call the referenced object if the smart referenc=
e itself doesn't have an appropriate function.<br><br>So if a smart ref=
erence type doesn't have an operator-> or operator*, then using thos=
e operators will attempt to call the referenced type's versions. If it =
has none, then it's a compile error. If it has one, then it will be cal=
led.<br><br>What's the problem?<br><br></div><span><blockquote class=3D=
"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(2=
04,204,204);padding-left:1ex"><div dir=3D"rtl"><div style=3D"text-align:lef=
t;font-family:"arial narrow",sans-serif;font-size:large" dir=3D"l=
tr">what happens if the content is yet another smart ref?</div><div style=
=3D"text-align:left;font-family:"arial narrow",sans-serif;font-si=
ze:large" dir=3D"ltr">the last question applies to smart ptrs as well what =
if the object of a smart ptr is another smart ptr? smart ptrs have had this=
annoying defect and I am one of those who like it eliminated.<br></div></d=
iv></blockquote></span><div><br>What defect are you talking about?<br><br><=
/div></div></blockquote><div>=C2=A0</div><div style=3D"text-align:left"><di=
v style=3D"font-family:"arial narrow",sans-serif;font-size:large;=
display:inline" dir=3D"ltr">try this one:=E2=80=8B</div></div><div style=3D=
"text-align:left"><span style=3D"font-family:"arial narrow",sans-=
serif;font-size:large">struct <div style=3D"font-family:"arial narrow&=
quot;,sans-serif;font-size:large;display:inline">=E2=80=8B=E2=80=8B</div>te=
st</span></div><div><div style=3D"direction:ltr"><font size=3D"4" face=3D"a=
rial narrow, sans-serif">{</font></div><div style=3D"direction:ltr"><font s=
ize=3D"4" face=3D"arial narrow, sans-serif"><span style=3D"white-space:pre"=
> </span>void get() {};</font></div><div style=3D"direction:ltr"><font size=
=3D"4" face=3D"arial narrow, sans-serif">};</font></div><div style=3D"direc=
tion:ltr"><font size=3D"4" face=3D"arial narrow, sans-serif"><br></font></d=
iv><div style=3D"direction:ltr"><font size=3D"4" face=3D"arial narrow, sans=
-serif">struct<span style=3D"white-space:pre"> </span>=C2=A0=C2=A0smart_ptr=
{</font></div><div style=3D"direction:ltr"><font size=3D"4" face=3D"arial =
narrow, sans-serif"><span style=3D"white-space:pre"> </span>std::unique_ptr=
<test> ptr;</font></div><div style=3D"direction:ltr"><font size=3D"4"=
face=3D"arial narrow, sans-serif"><span style=3D"white-space:pre"> </span>=
auto& operator ->() { return ptr; };</font></div><div style=3D"direc=
tion:ltr"><font size=3D"4" face=3D"arial narrow, sans-serif">};</font></div=
><div style=3D"direction:ltr"><font size=3D"4" face=3D"arial narrow, sans-s=
erif"><br></font></div><div style=3D"direction:ltr"><span style=3D"font-fam=
ily:"arial narrow",sans-serif;font-size:large;white-space:pre"> <=
/span><span style=3D"font-family:"arial narrow",sans-serif;font-s=
ize:large">smart_ptr ptr;</span><br></div><div style=3D"direction:ltr"><fon=
t size=3D"4" face=3D"arial narrow, sans-serif"><span style=3D"white-space:p=
re"> </span>ptr->get();//</font><div style=3D"font-family:"arial na=
rrow",sans-serif;font-size:large;display:inline">=E2=80=8B</div><span =
style=3D"font-family:"arial narrow",sans-serif;font-size:large">t=
est::get not=C2=A0</span><span style=3D"font-family:"arial narrow"=
;,sans-serif;font-size:large">unique_ptr::get.=C2=A0</span></div><div style=
=3D"direction:ltr"><span style=3D"font-family:"arial narrow",sans=
-serif;font-size:large"><br></span></div><div dir=3D"ltr"><span style=3D"fo=
nt-family:"arial narrow",sans-serif;font-size:large">this bugs (a=
t least me).</span></div></div></div></div></div></blockquote><div><br>That=
bugs you? That is literally the <i>whole point</i> of overloading `operato=
r->`: so that it accesses the value held by the smart pointer rather tha=
n the smart pointer object itself. It takes syntax that would have been a c=
ompile error and turns it into syntax with a well-defined meaning.<br><br>I=
f you want to access the object, you use `.`. If you want to access what it=
points to, you use `->`. This is exactly as it <i>should be</i>; otherw=
ise, smart pointers would hide elements of the interface of the objects the=
y point to. It also makes it clear to a user reading the code what the writ=
er intended. If you see `.`, then you know the code is accessing the smart =
pointer object. If you see `->`, then you know the code is accessing the=
object being pointed to.<br></div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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/299fbbb7-c4b2-434d-972c-556f07dfb3fd%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/299fbbb7-c4b2-434d-972c-556f07dfb3fd=
%40isocpp.org</a>.<br />
------=_Part_745_1560402565.1475620552770--
------=_Part_744_578175786.1475620552770--
.
Author: arthur.odwyer@mixpanel.com
Date: Tue, 4 Oct 2016 18:31:15 -0700 (PDT)
Raw View
------=_Part_178_606368930.1475631075799
Content-Type: multipart/alternative;
boundary="----=_Part_179_415851440.1475631075800"
------=_Part_179_415851440.1475631075800
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
On Tuesday, October 4, 2016 at 10:12:11 AM UTC-7, Farid Mehrabi wrote:
>
> 2016-10-03 23:37 GMT+03:30 Nicol Bolas <jmck...@gmail.com <javascript:>>:
>
>> On Monday, October 3, 2016 at 3:01:00 PM UTC-4, Farid Mehrabi wrote:
>>>
>>> what if I want a smart ref which is also a smart ptr?
>>>
>>
>> ... why would you want to? Why would you want a smart reference to act=
=20
>> like a smart pointer? That doesn't make any sense.
>> =20
>>
>>> what if the content of smart ref is a smart ptr?
>>>
>>
>> So what if it is? In accord with the aforementioned specification, an=20
>> "operation" (which for some reason member function calls qualify as but=
=20
>> data member access do not) on the smart reference type will use operator=
..=20
>> to call the referenced object if the smart reference itself doesn't have=
an=20
>> appropriate function.
>>
>> So if a smart reference type doesn't have an operator-> or operator*,=20
>> then using those operators will attempt to call the referenced type's=20
>> versions. If it has none, then it's a compile error. If it has one, then=
it=20
>> will be called.
>>
>> What's the problem?
>>
> =20
> try this one:=E2=80=8B
> struct=20
> =E2=80=8B=E2=80=8B
> test
> {
> void get() {};
> };
>
> struct smart_ptr {
> std::unique_ptr<test> ptr;
> auto& operator ->() { return ptr; };
> };
>
> smart_ptr ptr;
> ptr->get();//
> =E2=80=8B
> test::get not unique_ptr::get.=20
>
> this bugs (at least me).=20
>
You've got a probably-a-bug in there: you're returning auto& from your=20
overloaded operator-> when you probably meant to return auto*.
If you make that change, your code will do what you expect =E2=80=94 it'll =
call=20
unique_ptr::get().
http://melpon.org/wandbox/permlink/vYHBEc5fMnMW6YRQ
=E2=80=93Arthur
>
--=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/e6e70787-2ca6-4f75-a142-37312b6bb29d%40isocpp.or=
g.
------=_Part_179_415851440.1475631075800
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">On Tuesday, October 4, 2016 at 10:12:11 AM UTC-7, Farid Me=
hrabi wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-lef=
t: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"rtl"><=
div style=3D"text-align:left"><div style=3D"direction:ltr">2016-10-03 23:37=
GMT+03:30 Nicol Bolas <span dir=3D"ltr"><<a href=3D"javascript:" target=
=3D"_blank" gdf-obfuscated-mailto=3D"s_yNZvUzBwAJ" rel=3D"nofollow" onmouse=
down=3D"this.href=3D'javascript:';return true;" onclick=3D"this.hre=
f=3D'javascript:';return true;">jmck...@gmail.com</a>></span>:<b=
r></div></div><div><div class=3D"gmail_quote"><blockquote class=3D"gmail_qu=
ote" style=3D"margin:0px 0.8ex;border-left:1px solid rgb(204,204,204);borde=
r-right:1px solid rgb(204,204,204);padding-left:1ex;padding-right:1ex"><div=
dir=3D"ltr"><span>On Monday, October 3, 2016 at 3:01:00 PM UTC-4, Farid Me=
hrabi wrote:<blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0=
..8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir=3D"r=
tl"><div style=3D"text-align:left;font-family:"arial narrow",sans=
-serif;font-size:large" dir=3D"ltr">what if I want a smart ref which is als=
o a smart ptr?</div></div></blockquote></span><div><br>... why would you wa=
nt to? Why would you want a smart reference to act like a smart pointer? Th=
at doesn't make any sense.<br>=C2=A0</div><span><blockquote class=3D"gm=
ail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,=
204,204);padding-left:1ex"><div dir=3D"rtl"><div style=3D"text-align:left;f=
ont-family:"arial narrow",sans-serif;font-size:large" dir=3D"ltr"=
>what if the content of smart ref is a smart ptr?</div></div></blockquote><=
/span><div><br>So what if it is? In accord with the aforementioned specific=
ation, an "operation" (which for some reason member function call=
s qualify as but data member access do not) on the smart reference type wil=
l use operator. to call the referenced object if the smart reference itself=
doesn't have an appropriate function.<br><br>So if a smart reference t=
ype doesn't have an operator-> or operator*, then using those operat=
ors will attempt to call the referenced type's versions. If it has none=
, then it's a compile error. If it has one, then it will be called.<br>=
<br>What's the problem?</div></div></blockquote><div>=C2=A0</div><div s=
tyle=3D"text-align:left"><div style=3D"font-family:"arial narrow"=
,sans-serif;font-size:large;display:inline" dir=3D"ltr">try this one:=E2=80=
=8B</div></div><div style=3D"text-align:left"><span style=3D"font-family:&q=
uot;arial narrow",sans-serif;font-size:large">struct <div style=3D"fon=
t-family:"arial narrow",sans-serif;font-size:large;display:inline=
">=E2=80=8B=E2=80=8B</div>test</span></div><div><div style=3D"direction:ltr=
"><font face=3D"arial narrow, sans-serif" size=3D"4">{</font></div><div sty=
le=3D"direction:ltr"><font face=3D"arial narrow, sans-serif" size=3D"4"><sp=
an style=3D"white-space:pre"> </span>void get() {};</font></div><div style=
=3D"direction:ltr"><font face=3D"arial narrow, sans-serif" size=3D"4">};</f=
ont></div><div style=3D"direction:ltr"><font face=3D"arial narrow, sans-ser=
if" size=3D"4"><br></font></div><div style=3D"direction:ltr"><font face=3D"=
arial narrow, sans-serif" size=3D"4">struct<span style=3D"white-space:pre">=
</span>=C2=A0=C2=A0smart_ptr {</font></div><div style=3D"direction:ltr"><f=
ont face=3D"arial narrow, sans-serif" size=3D"4"><span style=3D"white-space=
:pre"> </span>std::unique_ptr<test> ptr;</font></div><div style=3D"di=
rection:ltr"><font face=3D"arial narrow, sans-serif" size=3D"4"><span style=
=3D"white-space:pre"> </span>auto& operator ->() { return ptr; };</f=
ont></div><div style=3D"direction:ltr"><font face=3D"arial narrow, sans-ser=
if" size=3D"4">};</font></div><div style=3D"direction:ltr"><font face=3D"ar=
ial narrow, sans-serif" size=3D"4"><br></font></div><div style=3D"direction=
:ltr"><span style=3D"font-family:"arial narrow",sans-serif;font-s=
ize:large;white-space:pre"> </span><span style=3D"font-family:"arial n=
arrow",sans-serif;font-size:large">smart_ptr ptr;</span><br></div><div=
style=3D"direction:ltr"><font face=3D"arial narrow, sans-serif" size=3D"4"=
><span style=3D"white-space:pre"> </span>ptr->get();//</font><div style=
=3D"font-family:"arial narrow",sans-serif;font-size:large;display=
:inline">=E2=80=8B</div><span style=3D"font-family:"arial narrow"=
,sans-serif;font-size:large">test::get not=C2=A0</span><span style=3D"font-=
family:"arial narrow",sans-serif;font-size:large">unique_ptr::get=
..=C2=A0</span></div><div style=3D"direction:ltr"><span style=3D"font-family=
:"arial narrow",sans-serif;font-size:large"><br></span></div><div=
dir=3D"ltr"><span style=3D"font-family:"arial narrow",sans-serif=
;font-size:large">this bugs (at least me).=C2=A0</span></div></div></div></=
div></div></blockquote><div><br></div><div>You've got a probably-a-bug =
in there: you're returning <font face=3D"courier new, monospace">auto&a=
mp;</font> from your overloaded <font face=3D"courier new, monospace">opera=
tor-></font> when you probably meant to return <font face=3D"courier new=
, monospace">auto*</font>.</div><div>If you make that change, your code wil=
l do what you expect =E2=80=94 it'll call unique_ptr::get().</div><div>=
<br></div><div><a href=3D"http://melpon.org/wandbox/permlink/vYHBEc5fMnMW6Y=
RQ">http://melpon.org/wandbox/permlink/vYHBEc5fMnMW6YRQ</a><br></div><div><=
br></div><div>=E2=80=93Arthur</div><blockquote class=3D"gmail_quote" style=
=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: =
1ex;"><div dir=3D"rtl"><div>
</div></div>
</blockquote></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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/e6e70787-2ca6-4f75-a142-37312b6bb29d%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/e6e70787-2ca6-4f75-a142-37312b6bb29d=
%40isocpp.org</a>.<br />
------=_Part_179_415851440.1475631075800--
------=_Part_178_606368930.1475631075799--
.
Author: Farid Mehrabi <farid.mehrabi@gmail.com>
Date: Thu, 6 Oct 2016 20:09:13 +0330
Raw View
--001a11458f8477dd8f053e34f18a
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
2016-10-05 5:01 GMT+03:30 <arthur.odwyer@mixpanel.com>:
> On Tuesday, October 4, 2016 at 10:12:11 AM UTC-7, Farid Mehrabi wrote:
>>
>> 2016-10-03 23:37 GMT+03:30 Nicol Bolas <jmck...@gmail.com>:
>>
>>> On Monday, October 3, 2016 at 3:01:00 PM UTC-4, Farid Mehrabi wrote:
>>>>
>>>> what if I want a smart ref which is also a smart ptr?
>>>>
>>>
>>> ... why would you want to? Why would you want a smart reference to act
>>> like a smart pointer? That doesn't make any sense.
>>>
>>>
>>>> what if the content of smart ref is a smart ptr?
>>>>
>>>
>>> So what if it is? In accord with the aforementioned specification, an
>>> "operation" (which for some reason member function calls qualify as but
>>> data member access do not) on the smart reference type will use operato=
r.
>>> to call the referenced object if the smart reference itself doesn't hav=
e an
>>> appropriate function.
>>>
>>> So if a smart reference type doesn't have an operator-> or operator*,
>>> then using those operators will attempt to call the referenced type's
>>> versions. If it has none, then it's a compile error. If it has one, the=
n it
>>> will be called.
>>>
>>> What's the problem?
>>>
>>
>> try this one:=E2=80=8B
>> struct
>> =E2=80=8B=E2=80=8B
>> test
>> {
>> void get() {};
>> };
>>
>> struct smart_ptr {
>> std::unique_ptr<test> ptr;
>> auto& operator ->() { return ptr; };
>> };
>>
>> smart_ptr ptr;
>> ptr->get();//
>> =E2=80=8B
>> test::get not unique_ptr::get.
>>
>> this bugs (at least me).
>>
>
> You've got a probably-a-bug in there: you're returning auto& from your
> overloaded operator-> when you probably meant to return auto*.
> If you make that change, your code will do what you expect =E2=80=94 it'l=
l call
> unique_ptr::get().
>
>
=E2=80=8B=E2=80=8BNo It won't. That would be a syntax error.
> 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/e6e70787-2ca6-4f75-
> a142-37312b6bb29d%40isocpp.org
> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/e6e70787-2c=
a6-4f75-a142-37312b6bb29d%40isocpp.org?utm_medium=3Demail&utm_source=3Dfoot=
er>
> .
>
--=20
how am I supposed to end the twisted road of your hair in such a dark
night??
unless the candle of your face does shed some light upon my way!!!
--=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/CALDL7dGacxoNkTsgsUx9U6RQ_8V98Lfw7uZ720f7GH8nd-2=
GEA%40mail.gmail.com.
--001a11458f8477dd8f053e34f18a
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"rtl"><div class=3D"gmail_default" style=3D"font-family:"ar=
ial narrow",sans-serif;font-size:large" dir=3D"ltr"><br></div><div cla=
ss=3D"gmail_extra"><div style=3D"text-align:left"><br></div><div class=3D"g=
mail_quote"><div dir=3D"ltr">2016-10-05 5:01 GMT+03:30 <span dir=3D"ltr">&=
lt;<a href=3D"mailto:arthur.odwyer@mixpanel.com" target=3D"_blank">arthur.o=
dwyer@mixpanel.com</a>></span>:</div><blockquote class=3D"gmail_quote" s=
tyle=3D"margin:0 .8ex;border-left:1px #ccc solid;border-right:1px #ccc soli=
d;padding-left:1ex;padding-right:1ex"><div dir=3D"ltr">On Tuesday, October =
4, 2016 at 10:12:11 AM UTC-7, Farid Mehrabi wrote:<blockquote class=3D"gmai=
l_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;pad=
ding-left:1ex"><div dir=3D"rtl"><span class=3D""><div style=3D"text-align:l=
eft"><div style=3D"direction:ltr">2016-10-03 23:37 GMT+03:30 Nicol Bolas <s=
pan dir=3D"ltr"><<a rel=3D"nofollow">jmck...@gmail.com</a>></span>:<b=
r></div></div></span><div><div class=3D"gmail_quote"><span class=3D""><bloc=
kquote class=3D"gmail_quote" style=3D"margin:0px 0.8ex;border-left:1px soli=
d rgb(204,204,204);border-right:1px solid rgb(204,204,204);padding-left:1ex=
;padding-right:1ex"><div dir=3D"ltr"><span>On Monday, October 3, 2016 at 3:=
01:00 PM UTC-4, Farid Mehrabi wrote:<blockquote class=3D"gmail_quote" style=
=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding=
-left:1ex"><div dir=3D"rtl"><div style=3D"text-align:left;font-family:"=
;arial narrow",sans-serif;font-size:large" dir=3D"ltr">what if I want =
a smart ref which is also a smart ptr?</div></div></blockquote></span><div>=
<br>... why would you want to? Why would you want a smart reference to act =
like a smart pointer? That doesn't make any sense.<br>=C2=A0</div><span=
><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border=
-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir=3D"rtl"><div st=
yle=3D"text-align:left;font-family:"arial narrow",sans-serif;font=
-size:large" dir=3D"ltr">what if the content of smart ref is a smart ptr?</=
div></div></blockquote></span><div><br>So what if it is? In accord with the=
aforementioned specification, an "operation" (which for some rea=
son member function calls qualify as but data member access do not) on the =
smart reference type will use operator. to call the referenced object if th=
e smart reference itself doesn't have an appropriate function.<br><br>S=
o if a smart reference type doesn't have an operator-> or operator*,=
then using those operators will attempt to call the referenced type's =
versions. If it has none, then it's a compile error. If it has one, the=
n it will be called.<br><br>What's the problem?</div></div></blockquote=
><div style=3D"text-align:left">=C2=A0</div></span><span class=3D""><div st=
yle=3D"text-align:left"><div style=3D"font-family:"arial narrow",=
sans-serif;font-size:large;display:inline" dir=3D"ltr">try this one:=E2=80=
=8B</div></div><div style=3D"text-align:left"><span style=3D"font-family:&q=
uot;arial narrow",sans-serif;font-size:large">struct <div style=3D"fon=
t-family:"arial narrow",sans-serif;font-size:large;display:inline=
">=E2=80=8B=E2=80=8B</div>test</span></div><div><div style=3D"direction:ltr=
"><font face=3D"arial narrow, sans-serif" size=3D"4">{</font></div><div sty=
le=3D"direction:ltr"><font face=3D"arial narrow, sans-serif" size=3D"4"><sp=
an style=3D"white-space:pre-wrap"> </span>void get() {};</font></div><div s=
tyle=3D"direction:ltr"><font face=3D"arial narrow, sans-serif" size=3D"4">}=
;</font></div><div style=3D"direction:ltr"><font face=3D"arial narrow, sans=
-serif" size=3D"4"><br></font></div><div style=3D"direction:ltr"><font face=
=3D"arial narrow, sans-serif" size=3D"4">struct<span style=3D"white-space:p=
re-wrap"> </span>=C2=A0=C2=A0smart_ptr {</font></div><div style=3D"directio=
n:ltr"><font face=3D"arial narrow, sans-serif" size=3D"4"><span style=3D"wh=
ite-space:pre-wrap"> </span>std::unique_ptr<test> ptr;</font></div><d=
iv style=3D"direction:ltr"><font face=3D"arial narrow, sans-serif" size=3D"=
4"><span style=3D"white-space:pre-wrap"> </span>auto& operator ->() =
{ return ptr; };</font></div><div style=3D"direction:ltr"><font face=3D"ari=
al narrow, sans-serif" size=3D"4">};</font></div><div style=3D"direction:lt=
r"><font face=3D"arial narrow, sans-serif" size=3D"4"><br></font></div><div=
style=3D"direction:ltr"><span style=3D"font-family:"arial narrow"=
;,sans-serif;font-size:large;white-space:pre-wrap"> </span><span style=3D"f=
ont-family:"arial narrow",sans-serif;font-size:large">smart_ptr p=
tr;</span><br></div><div style=3D"direction:ltr"><font face=3D"arial narrow=
, sans-serif" size=3D"4"><span style=3D"white-space:pre-wrap"> </span>ptr-&=
gt;get();//</font><div style=3D"font-family:"arial narrow",sans-s=
erif;font-size:large;display:inline">=E2=80=8B</div><span style=3D"font-fam=
ily:"arial narrow",sans-serif;font-size:large">test::get not=C2=
=A0</span><span style=3D"font-family:"arial narrow",sans-serif;fo=
nt-size:large">unique_ptr::get.=C2=A0</span></div><div style=3D"direction:l=
tr"><span style=3D"font-family:"arial narrow",sans-serif;font-siz=
e:large"><br></span></div><div dir=3D"ltr"><span style=3D"font-family:"=
;arial narrow",sans-serif;font-size:large">this bugs (at least me).=C2=
=A0</span></div></div></span></div></div></div></blockquote><div><br></div>=
<div>You've got a probably-a-bug in there: you're returning <font f=
ace=3D"courier new, monospace">auto&</font> from your overloaded <font =
face=3D"courier new, monospace">operator-></font> when you probably mean=
t to return <font face=3D"courier new, monospace">auto*</font>.</div><div>I=
f you make that change, your code will do what you expect =E2=80=94 it'=
ll call unique_ptr::get().</div><div></div></div><span class=3D""><div styl=
e=3D"text-align:left"><br></div></span></blockquote><div style=3D"direction=
:ltr"><br></div><div style=3D"direction:ltr"><div class=3D"gmail_default" s=
tyle=3D"font-family:"arial narrow",sans-serif;font-size:large">=
=E2=80=8B=E2=80=8BNo It won't. That would be a syntax error.</div><br><=
/div><div style=3D"direction:ltr">=C2=A0</div><blockquote class=3D"gmail_qu=
ote" style=3D"margin:0 .8ex;border-left:1px #ccc solid;border-right:1px #cc=
c solid;padding-left:1ex;padding-right:1ex"><div style=3D"text-align:left">=
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.</div><span class=3D""=
><div style=3D"text-align:left">To unsubscribe from this group and stop rec=
eiving emails from it, send an email to <a href=3D"mailto:std-proposals+uns=
ubscribe@isocpp.org" target=3D"_blank">std-proposals+unsubscribe@<wbr>isocp=
p.org</a>.</div><div style=3D"text-align:left">To post to this group, send =
email to <a href=3D"mailto:std-proposals@isocpp.org" target=3D"_blank">std-=
proposals@isocpp.org</a>.</div></span><div style=3D"text-align:left">To vie=
w this discussion on the web visit <a href=3D"https://groups.google.com/a/i=
socpp.org/d/msgid/std-proposals/e6e70787-2ca6-4f75-a142-37312b6bb29d%40isoc=
pp.org?utm_medium=3Demail&utm_source=3Dfooter" target=3D"_blank">https:=
//groups.google.com/a/<wbr>isocpp.org/d/msgid/std-<wbr>proposals/e6e70787-2=
ca6-4f75-<wbr>a142-37312b6bb29d%40isocpp.org</a><wbr>.</div>
</blockquote></div><div style=3D"text-align:left"><br></div><div style=3D"t=
ext-align:left"><br></div><div style=3D"text-align:left"><br></div><div sty=
le=3D"text-align:left">--=C2=A0</div><div class=3D"gmail_signature" data-sm=
artmail=3D"gmail_signature"><div dir=3D"rtl"><div><div dir=3D"ltr">how am I=
supposed to end the twisted road of=C2=A0 your hair in such a dark night??=
<br>unless the candle of your face does shed some light upon my way!!!<br><=
/div></div></div></div>
</div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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/CALDL7dGacxoNkTsgsUx9U6RQ_8V98Lfw7uZ7=
20f7GH8nd-2GEA%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">htt=
ps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CALDL7dGacxoNkTsg=
sUx9U6RQ_8V98Lfw7uZ720f7GH8nd-2GEA%40mail.gmail.com</a>.<br />
--001a11458f8477dd8f053e34f18a--
.
Author: Farid Mehrabi <farid.mehrabi@gmail.com>
Date: Thu, 6 Oct 2016 20:16:53 +0330
Raw View
--001a11c14e98df6cc0053e350cc4
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
2016-10-05 2:05 GMT+03:30 Nicol Bolas <jmckesson@gmail.com>:
>
>
> On Tuesday, October 4, 2016 at 1:12:11 PM UTC-4, Farid Mehrabi wrote:
>>
>> 2016-10-03 23:37 GMT+03:30 Nicol Bolas <jmck...@gmail.com>:
>>
>>> On Monday, October 3, 2016 at 3:01:00 PM UTC-4, Farid Mehrabi wrote:
>>>>
>>>> what if I want a smart ref which is also a smart ptr?
>>>>
>>>
>>> ... why would you want to? Why would you want a smart reference to act
>>> like a smart pointer? That doesn't make any sense.
>>>
>>>
>>>> what if the content of smart ref is a smart ptr?
>>>>
>>>
>>> So what if it is? In accord with the aforementioned specification, an
>>> "operation" (which for some reason member function calls qualify as but
>>> data member access do not) on the smart reference type will use operato=
r.
>>> to call the referenced object if the smart reference itself doesn't hav=
e an
>>> appropriate function.
>>>
>>> So if a smart reference type doesn't have an operator-> or operator*,
>>> then using those operators will attempt to call the referenced type's
>>> versions. If it has none, then it's a compile error. If it has one, the=
n it
>>> will be called.
>>>
>>> What's the problem?
>>>
>>> what happens if the content is yet another smart ref?
>>>> the last question applies to smart ptrs as well what if the object of =
a
>>>> smart ptr is another smart ptr? smart ptrs have had this annoying defe=
ct
>>>> and I am one of those who like it eliminated.
>>>>
>>>
>>> What defect are you talking about?
>>>
>>>
>> try this one:=E2=80=8B
>> struct
>> =E2=80=8B=E2=80=8B
>> test
>> {
>> void get() {};
>> };
>>
>> struct smart_ptr {
>> std::unique_ptr<test> ptr;
>> auto& operator ->() { return ptr; };
>> };
>>
>> smart_ptr ptr;
>> ptr->get();//
>> =E2=80=8B
>> test::get not unique_ptr::get.
>>
>> this bugs (at least me).
>>
>
> That bugs you? That is literally the *whole point* of overloading
> `operator->`: so that it accesses the value held by the smart pointer
> rather than the smart pointer object itself. It takes syntax that would
> have been a compile error and turns it into syntax with a well-defined
> meaning.
>
> If you want to access the object, you use `.`. If you want to access what
> it points to, you use `->`. This is exactly as it *should be*; otherwise,
> smart pointers would hide elements of the interface of the objects they
> point to. It also makes it clear to a user reading the code what the writ=
er
> intended. If you see `.`, then you know the code is accessing the smart
> pointer object. If you see `->`, then you know the code is accessing the
> object being pointed to.
>
=E2=80=8BSorry to ask, but did you =E2=80=8Bget the point in the code snipp=
et???
> --
> 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/299fbbb7-c4b2-434d-
> 972c-556f07dfb3fd%40isocpp.org
> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/299fbbb7-c4=
b2-434d-972c-556f07dfb3fd%40isocpp.org?utm_medium=3Demail&utm_source=3Dfoot=
er>
> .
>
--=20
how am I supposed to end the twisted road of your hair in such a dark
night??
unless the candle of your face does shed some light upon my way!!!
--=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/CALDL7dFZeLrumx2rvmVKjr5E1n5vMGKW24mSSgRb%2BCAoi=
f6k%2Bg%40mail.gmail.com.
--001a11c14e98df6cc0053e350cc4
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"rtl"><div class=3D"gmail_default" style=3D"text-align:left;font=
-family:"arial narrow",sans-serif;font-size:large" dir=3D"ltr"><s=
pan style=3D"font-family:arial,sans-serif;font-size:small">2016-10-05 2:05 =
GMT+03:30 Nicol Bolas </span><span dir=3D"ltr" style=3D"font-family:arial,s=
ans-serif;font-size:small"><<a href=3D"mailto:jmckesson@gmail.com" targe=
t=3D"_blank">jmckesson@gmail.com</a>></span><span style=3D"font-family:a=
rial,sans-serif;font-size:small">:</span><br></div><div class=3D"gmail_extr=
a" dir=3D"ltr"><div class=3D"gmail_quote"><blockquote class=3D"gmail_quote"=
style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);p=
adding-left:1ex"><div><br><br>On Tuesday, October 4, 2016 at 1:12:11 PM UTC=
-4, Farid Mehrabi wrote:<span class=3D""><blockquote class=3D"gmail_quote" =
style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left=
:1ex"><div dir=3D"rtl"><div style=3D"text-align:left"><div style=3D"directi=
on:ltr">2016-10-03 23:37 GMT+03:30 Nicol Bolas <span dir=3D"ltr"><<a rel=
=3D"nofollow">jmck...@gmail.com</a>></span>:<br></div></div><div><div cl=
ass=3D"gmail_quote"><blockquote class=3D"gmail_quote" style=3D"margin:0px 0=
..8ex;border-left:1px solid rgb(204,204,204);border-right:1px solid rgb(204,=
204,204);padding-left:1ex;padding-right:1ex"><div dir=3D"ltr"><span>On Mond=
ay, October 3, 2016 at 3:01:00 PM UTC-4, Farid Mehrabi wrote:<blockquote cl=
ass=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid=
rgb(204,204,204);padding-left:1ex"><div dir=3D"rtl"><div style=3D"text-ali=
gn:left;font-family:"arial narrow",sans-serif;font-size:large" di=
r=3D"ltr">what if I want a smart ref which is also a smart ptr?</div></div>=
</blockquote></span><div><br>... why would you want to? Why would you want =
a smart reference to act like a smart pointer? That doesn't make any se=
nse.<br>=C2=A0</div><span><blockquote class=3D"gmail_quote" style=3D"margin=
:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"=
><div dir=3D"rtl"><div style=3D"text-align:left;font-family:"arial nar=
row",sans-serif;font-size:large" dir=3D"ltr">what if the content of sm=
art ref is a smart ptr?</div></div></blockquote></span><div><br>So what if =
it is? In accord with the aforementioned specification, an "operation&=
quot; (which for some reason member function calls qualify as but data memb=
er access do not) on the smart reference type will use operator. to call th=
e referenced object if the smart reference itself doesn't have an appro=
priate function.<br><br>So if a smart reference type doesn't have an op=
erator-> or operator*, then using those operators will attempt to call t=
he referenced type's versions. If it has none, then it's a compile =
error. If it has one, then it will be called.<br><br>What's the problem=
?<br><br></div><span><blockquote class=3D"gmail_quote" style=3D"margin:0px =
0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div=
dir=3D"rtl"><div style=3D"text-align:left;font-family:"arial narrow&q=
uot;,sans-serif;font-size:large" dir=3D"ltr">what happens if the content is=
yet another smart ref?</div><div style=3D"text-align:left;font-family:&quo=
t;arial narrow",sans-serif;font-size:large" dir=3D"ltr">the last quest=
ion applies to smart ptrs as well what if the object of a smart ptr is anot=
her smart ptr? smart ptrs have had this annoying defect and I am one of tho=
se who like it eliminated.<br></div></div></blockquote></span><div><br>What=
defect are you talking about?<br><br></div></div></blockquote><div style=
=3D"text-align:left">=C2=A0</div><div style=3D"text-align:left"><div style=
=3D"font-family:"arial narrow",sans-serif;font-size:large;display=
:inline" dir=3D"ltr">try this one:=E2=80=8B</div></div><div style=3D"text-a=
lign:left"><span style=3D"font-family:"arial narrow",sans-serif;f=
ont-size:large">struct <div style=3D"font-family:"arial narrow",s=
ans-serif;font-size:large;display:inline">=E2=80=8B=E2=80=8B</div>test</spa=
n></div><div><div style=3D"direction:ltr"><font size=3D"4" face=3D"arial na=
rrow, sans-serif">{</font></div><div style=3D"direction:ltr"><font size=3D"=
4" face=3D"arial narrow, sans-serif"><span style=3D"white-space:pre-wrap"> =
</span>void get() {};</font></div><div style=3D"direction:ltr"><font size=
=3D"4" face=3D"arial narrow, sans-serif">};</font></div><div style=3D"direc=
tion:ltr"><font size=3D"4" face=3D"arial narrow, sans-serif"><br></font></d=
iv><div style=3D"direction:ltr"><font size=3D"4" face=3D"arial narrow, sans=
-serif">struct<span style=3D"white-space:pre-wrap"> </span>=C2=A0=C2=A0smar=
t_ptr {</font></div><div style=3D"direction:ltr"><font size=3D"4" face=3D"a=
rial narrow, sans-serif"><span style=3D"white-space:pre-wrap"> </span>std::=
unique_ptr<test> ptr;</font></div><div style=3D"direction:ltr"><font =
size=3D"4" face=3D"arial narrow, sans-serif"><span style=3D"white-space:pre=
-wrap"> </span>auto& operator ->() { return ptr; };</font></div><div=
style=3D"direction:ltr"><font size=3D"4" face=3D"arial narrow, sans-serif"=
>};</font></div><div style=3D"direction:ltr"><font size=3D"4" face=3D"arial=
narrow, sans-serif"><br></font></div><div style=3D"direction:ltr"><span st=
yle=3D"font-family:"arial narrow",sans-serif;font-size:large;whit=
e-space:pre-wrap"> </span><span style=3D"font-family:"arial narrow&quo=
t;,sans-serif;font-size:large">smart_ptr ptr;</span><br></div><div style=3D=
"direction:ltr"><font size=3D"4" face=3D"arial narrow, sans-serif"><span st=
yle=3D"white-space:pre-wrap"> </span>ptr->get();//</font><div style=3D"f=
ont-family:"arial narrow",sans-serif;font-size:large;display:inli=
ne">=E2=80=8B</div><span style=3D"font-family:"arial narrow",sans=
-serif;font-size:large">test::get not=C2=A0</span><span style=3D"font-famil=
y:"arial narrow",sans-serif;font-size:large">unique_ptr::get.=C2=
=A0</span></div><div style=3D"direction:ltr"><span style=3D"font-family:&qu=
ot;arial narrow",sans-serif;font-size:large"><br></span></div><div dir=
=3D"ltr"><span style=3D"font-family:"arial narrow",sans-serif;fon=
t-size:large">this bugs (at least me).</span></div></div></div></div></div>=
</blockquote></span><div><br>That bugs you? That is literally the <i>whole =
point</i> of overloading `operator->`: so that it accesses the value hel=
d by the smart pointer rather than the smart pointer object itself. It take=
s syntax that would have been a compile error and turns it into syntax with=
a well-defined meaning.<br><br>If you want to access the object, you use `=
..`. If you want to access what it points to, you use `->`. This is exact=
ly as it <i>should be</i>; otherwise, smart pointers would hide elements of=
the interface of the objects they point to. It also makes it clear to a us=
er reading the code what the writer intended. If you see `.`, then you know=
the code is accessing the smart pointer object. If you see `->`, then y=
ou know the code is accessing the object being pointed to.<br></div></div><=
/blockquote><div><br></div><div><div class=3D"gmail_default" style=3D"font-=
family:"arial narrow",sans-serif;font-size:large;display:inline">=
=E2=80=8BSorry to ask, but did you =E2=80=8Bget the point in the code snipp=
et???</div></div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px =
0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><di=
v></div></div><span class=3D"">
<p></p><div style=3D"text-align:left">--=C2=A0</div><div style=3D"text-alig=
n:left">You received this message because you are subscribed to the Google =
Groups "ISO C++ Standard - Future Proposals" group.</div><div sty=
le=3D"text-align:left">To unsubscribe from this group and stop receiving em=
ails from it, send an email to <a href=3D"mailto:std-proposals+unsubscribe@=
isocpp.org" target=3D"_blank">std-proposals+unsubscribe@<wbr>isocpp.org</a>=
..</div><div style=3D"text-align:left">To post to this group, send email to =
<a href=3D"mailto:std-proposals@isocpp.org" target=3D"_blank">std-proposals=
@isocpp.org</a>.</div></span><div style=3D"text-align:left">To view this di=
scussion on the web visit <a href=3D"https://groups.google.com/a/isocpp.org=
/d/msgid/std-proposals/299fbbb7-c4b2-434d-972c-556f07dfb3fd%40isocpp.org?ut=
m_medium=3Demail&utm_source=3Dfooter" target=3D"_blank">https://groups.=
google.com/a/<wbr>isocpp.org/d/msgid/std-<wbr>proposals/299fbbb7-c4b2-434d-=
<wbr>972c-556f07dfb3fd%40isocpp.org</a><wbr>.</div>
</blockquote></div><div style=3D"text-align:left"><br></div><div style=3D"t=
ext-align:left"><br></div><div style=3D"text-align:left"><br></div><div sty=
le=3D"text-align:left">--=C2=A0</div><div class=3D"gmail_signature" data-sm=
artmail=3D"gmail_signature"><div><div><div>how am I supposed to end the twi=
sted road of=C2=A0 your hair in such a dark night??<br>unless the candle of=
your face does shed some light upon my way!!!<br></div></div></div></div>
</div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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/CALDL7dFZeLrumx2rvmVKjr5E1n5vMGKW24mS=
SgRb%2BCAoif6k%2Bg%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter"=
>https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CALDL7dFZeLru=
mx2rvmVKjr5E1n5vMGKW24mSSgRb%2BCAoif6k%2Bg%40mail.gmail.com</a>.<br />
--001a11c14e98df6cc0053e350cc4--
.
Author: Farid Mehrabi <farid.mehrabi@gmail.com>
Date: Thu, 6 Oct 2016 20:26:25 +0330
Raw View
--94eb2c05bce8033c8f053e352fa0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
2016-10-04 21:10 GMT+03:30 Ville Voutilainen <ville.voutilainen@gmail.com>:
> On 4 October 2016 at 20:21, Tony V E <tvaneerd@gmail.com> wrote:
> >> try this one:
> >> struct
> >> test
> >> {
> >> void get() {};
> >> };
> >>
> >> struct smart_ptr {
> >> std::unique_ptr<test> ptr;
> >> auto& operator ->() { return ptr; };
> >> };
> >>
> >> smart_ptr ptr;
> >> ptr->get();//
> >> test::get not unique_ptr::get.
> >>
> >> this bugs (at least me).
> >
> >
> >
> > Given that this "defect" has been there - as part of the design - since
> the
> > beginning of overloading ->, it isn't likely to be changed;
> > so what then do you think we should do with operator dot? - mirroring t=
he
> > same behaviour seems sensible to me.
>
> The operator dot proposals have never proposed mirroring that
> behavior. They have consistently
> suggested that if the operation is found by lookup in the handle's
> hierarchy, the handle's operation
> is used, not the operation of the referred-to entity.
>
=E2=80=8BI am happy with that, but that also means I didn't grasp the OP's =
point of
view, and need some clarification.
=E2=80=8BObviously what I call Right-Hand-Side-Resolution happens by factor=
s far
more for dot than =E2=80=8Bfor arrow. But why should the semantics of arrow=
not
change to become like that of dot?
Regards,
FM.
=E2=80=8B
>
> --
> 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/CAFk2RUbYB0Mt%2B9p7ZsD%3DspZBn8yCZ%
> 3DSqRWZXxM5QawXFOmDnXQ%40mail.gmail.com.
>
--=20
how am I supposed to end the twisted road of your hair in such a dark
night??
unless the candle of your face does shed some light upon my way!!!
--=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/CALDL7dH1qxW4j%2BzZ0o1Tp5paemxbfpvP0pJN18h6SpB3Z=
HSJUA%40mail.gmail.com.
--94eb2c05bce8033c8f053e352fa0
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"rtl"><div class=3D"gmail_default" style=3D"font-family:arial na=
rrow,sans-serif;font-size:large" dir=3D"ltr"><span style=3D"font-family:ari=
al,sans-serif;font-size:small">2016-10-04 21:10 GMT+03:30 Ville Voutilainen=
</span><span dir=3D"ltr" style=3D"font-family:arial,sans-serif;font-size:s=
mall"><<a href=3D"mailto:ville.voutilainen@gmail.com" target=3D"_blank">=
ville.voutilainen@gmail.com</a>></span><span style=3D"font-family:arial,=
sans-serif;font-size:small">:</span><br></div><div class=3D"gmail_extra" di=
r=3D"ltr"><div class=3D"gmail_quote"><blockquote class=3D"gmail_quote" styl=
e=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);paddin=
g-left:1ex"><span class=3D"">On 4 October 2016 at 20:21, Tony V E <<a hr=
ef=3D"mailto:tvaneerd@gmail.com">tvaneerd@gmail.com</a>> wrote:<br>
>> try this one:<br>
>> struct<br>
>> test<br>
>> {<br>
>> void get() {};<br>
>> };<br>
>><br>
>> struct=C2=A0 =C2=A0smart_ptr {<br>
>> std::unique_ptr<test> ptr;<br>
>> auto& operator ->() { return ptr; };<br>
>> };<br>
>><br>
>> smart_ptr ptr;<br>
>> ptr->get();//<br>
>> test::get not unique_ptr::get.<br>
>><br>
>> this bugs (at least me).<br>
><br>
><br>
><br>
> Given that this "defect" has been there - as part of the des=
ign - since the<br>
> beginning of overloading ->, it isn't likely to be changed;<br>
> so what then do you think we should do with operator dot? - mirroring =
the<br>
> same behaviour seems sensible to me.<br>
<br>
</span>The operator dot proposals have never proposed mirroring that<br>
behavior. They have consistently<br>
suggested that if the operation is found by lookup in the handle's<br>
hierarchy, the handle's operation<br>
is used, not the operation of the referred-to entity.<br></blockquote><div>=
<br></div><div><div class=3D"gmail_default" style=3D"font-family:"aria=
l narrow",sans-serif;font-size:large;display:inline">=E2=80=8BI am hap=
py with that, but that also means I didn't grasp the OP's point of =
view, and need some clarification.</div></div><div><div class=3D"gmail_defa=
ult" style=3D"font-family:"arial narrow",sans-serif;font-size:lar=
ge">=E2=80=8BObviously what I call Right-Hand-Side-Resolution happens by fa=
ctors far more for dot than =E2=80=8Bfor arrow. But why should the semantic=
s of arrow not change to become like that of dot?=C2=A0</div><div class=3D"=
gmail_default" style=3D"text-align:right;font-family:"arial narrow&quo=
t;,sans-serif;font-size:large">Regards,</div><div class=3D"gmail_default" s=
tyle=3D"text-align:right;font-family:"arial narrow",sans-serif;fo=
nt-size:large">FM.</div><br></div><div><div class=3D"gmail_default" style=
=3D"font-family:"arial narrow",sans-serif;font-size:large;display=
:inline">=E2=80=8B</div>=C2=A0</div><blockquote class=3D"gmail_quote" style=
=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding=
-left:1ex">
<span class=3D""><br>
--<br>
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br>
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals%2Bunsubscribe@isocpp.org">std-propo=
sals+unsubscribe@<wbr>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>
</span>To view this discussion on the web visit <a href=3D"https://groups.g=
oogle.com/a/isocpp.org/d/msgid/std-proposals/CAFk2RUbYB0Mt%2B9p7ZsD%3DspZBn=
8yCZ%3DSqRWZXxM5QawXFOmDnXQ%40mail.gmail.com" rel=3D"noreferrer" target=3D"=
_blank">https://groups.google.com/a/<wbr>isocpp.org/d/msgid/std-<wbr>propos=
als/CAFk2RUbYB0Mt%<wbr>2B9p7ZsD%3DspZBn8yCZ%<wbr>3DSqRWZXxM5QawXFOmDnXQ%40m=
ail.<wbr>gmail.com</a>.<br>
</blockquote></div><br><br clear=3D"all"><div><br></div>-- <br><div class=
=3D"gmail_signature" data-smartmail=3D"gmail_signature"><div><div><div>how =
am I supposed to end the twisted road of=C2=A0 your hair in such a dark nig=
ht??<br>unless the candle of your face does shed some light upon my way!!!<=
br></div></div></div></div>
</div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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/CALDL7dH1qxW4j%2BzZ0o1Tp5paemxbfpvP0p=
JN18h6SpB3ZHSJUA%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">h=
ttps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CALDL7dH1qxW4j%=
2BzZ0o1Tp5paemxbfpvP0pJN18h6SpB3ZHSJUA%40mail.gmail.com</a>.<br />
--94eb2c05bce8033c8f053e352fa0--
.
Author: Farid Mehrabi <farid.mehrabi@gmail.com>
Date: Thu, 6 Oct 2016 20:56:52 +0330
Raw View
--001a1143ae42ef4e0d053e359b77
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
2016-10-04 20:51 GMT+03:30 Tony V E <tvaneerd@gmail.com>:
>
>
> On Tue, Oct 4, 2016 at 1:11 PM, Farid Mehrabi <farid.mehrabi@gmail.com>
> wrote:
>
>> 2016-10-03 23:37 GMT+03:30 Nicol Bolas <jmckesson@gmail.com>:
>>
>>> On Monday, October 3, 2016 at 3:01:00 PM UTC-4, Farid Mehrabi wrote:
>>>>
>>>> what if I want a smart ref which is also a smart ptr?
>>>>
>>>
>>> ... why would you want to? Why would you want a smart reference to act
>>> like a smart pointer? That doesn't make any sense.
>>>
>>>
>>>> what if the content of smart ref is a smart ptr?
>>>>
>>>
>>> So what if it is? In accord with the aforementioned specification, an
>>> "operation" (which for some reason member function calls qualify as but
>>> data member access do not) on the smart reference type will use operato=
r.
>>> to call the referenced object if the smart reference itself doesn't hav=
e an
>>> appropriate function.
>>>
>>> So if a smart reference type doesn't have an operator-> or operator*,
>>> then using those operators will attempt to call the referenced type's
>>> versions. If it has none, then it's a compile error. If it has one, the=
n it
>>> will be called.
>>>
>>> What's the problem?
>>>
>>> what happens if the content is yet another smart ref?
>>>> the last question applies to smart ptrs as well what if the object of =
a
>>>> smart ptr is another smart ptr? smart ptrs have had this annoying defe=
ct
>>>> and I am one of those who like it eliminated.
>>>>
>>>
>>> What defect are you talking about?
>>>
>>>
>> try this one:=E2=80=8B
>> struct
>> =E2=80=8B=E2=80=8B
>> test
>> {
>> void get() {};
>> };
>>
>> struct smart_ptr {
>> std::unique_ptr<test> ptr;
>> auto& operator ->() { return ptr; };
>> };
>>
>> smart_ptr ptr;
>> ptr->get();//
>> =E2=80=8B
>> test::get not unique_ptr::get.
>>
>> this bugs (at least me).
>>
>
>
> Given that this "defect" has been there - as part of the design - since
> the beginning of overloading ->, it isn't likely to be changed;
> so what then do you think we should do with operator dot? - mirroring the
> same behaviour seems sensible to me.
>
=E2=80=8BIt hasn't been modified(fixed=E2=80=8B), because existing smart po=
inters have not
been complex enough to return another smart pointer in arrow operators and
raw pointers simply don't have any member fields or methods. But dot in the
other hands returns a reference to an object, and a lot more often than
never it happens that the object has fields and member functions. So the
issue becomes bold in case of dot. 'dot' shouldn't suffer from what arrow
does; 'arrow' shouldn't either, but there is stronger pressure behind 'dot'
to hide right hand side members in favor of the leftmost handle. I wish
same thing would happen to the arrow.
Regards,
FM.
>
> --
> Be seeing you,
> Tony
>
> --
> 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/CAOHCbitTRkx9O01GK%2BvaKSDGrejJO%
> 2Bq15pNAsCzhjapneRYCxQ%40mail.gmail.com
> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAOHCbitTRk=
x9O01GK%2BvaKSDGrejJO%2Bq15pNAsCzhjapneRYCxQ%40mail.gmail.com?utm_medium=3D=
email&utm_source=3Dfooter>
> .
>
--=20
how am I supposed to end the twisted road of your hair in such a dark
night??
unless the candle of your face does shed some light upon my way!!!
--=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/CALDL7dFirQB%2BbzUE%2BFyZAx0zw%2B94PPO4Lk%2B%3DG=
jb1eBTH8Nn%2BAg%40mail.gmail.com.
--001a1143ae42ef4e0d053e359b77
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"rtl"><div class=3D"gmail_default" style=3D"font-family:arial na=
rrow,sans-serif;font-size:large" dir=3D"ltr"><span style=3D"font-family:ari=
al,sans-serif;font-size:small">2016-10-04 20:51 GMT+03:30 Tony V E </span><=
span dir=3D"ltr" style=3D"font-family:arial,sans-serif;font-size:small"><=
;<a href=3D"mailto:tvaneerd@gmail.com" target=3D"_blank">tvaneerd@gmail.com=
</a>></span><span style=3D"font-family:arial,sans-serif;font-size:small"=
>:</span><br></div><div class=3D"gmail_extra" dir=3D"ltr"><div class=3D"gma=
il_quote"><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8=
ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><br><div c=
lass=3D"gmail_extra"><br><div class=3D"gmail_quote"><span class=3D"">On Tue=
, Oct 4, 2016 at 1:11 PM, Farid Mehrabi <span dir=3D"ltr"><<a href=3D"ma=
ilto:farid.mehrabi@gmail.com" target=3D"_blank">farid.mehrabi@gmail.com</a>=
></span> wrote:<br><blockquote class=3D"gmail_quote" style=3D"margin:0 0=
0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"rtl"><span=
><div style=3D"text-align:left"><div style=3D"direction:ltr">2016-10-03 23:=
37 GMT+03:30 Nicol Bolas <span dir=3D"ltr"><<a href=3D"mailto:jmckesson@=
gmail.com" target=3D"_blank">jmckesson@gmail.com</a>></span>:<br></div><=
/div></span><div class=3D"gmail_extra"><div class=3D"gmail_quote"><span><bl=
ockquote class=3D"gmail_quote" style=3D"margin:0px 0.8ex;border-left:1px so=
lid rgb(204,204,204);border-right:1px solid rgb(204,204,204);padding-left:1=
ex;padding-right:1ex"><div dir=3D"ltr"><span class=3D"m_-103410356097426289=
m_-6161057886578964202gmail-">On Monday, October 3, 2016 at 3:01:00 PM UTC-=
4, Farid Mehrabi wrote:<blockquote class=3D"gmail_quote" style=3D"margin:0p=
x 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><d=
iv dir=3D"rtl"><div style=3D"text-align:left;font-family:"arial narrow=
",sans-serif;font-size:large" dir=3D"ltr">what if I want a smart ref w=
hich is also a smart ptr?</div></div></blockquote></span><div><br>... why w=
ould you want to? Why would you want a smart reference to act like a smart =
pointer? That doesn't make any sense.<br>=C2=A0</div><span class=3D"m_-=
103410356097426289m_-6161057886578964202gmail-"><blockquote class=3D"gmail_=
quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,=
204);padding-left:1ex"><div dir=3D"rtl"><div style=3D"text-align:left;font-=
family:"arial narrow",sans-serif;font-size:large" dir=3D"ltr">wha=
t if the content of smart ref is a smart ptr?</div></div></blockquote></spa=
n><div><br>So what if it is? In accord with the aforementioned specificatio=
n, an "operation" (which for some reason member function calls qu=
alify as but data member access do not) on the smart reference type will us=
e operator. to call the referenced object if the smart reference itself doe=
sn't have an appropriate function.<br><br>So if a smart reference type =
doesn't have an operator-> or operator*, then using those operators =
will attempt to call the referenced type's versions. If it has none, th=
en it's a compile error. If it has one, then it will be called.<br><br>=
What's the problem?<br><br></div><span class=3D"m_-103410356097426289m_=
-6161057886578964202gmail-"><blockquote class=3D"gmail_quote" style=3D"marg=
in:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1e=
x"><div dir=3D"rtl"><div style=3D"text-align:left;font-family:"arial n=
arrow",sans-serif;font-size:large" dir=3D"ltr">what happens if the con=
tent is yet another smart ref?</div><div style=3D"text-align:left;font-fami=
ly:"arial narrow",sans-serif;font-size:large" dir=3D"ltr">the las=
t question applies to smart ptrs as well what if the object of a smart ptr =
is another smart ptr? smart ptrs have had this annoying defect and I am one=
of those who like it eliminated.<br></div></div></blockquote></span><div><=
br>What defect are you talking about?<br><br></div></div></blockquote><div =
style=3D"text-align:left">=C2=A0</div></span><div style=3D"text-align:left"=
><div style=3D"font-family:"arial narrow",sans-serif;font-size:la=
rge;display:inline" dir=3D"ltr">try this one:=E2=80=8B</div></div><div styl=
e=3D"text-align:left"><span style=3D"font-family:"arial narrow",s=
ans-serif;font-size:large">struct <div style=3D"font-family:"arial nar=
row",sans-serif;font-size:large;display:inline">=E2=80=8B=E2=80=8B</di=
v>test</span></div><div><div style=3D"direction:ltr"><font size=3D"4" face=
=3D"arial narrow, sans-serif">{</font></div><div style=3D"direction:ltr"><f=
ont size=3D"4" face=3D"arial narrow, sans-serif"><span class=3D"m_-10341035=
6097426289m_-6161057886578964202gmail-Apple-tab-span" style=3D"white-space:=
pre-wrap"> </span>void get() {};</font></div><div style=3D"direction:ltr"><=
font size=3D"4" face=3D"arial narrow, sans-serif">};</font></div><div style=
=3D"direction:ltr"><font size=3D"4" face=3D"arial narrow, sans-serif"><br><=
/font></div><div style=3D"direction:ltr"><font size=3D"4" face=3D"arial nar=
row, sans-serif">struct<span class=3D"m_-103410356097426289m_-6161057886578=
964202gmail-Apple-tab-span" style=3D"white-space:pre-wrap"> </span>=C2=A0=
=C2=A0smart_ptr {</font></div><div style=3D"direction:ltr"><font size=3D"4"=
face=3D"arial narrow, sans-serif"><span class=3D"m_-103410356097426289m_-6=
161057886578964202gmail-Apple-tab-span" style=3D"white-space:pre-wrap"> </s=
pan>std::unique_ptr<test> ptr;</font></div><div style=3D"direction:lt=
r"><font size=3D"4" face=3D"arial narrow, sans-serif"><span class=3D"m_-103=
410356097426289m_-6161057886578964202gmail-Apple-tab-span" style=3D"white-s=
pace:pre-wrap"> </span>auto& operator ->() { return ptr; };</font></=
div><div style=3D"direction:ltr"><font size=3D"4" face=3D"arial narrow, san=
s-serif">};</font></div><div style=3D"direction:ltr"><font size=3D"4" face=
=3D"arial narrow, sans-serif"><br></font></div><div style=3D"direction:ltr"=
><span class=3D"m_-103410356097426289m_-6161057886578964202gmail-Apple-tab-=
span" style=3D"font-family:"arial narrow",sans-serif;font-size:la=
rge;white-space:pre-wrap"> </span><span style=3D"font-family:"arial na=
rrow",sans-serif;font-size:large">smart_ptr ptr;</span><br></div><div =
style=3D"direction:ltr"><font size=3D"4" face=3D"arial narrow, sans-serif">=
<span class=3D"m_-103410356097426289m_-6161057886578964202gmail-Apple-tab-s=
pan" style=3D"white-space:pre-wrap"> </span>ptr->get();//</font><div sty=
le=3D"font-family:"arial narrow",sans-serif;font-size:large;displ=
ay:inline">=E2=80=8B</div><span style=3D"font-family:"arial narrow&quo=
t;,sans-serif;font-size:large">test::get not=C2=A0</span><span style=3D"fon=
t-family:"arial narrow",sans-serif;font-size:large">unique_ptr::g=
et.=C2=A0</span></div><div style=3D"direction:ltr"><span style=3D"font-fami=
ly:"arial narrow",sans-serif;font-size:large"><br></span></div><d=
iv dir=3D"ltr"><span style=3D"font-family:"arial narrow",sans-ser=
if;font-size:large">this bugs (at least me).=C2=A0</span></div></div></div>=
</div></div></blockquote><div><br><br></div></span><div>Given that this &qu=
ot;defect" has been there - as part of the design - since the beginnin=
g of overloading ->, it isn't likely to be changed;<br>so what then =
do you think we should do with operator dot? - mirroring the same behaviour=
seems sensible to me.<br></div></div></div></div></blockquote><div><br></d=
iv><div><div class=3D"gmail_default" style=3D"font-family:"arial narro=
w",sans-serif;font-size:large">=E2=80=8BIt hasn't been modified(fi=
xed=E2=80=8B), because existing smart pointers have not been complex enough=
to return another smart pointer in arrow operators and raw pointers simply=
don't have any member fields or methods. But dot in the other hands re=
turns a reference to an object, and a lot more often than never it happens =
that the object has fields and member functions. So the issue becomes bold =
in case of dot. 'dot' shouldn't suffer from what arrow does; &#=
39;arrow' shouldn't either, but there is stronger pressure behind &=
#39;dot' to hide right hand side members in favor of the leftmost handl=
e. I wish same thing would happen to the arrow.</div></div><div class=3D"gm=
ail_default" style=3D"text-align:right;font-family:"arial narrow"=
,sans-serif;font-size:large">Regards,</div><div class=3D"gmail_default" sty=
le=3D"text-align:right;font-family:"arial narrow",sans-serif;font=
-size:large">FM.</div><div style=3D"text-align:right">=C2=A0</div><blockquo=
te class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px =
solid rgb(204,204,204);padding-left:1ex"><div><div class=3D"gmail_extra"><d=
iv class=3D"gmail_quote"><div><br></div></div>-- <br><div class=3D"m_-10341=
0356097426289gmail_signature" data-smartmail=3D"gmail_signature"><div><div>=
Be seeing you,<br></div>Tony<br></div></div>
</div></div><span class=3D"">
<p></p>
-- <br>
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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" target=3D"_=
blank">std-proposals+unsubscribe@<wbr>isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">std-proposals@isocpp.org</a>.<br></span>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/CAOHCbitTRkx9O01GK%2BvaKSDGrejJO%2Bq1=
5pNAsCzhjapneRYCxQ%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfoo=
ter" target=3D"_blank">https://groups.google.com/a/<wbr>isocpp.org/d/msgid/=
std-<wbr>proposals/CAOHCbitTRkx9O01GK%<wbr>2BvaKSDGrejJO%<wbr>2Bq15pNAsCzhj=
apneRYCxQ%40mail.<wbr>gmail.com</a>.<br>
</blockquote></div><br><br clear=3D"all"><div><br></div>-- <br><div class=
=3D"gmail_signature" data-smartmail=3D"gmail_signature"><div><div><div>how =
am I supposed to end the twisted road of=C2=A0 your hair in such a dark nig=
ht??<br>unless the candle of your face does shed some light upon my way!!!<=
br></div></div></div></div>
</div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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/CALDL7dFirQB%2BbzUE%2BFyZAx0zw%2B94PP=
O4Lk%2B%3DGjb1eBTH8Nn%2BAg%40mail.gmail.com?utm_medium=3Demail&utm_source=
=3Dfooter">https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAL=
DL7dFirQB%2BbzUE%2BFyZAx0zw%2B94PPO4Lk%2B%3DGjb1eBTH8Nn%2BAg%40mail.gmail.c=
om</a>.<br />
--001a1143ae42ef4e0d053e359b77--
.
Author: arthur.odwyer@mixpanel.com
Date: Thu, 6 Oct 2016 11:10:27 -0700 (PDT)
Raw View
------=_Part_1451_1953696369.1475777427468
Content-Type: multipart/alternative;
boundary="----=_Part_1452_1771987470.1475777427469"
------=_Part_1452_1771987470.1475777427469
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
On Thursday, October 6, 2016 at 9:39:57 AM UTC-7, Farid Mehrabi wrote:
>
> 2016-10-05 5:01 GMT+03:30 <arthur...@mixpanel.com <javascript:>>:
>
>> On Tuesday, October 4, 2016 at 10:12:11 AM UTC-7, Farid Mehrabi wrote:
>>>
>>> 2016-10-03 23:37 GMT+03:30 Nicol Bolas <jmck...@gmail.com>:
>>>
>>>> On Monday, October 3, 2016 at 3:01:00 PM UTC-4, Farid Mehrabi wrote:
>>>>>
>>>>> what if I want a smart ref which is also a smart ptr?
>>>>>
>>>>
>>>> ... why would you want to? Why would you want a smart reference to act=
=20
>>>> like a smart pointer? That doesn't make any sense.
>>>> =20
>>>>
>>>>> what if the content of smart ref is a smart ptr?
>>>>>
>>>>
>>>> So what if it is? In accord with the aforementioned specification, an=
=20
>>>> "operation" (which for some reason member function calls qualify as bu=
t=20
>>>> data member access do not) on the smart reference type will use operat=
or.=20
>>>> to call the referenced object if the smart reference itself doesn't ha=
ve an=20
>>>> appropriate function.
>>>>
>>>> So if a smart reference type doesn't have an operator-> or operator*,=
=20
>>>> then using those operators will attempt to call the referenced type's=
=20
>>>> versions. If it has none, then it's a compile error. If it has one, th=
en it=20
>>>> will be called.
>>>>
>>>> What's the problem?
>>>>
>>> =20
>>> try this one:=E2=80=8B
>>> struct=20
>>> =E2=80=8B=E2=80=8B
>>> test
>>> {
>>> void get() {};
>>> };
>>>
>>> struct smart_ptr {
>>> std::unique_ptr<test> ptr;
>>> auto& operator ->() { return ptr; };
>>> };
>>>
>>> smart_ptr ptr;
>>> ptr->get();//
>>> =E2=80=8B
>>> test::get not unique_ptr::get.=20
>>>
>>> this bugs (at least me).=20
>>>
>>
>> You've got a probably-a-bug in there: you're returning auto& from your=
=20
>> overloaded operator-> when you probably meant to return auto*.
>> If you make that change, your code will do what you expect =E2=80=94 it'=
ll call=20
>> unique_ptr::get().
>>
>>
> =E2=80=8B=E2=80=8BNo It won't. That would be a syntax error.
>
http://melpon.org/wandbox/permlink/vYHBEc5fMnMW6YRQ
=E2=80=93Arthur
--=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/d6b54875-732b-4d03-8ff6-49099bc00cf6%40isocpp.or=
g.
------=_Part_1452_1771987470.1475777427469
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">On Thursday, October 6, 2016 at 9:39:57 AM UTC-7, Farid Me=
hrabi wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-lef=
t: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"rtl"><=
div style=3D"font-family:"arial narrow",sans-serif;font-size:larg=
e" dir=3D"ltr"><span style=3D"font-family: Arial, Helvetica, sans-serif; fo=
nt-size: 13px;">2016-10-05 5:01 GMT+03:30 </span><span dir=3D"ltr" style=
=3D"font-family: Arial, Helvetica, sans-serif; font-size: 13px;"><<a hre=
f=3D"javascript:" target=3D"_blank" gdf-obfuscated-mailto=3D"JZXNYVzPBwAJ" =
rel=3D"nofollow" onmousedown=3D"this.href=3D'javascript:';return tr=
ue;" onclick=3D"this.href=3D'javascript:';return true;">arthur...@m=
ixpanel.com</a>></span><span style=3D"font-family: Arial, Helvetica, san=
s-serif; font-size: 13px;">:</span><br></div><div><div class=3D"gmail_quote=
"><blockquote class=3D"gmail_quote" style=3D"margin:0 .8ex;border-left:1px =
#ccc solid;border-right:1px #ccc solid;padding-left:1ex;padding-right:1ex">=
<div dir=3D"ltr">On Tuesday, October 4, 2016 at 10:12:11 AM UTC-7, Farid Me=
hrabi wrote:<blockquote class=3D"gmail_quote" style=3D"margin:0;margin-left=
:0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"rtl"><span>=
<div style=3D"text-align:left"><div style=3D"direction:ltr">2016-10-03 23:3=
7 GMT+03:30 Nicol Bolas <span dir=3D"ltr"><<a rel=3D"nofollow">jmck...@g=
mail.com</a>></span>:<br></div></div></span><div><div class=3D"gmail_quo=
te"><span><blockquote class=3D"gmail_quote" style=3D"margin:0px 0.8ex;borde=
r-left:1px solid rgb(204,204,204);border-right:1px solid rgb(204,204,204);p=
adding-left:1ex;padding-right:1ex"><div dir=3D"ltr"><span>On Monday, Octobe=
r 3, 2016 at 3:01:00 PM UTC-4, Farid Mehrabi wrote:<blockquote class=3D"gma=
il_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,2=
04,204);padding-left:1ex"><div dir=3D"rtl"><div style=3D"text-align:left;fo=
nt-family:"arial narrow",sans-serif;font-size:large" dir=3D"ltr">=
what if I want a smart ref which is also a smart ptr?</div></div></blockquo=
te></span><div><br>... why would you want to? Why would you want a smart re=
ference to act like a smart pointer? That doesn't make any sense.<br>=
=C2=A0</div><span><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px=
0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div di=
r=3D"rtl"><div style=3D"text-align:left;font-family:"arial narrow"=
;,sans-serif;font-size:large" dir=3D"ltr">what if the content of smart ref =
is a smart ptr?</div></div></blockquote></span><div><br>So what if it is? I=
n accord with the aforementioned specification, an "operation" (w=
hich for some reason member function calls qualify as but data member acces=
s do not) on the smart reference type will use operator. to call the refere=
nced object if the smart reference itself doesn't have an appropriate f=
unction.<br><br>So if a smart reference type doesn't have an operator-&=
gt; or operator*, then using those operators will attempt to call the refer=
enced type's versions. If it has none, then it's a compile error. I=
f it has one, then it will be called.<br><br>What's the problem?</div><=
/div></blockquote><div style=3D"text-align:left">=C2=A0</div></span><span><=
div style=3D"text-align:left"><div style=3D"font-family:"arial narrow&=
quot;,sans-serif;font-size:large;display:inline" dir=3D"ltr">try this one:=
=E2=80=8B</div></div><div style=3D"text-align:left"><span style=3D"font-fam=
ily:"arial narrow",sans-serif;font-size:large">struct <div style=
=3D"font-family:"arial narrow",sans-serif;font-size:large;display=
:inline">=E2=80=8B=E2=80=8B</div>test</span></div><div><div style=3D"direct=
ion:ltr"><font face=3D"arial narrow, sans-serif" size=3D"4">{</font></div><=
div style=3D"direction:ltr"><font face=3D"arial narrow, sans-serif" size=3D=
"4"><span style=3D"white-space:pre-wrap"> </span>void get() {};</font></div=
><div style=3D"direction:ltr"><font face=3D"arial narrow, sans-serif" size=
=3D"4">};</font></div><div style=3D"direction:ltr"><font face=3D"arial narr=
ow, sans-serif" size=3D"4"><br></font></div><div style=3D"direction:ltr"><f=
ont face=3D"arial narrow, sans-serif" size=3D"4">struct<span style=3D"white=
-space:pre-wrap"> </span>=C2=A0=C2=A0smart_ptr {</font></div><div style=3D"=
direction:ltr"><font face=3D"arial narrow, sans-serif" size=3D"4"><span sty=
le=3D"white-space:pre-wrap"> </span>std::unique_ptr<test> ptr;</font>=
</div><div style=3D"direction:ltr"><font face=3D"arial narrow, sans-serif" =
size=3D"4"><span style=3D"white-space:pre-wrap"> </span>auto& operator =
->() { return ptr; };</font></div><div style=3D"direction:ltr"><font fac=
e=3D"arial narrow, sans-serif" size=3D"4">};</font></div><div style=3D"dire=
ction:ltr"><font face=3D"arial narrow, sans-serif" size=3D"4"><br></font></=
div><div style=3D"direction:ltr"><span style=3D"font-family:"arial nar=
row",sans-serif;font-size:large;white-space:pre-wrap"> </span><span st=
yle=3D"font-family:"arial narrow",sans-serif;font-size:large">sma=
rt_ptr ptr;</span><br></div><div style=3D"direction:ltr"><font face=3D"aria=
l narrow, sans-serif" size=3D"4"><span style=3D"white-space:pre-wrap"> </sp=
an>ptr->get();//</font><div style=3D"font-family:"arial narrow"=
;,sans-serif;font-size:large;display:inline">=E2=80=8B</div><span style=3D"=
font-family:"arial narrow",sans-serif;font-size:large">test::get =
not=C2=A0</span><span style=3D"font-family:"arial narrow",sans-se=
rif;font-size:large">unique_ptr::get.=C2=A0</span></div><div style=3D"direc=
tion:ltr"><span style=3D"font-family:"arial narrow",sans-serif;fo=
nt-size:large"><br></span></div><div dir=3D"ltr"><span style=3D"font-family=
:"arial narrow",sans-serif;font-size:large">this bugs (at least m=
e).=C2=A0</span></div></div></span></div></div></div></blockquote><div><br>=
</div><div>You've got a probably-a-bug in there: you're returning <=
font face=3D"courier new, monospace">auto&</font> from your overloaded =
<font face=3D"courier new, monospace">operator-></font> when you probabl=
y meant to return <font face=3D"courier new, monospace">auto*</font>.</div>=
<div>If you make that change, your code will do what you expect =E2=80=94 i=
t'll call unique_ptr::get().</div><div></div></div><span><div style=3D"=
text-align:left"><br></div></span></blockquote><div style=3D"direction:ltr"=
><br></div><div style=3D"direction:ltr"><div style=3D"font-family:"ari=
al narrow",sans-serif;font-size:large">=E2=80=8B=E2=80=8BNo It won'=
;t. That would be a syntax error.</div></div></div></div></div></blockquote=
><div><br></div><div><a href=3D"http://melpon.org/wandbox/permlink/vYHBEc5f=
MnMW6YRQ" target=3D"_blank" rel=3D"nofollow" style=3D"cursor: pointer;">htt=
p://melpon.org/wandbox/<wbr>permlink/vYHBEc5fMnMW6YRQ</a><br></div><div><br=
></div><div>=E2=80=93Arthur</div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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/d6b54875-732b-4d03-8ff6-49099bc00cf6%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/d6b54875-732b-4d03-8ff6-49099bc00cf6=
%40isocpp.org</a>.<br />
------=_Part_1452_1771987470.1475777427469--
------=_Part_1451_1953696369.1475777427468--
.
Author: Farid Mehrabi <farid.mehrabi@gmail.com>
Date: Fri, 7 Oct 2016 14:29:13 +0330
Raw View
--94eb2c0602665f07f5053e444f15
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
2016-10-06 21:40 GMT+03:30 <arthur.odwyer@mixpanel.com>:
> On Thursday, October 6, 2016 at 9:39:57 AM UTC-7, Farid Mehrabi wrote:
>>
>> 2016-10-05 5:01 GMT+03:30 <arthur...@mixpanel.com>:
>>
>>> On Tuesday, October 4, 2016 at 10:12:11 AM UTC-7, Farid Mehrabi wrote:
>>>>
>>>> 2016-10-03 23:37 GMT+03:30 Nicol Bolas <jmck...@gmail.com>:
>>>>
>>>>> On Monday, October 3, 2016 at 3:01:00 PM UTC-4, Farid Mehrabi wrote:
>>>>>>
>>>>>> what if I want a smart ref which is also a smart ptr?
>>>>>>
>>>>>
>>>>> ... why would you want to? Why would you want a smart reference to ac=
t
>>>>> like a smart pointer? That doesn't make any sense.
>>>>>
>>>>>
>>>>>> what if the content of smart ref is a smart ptr?
>>>>>>
>>>>>
>>>>> So what if it is? In accord with the aforementioned specification, an
>>>>> "operation" (which for some reason member function calls qualify as b=
ut
>>>>> data member access do not) on the smart reference type will use opera=
tor.
>>>>> to call the referenced object if the smart reference itself doesn't h=
ave an
>>>>> appropriate function.
>>>>>
>>>>> So if a smart reference type doesn't have an operator-> or operator*,
>>>>> then using those operators will attempt to call the referenced type's
>>>>> versions. If it has none, then it's a compile error. If it has one, t=
hen it
>>>>> will be called.
>>>>>
>>>>> What's the problem?
>>>>>
>>>>
>>>> try this one:=E2=80=8B
>>>> struct
>>>> =E2=80=8B=E2=80=8B
>>>> test
>>>> {
>>>> void get() {};
>>>> };
>>>>
>>>> struct smart_ptr {
>>>> std::
>>>> =E2=80=8B=E2=80=8B
>>>> unique_ptr<test> ptr;
>>>> auto& operator ->() { return ptr; };
>>>> };
>>>>
>>>> smart_ptr ptr;
>>>> ptr->get();//
>>>> =E2=80=8B
>>>> test::get not unique_ptr::get.
>>>>
>>>> this bugs (at least me).
>>>>
>>>
>>> You've got a probably-a-bug in there: you're returning auto& from your
>>> overloaded operator-> when you probably meant to return auto*.
>>> If you make that change, your code will do what you expect =E2=80=94 it=
'll call
>>> unique_ptr::get().
>>>
>>>
>> =E2=80=8B=E2=80=8BNo It won't. That would be a syntax error.
>>
>
> http://melpon.org/wandbox/permlink/vYHBEc5fMnMW6YRQ
>
No. That was
=E2=80=8Bnot my=E2=80=8B intent. I wanted the
=E2=80=8B'
unique_ptr
=E2=80=8B'=E2=80=8B not the raw ptr. I know what want.
FM.
>
> =E2=80=93Arthur
>
> --
> 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/d6b54875-732b-4d03-
> 8ff6-49099bc00cf6%40isocpp.org
> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/d6b54875-73=
2b-4d03-8ff6-49099bc00cf6%40isocpp.org?utm_medium=3Demail&utm_source=3Dfoot=
er>
> .
>
--=20
how am I supposed to end the twisted road of your hair in such a dark
night??
unless the candle of your face does shed some light upon my way!!!
--=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/CALDL7dGk%3Da7fX47ah2wRTeDL7Ha8vPW44d4eR8FXOU5uh=
Qvkxw%40mail.gmail.com.
--94eb2c0602665f07f5053e444f15
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"rtl"><div class=3D"gmail_default" style=3D"font-family:"ar=
ial narrow",sans-serif;font-size:large" dir=3D"ltr"><span style=3D"fon=
t-family:arial,sans-serif;font-size:small">2016-10-06 21:40 GMT+03:30 </sp=
an><span dir=3D"ltr" style=3D"font-family:arial,sans-serif;font-size:small"=
><<a href=3D"mailto:arthur.odwyer@mixpanel.com" target=3D"_blank">arthur=
..odwyer@mixpanel.com</a>></span><span style=3D"font-family:arial,sans-se=
rif;font-size:small">:</span><br></div><div class=3D"gmail_extra" dir=3D"lt=
r"><div class=3D"gmail_quote"><blockquote class=3D"gmail_quote" style=3D"ma=
rgin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:=
1ex"><div>On Thursday, October 6, 2016 at 9:39:57 AM UTC-7, Farid Mehrabi w=
rote:<span class=3D"gmail-"><blockquote class=3D"gmail_quote" style=3D"marg=
in:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1e=
x"><div dir=3D"rtl"><div style=3D"font-family:"arial narrow",sans=
-serif;font-size:large" dir=3D"ltr"><span style=3D"font-family:arial,helvet=
ica,sans-serif;font-size:13px">2016-10-05 5:01 GMT+03:30 </span><span dir=
=3D"ltr" style=3D"font-family:arial,helvetica,sans-serif;font-size:13px">&l=
t;<a rel=3D"nofollow">arthur...@mixpanel.com</a>></span><span style=3D"f=
ont-family:arial,helvetica,sans-serif;font-size:13px">:</span><br></div><di=
v><div class=3D"gmail_quote"><blockquote class=3D"gmail_quote" style=3D"mar=
gin:0px 0.8ex;border-left:1px solid rgb(204,204,204);border-right:1px solid=
rgb(204,204,204);padding-left:1ex;padding-right:1ex"><div dir=3D"ltr">On T=
uesday, October 4, 2016 at 10:12:11 AM UTC-7, Farid Mehrabi wrote:<blockquo=
te class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px =
solid rgb(204,204,204);padding-left:1ex"><div dir=3D"rtl"><span><div style=
=3D"text-align:left"><div style=3D"direction:ltr">2016-10-03 23:37 GMT+03:3=
0 Nicol Bolas <span dir=3D"ltr"><<a rel=3D"nofollow">jmck...@gmail.com</=
a>></span>:<br></div></div></span><div><div class=3D"gmail_quote"><span>=
<blockquote class=3D"gmail_quote" style=3D"margin:0px 0.8ex;border-left:1px=
solid rgb(204,204,204);border-right:1px solid rgb(204,204,204);padding-lef=
t:1ex;padding-right:1ex"><div dir=3D"ltr"><span>On Monday, October 3, 2016 =
at 3:01:00 PM UTC-4, Farid Mehrabi wrote:<blockquote class=3D"gmail_quote" =
style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);pa=
dding-left:1ex"><div dir=3D"rtl"><div style=3D"text-align:left;font-family:=
"arial narrow",sans-serif;font-size:large" dir=3D"ltr">what if I =
want a smart ref which is also a smart ptr?</div></div></blockquote></span>=
<div><br>... why would you want to? Why would you want a smart reference to=
act like a smart pointer? That doesn't make any sense.<br>=C2=A0</div>=
<span><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;b=
order-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir=3D"rtl"><d=
iv style=3D"text-align:left;font-family:"arial narrow",sans-serif=
;font-size:large" dir=3D"ltr">what if the content of smart ref is a smart p=
tr?</div></div></blockquote></span><div><br>So what if it is? In accord wit=
h the aforementioned specification, an "operation" (which for som=
e reason member function calls qualify as but data member access do not) on=
the smart reference type will use operator. to call the referenced object =
if the smart reference itself doesn't have an appropriate function.<br>=
<br>So if a smart reference type doesn't have an operator-> or opera=
tor*, then using those operators will attempt to call the referenced type&#=
39;s versions. If it has none, then it's a compile error. If it has one=
, then it will be called.<br><br>What's the problem?</div></div></block=
quote><div style=3D"text-align:left">=C2=A0</div></span><span><div style=3D=
"text-align:left"><div style=3D"font-family:"arial narrow",sans-s=
erif;font-size:large;display:inline" dir=3D"ltr">try this one:=E2=80=8B</di=
v></div><div style=3D"text-align:left"><span style=3D"font-family:"ari=
al narrow",sans-serif;font-size:large">struct <div style=3D"font-famil=
y:"arial narrow",sans-serif;font-size:large;display:inline">=E2=
=80=8B=E2=80=8B</div>test</span></div><div><div style=3D"direction:ltr"><fo=
nt face=3D"arial narrow, sans-serif" size=3D"4">{</font></div><div style=3D=
"direction:ltr"><font face=3D"arial narrow, sans-serif" size=3D"4"><span st=
yle=3D"white-space:pre-wrap"> </span>void get() {};</font></div><div style=
=3D"direction:ltr"><font face=3D"arial narrow, sans-serif" size=3D"4">};</f=
ont></div><div style=3D"direction:ltr"><font face=3D"arial narrow, sans-ser=
if" size=3D"4"><br></font></div><div style=3D"direction:ltr"><font face=3D"=
arial narrow, sans-serif" size=3D"4">struct<span style=3D"white-space:pre-w=
rap"> </span>=C2=A0=C2=A0smart_ptr {</font></div><div style=3D"direction:lt=
r"><font face=3D"arial narrow, sans-serif" size=3D"4"><span style=3D"white-=
space:pre-wrap"> </span>std::<div class=3D"gmail_default" style=3D"font-fam=
ily:"arial narrow",sans-serif;font-size:large;display:inline">=E2=
=80=8B=E2=80=8B</div>unique_ptr<test> ptr;</font></div><div style=3D"=
direction:ltr"><font face=3D"arial narrow, sans-serif" size=3D"4"><span sty=
le=3D"white-space:pre-wrap"> </span>auto& operator ->() { return ptr=
; };</font></div><div style=3D"direction:ltr"><font face=3D"arial narrow, s=
ans-serif" size=3D"4">};</font></div><div style=3D"direction:ltr"><font fac=
e=3D"arial narrow, sans-serif" size=3D"4"><br></font></div><div style=3D"di=
rection:ltr"><span style=3D"font-family:"arial narrow",sans-serif=
;font-size:large;white-space:pre-wrap"> </span><span style=3D"font-family:&=
quot;arial narrow",sans-serif;font-size:large">smart_ptr ptr;</span><b=
r></div><div style=3D"direction:ltr"><font face=3D"arial narrow, sans-serif=
" size=3D"4"><span style=3D"white-space:pre-wrap"> </span>ptr->get();//<=
/font><div style=3D"font-family:"arial narrow",sans-serif;font-si=
ze:large;display:inline">=E2=80=8B</div><span style=3D"font-family:"ar=
ial narrow",sans-serif;font-size:large">test::get not=C2=A0</span><spa=
n style=3D"font-family:"arial narrow",sans-serif;font-size:large"=
>unique_ptr::get.=C2=A0</span></div><div style=3D"direction:ltr"><span styl=
e=3D"font-family:"arial narrow",sans-serif;font-size:large"><br><=
/span></div><div dir=3D"ltr"><span style=3D"font-family:"arial narrow&=
quot;,sans-serif;font-size:large">this bugs (at least me).=C2=A0</span></di=
v></div></span></div></div></div></blockquote><div><br></div><div>You'v=
e got a probably-a-bug in there: you're returning <font face=3D"courier=
new, monospace">auto&</font> from your overloaded <font face=3D"courie=
r new, monospace">operator-></font> when you probably meant to return <f=
ont face=3D"courier new, monospace">auto*</font>.</div><div>If you make tha=
t change, your code will do what you expect =E2=80=94 it'll call unique=
_ptr::get().</div><div></div></div><span><div style=3D"text-align:left"><br=
></div></span></blockquote><div style=3D"direction:ltr"><br></div><div styl=
e=3D"direction:ltr"><div style=3D"font-family:"arial narrow",sans=
-serif;font-size:large">=E2=80=8B=E2=80=8BNo It won't. That would be a =
syntax error.</div></div></div></div></div></blockquote><div><br></div></sp=
an><div><a href=3D"http://melpon.org/wandbox/permlink/vYHBEc5fMnMW6YRQ" rel=
=3D"nofollow" target=3D"_blank">http://melpon.org/wandbox/perm<wbr>link/vYH=
BEc5fMnMW6YRQ</a></div></div></blockquote><div><br></div><div><div class=3D=
"gmail_default" style=3D"font-family:"arial narrow",sans-serif;fo=
nt-size:large;display:inline">No. That was</div>=C2=A0<div class=3D"gmail_d=
efault" style=3D"font-family:"arial narrow",sans-serif;font-size:=
large;display:inline">=E2=80=8Bnot my=E2=80=8B intent. I wanted the=C2=A0</=
div><div class=3D"gmail_default" style=3D"font-family:"arial narrow&qu=
ot;,sans-serif;font-size:large;display:inline">=E2=80=8B'</div><span st=
yle=3D"font-family:"arial narrow",sans-serif;font-size:large">uni=
que_ptr<div class=3D"gmail_default" style=3D"font-family:"arial narrow=
",sans-serif;font-size:large;display:inline">=E2=80=8B'=E2=80=8B n=
ot the raw ptr. I know what want.</div></span></div><div><span style=3D"fon=
t-family:"arial narrow",sans-serif;font-size:large"><div class=3D=
"gmail_default" style=3D"font-family:"arial narrow",sans-serif;fo=
nt-size:large;display:inline"><br></div></span></div><div><span style=3D"fo=
nt-family:"arial narrow",sans-serif;font-size:large"><div class=
=3D"gmail_default" style=3D"font-family:"arial narrow",sans-serif=
;font-size:large;display:inline">FM.</div></span></div><div><br></div><bloc=
kquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:=
1px solid rgb(204,204,204);padding-left:1ex"><div><div><br></div><div><br><=
/div><div>=E2=80=93Arthur</div></div>
<p></p>
-- <br><span class=3D"gmail-">
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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" target=3D"_=
blank">std-proposals+unsubscribe@<wbr>isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">std-proposals@isocpp.org</a>.<br></span>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/d6b54875-732b-4d03-8ff6-49099bc00cf6%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter" target=3D"_blank">=
https://groups.google.com/a/<wbr>isocpp.org/d/msgid/std-<wbr>proposals/d6b5=
4875-732b-4d03-<wbr>8ff6-49099bc00cf6%40isocpp.org</a><wbr>.<br>
</blockquote></div><br><br clear=3D"all"><div><br></div>-- <br><div class=
=3D"gmail_signature"><div><div><div>how am I supposed to end the twisted ro=
ad of=C2=A0 your hair in such a dark night??<br>unless the candle of your f=
ace does shed some light upon my way!!!<br></div></div></div></div>
</div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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/CALDL7dGk%3Da7fX47ah2wRTeDL7Ha8vPW44d=
4eR8FXOU5uhQvkxw%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">h=
ttps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CALDL7dGk%3Da7f=
X47ah2wRTeDL7Ha8vPW44d4eR8FXOU5uhQvkxw%40mail.gmail.com</a>.<br />
--94eb2c0602665f07f5053e444f15--
.
Author: Nicol Bolas <jmckesson@gmail.com>
Date: Fri, 7 Oct 2016 08:18:47 -0700 (PDT)
Raw View
------=_Part_536_1987926434.1475853527911
Content-Type: multipart/alternative;
boundary="----=_Part_537_971094883.1475853527911"
------=_Part_537_971094883.1475853527911
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
On Friday, October 7, 2016 at 7:00:04 AM UTC-4, Farid Mehrabi wrote:
>
> 2016-10-06 21:40 GMT+03:30 <arthur...@mixpanel.com <javascript:>>:
>
>> On Thursday, October 6, 2016 at 9:39:57 AM UTC-7, Farid Mehrabi wrote:
>>>
>>> 2016-10-05 5:01 GMT+03:30 <arthur...@mixpanel.com>:
>>>
>>>> On Tuesday, October 4, 2016 at 10:12:11 AM UTC-7, Farid Mehrabi wrote:
>>>>>
>>>>> 2016-10-03 23:37 GMT+03:30 Nicol Bolas <jmck...@gmail.com>:
>>>>>
>>>>>> On Monday, October 3, 2016 at 3:01:00 PM UTC-4, Farid Mehrabi wrote:
>>>>>>>
>>>>>>> what if I want a smart ref which is also a smart ptr?
>>>>>>>
>>>>>>
>>>>>> ... why would you want to? Why would you want a smart reference to=
=20
>>>>>> act like a smart pointer? That doesn't make any sense.
>>>>>> =20
>>>>>>
>>>>>>> what if the content of smart ref is a smart ptr?
>>>>>>>
>>>>>>
>>>>>> So what if it is? In accord with the aforementioned specification, a=
n=20
>>>>>> "operation" (which for some reason member function calls qualify as =
but=20
>>>>>> data member access do not) on the smart reference type will use oper=
ator.=20
>>>>>> to call the referenced object if the smart reference itself doesn't =
have an=20
>>>>>> appropriate function.
>>>>>>
>>>>>> So if a smart reference type doesn't have an operator-> or operator*=
,=20
>>>>>> then using those operators will attempt to call the referenced type'=
s=20
>>>>>> versions. If it has none, then it's a compile error. If it has one, =
then it=20
>>>>>> will be called.
>>>>>>
>>>>>> What's the problem?
>>>>>>
>>>>> =20
>>>>> try this one:=E2=80=8B
>>>>> struct=20
>>>>> =E2=80=8B=E2=80=8B
>>>>> test
>>>>> {
>>>>> void get() {};
>>>>> };
>>>>>
>>>>> struct smart_ptr {
>>>>> std::
>>>>> =E2=80=8B=E2=80=8B
>>>>> unique_ptr<test> ptr;
>>>>> auto& operator ->() { return ptr; };
>>>>> };
>>>>>
>>>>> smart_ptr ptr;
>>>>> ptr->get();//
>>>>> =E2=80=8B
>>>>> test::get not unique_ptr::get.=20
>>>>>
>>>>> this bugs (at least me).=20
>>>>>
>>>>
>>>> You've got a probably-a-bug in there: you're returning auto& from your=
=20
>>>> overloaded operator-> when you probably meant to return auto*.
>>>> If you make that change, your code will do what you expect =E2=80=94 i=
t'll call=20
>>>> unique_ptr::get().
>>>>
>>>>
>>> =E2=80=8B=E2=80=8BNo It won't. That would be a syntax error.
>>>
>>
>> http://melpon.org/wandbox/permlink/vYHBEc5fMnMW6YRQ
>>
>
> No. That was
> =20
> =E2=80=8Bnot my=E2=80=8B intent. I wanted the=20
> =E2=80=8B'
> unique_ptr
> =E2=80=8B'=E2=80=8B not the raw ptr. I know what want.
>
That's what his code gives you. `operator->` returns a `unique_ptr*`. So=20
`ptr->get` accesses `unique_ptr::get`.
Please run the code in question.
--=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/269cb659-a9eb-4ea0-8033-deac98904990%40isocpp.or=
g.
------=_Part_537_971094883.1475853527911
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><br><br>On Friday, October 7, 2016 at 7:00:04 AM UTC-4, Fa=
rid Mehrabi wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;marg=
in-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"=
rtl"><div style=3D"font-family:"arial narrow",sans-serif;font-siz=
e:large" dir=3D"ltr"><span style=3D"font-family:arial,sans-serif;font-size:=
small">2016-10-06 21:40 GMT+03:30 </span><span dir=3D"ltr" style=3D"font-f=
amily:arial,sans-serif;font-size:small"><<a href=3D"javascript:" target=
=3D"_blank" gdf-obfuscated-mailto=3D"N0wWomQLCAAJ" rel=3D"nofollow" onmouse=
down=3D"this.href=3D'javascript:';return true;" onclick=3D"this.hre=
f=3D'javascript:';return true;">arthur...@mixpanel.com</a>></spa=
n><span style=3D"font-family:arial,sans-serif;font-size:small">:</span><br>=
</div><div dir=3D"ltr"><div class=3D"gmail_quote"><blockquote class=3D"gmai=
l_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,20=
4,204);padding-left:1ex"><div>On Thursday, October 6, 2016 at 9:39:57 AM UT=
C-7, Farid Mehrabi wrote:<span><blockquote class=3D"gmail_quote" style=3D"m=
argin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left=
:1ex"><div dir=3D"rtl"><div style=3D"font-family:"arial narrow",s=
ans-serif;font-size:large" dir=3D"ltr"><span style=3D"font-family:arial,hel=
vetica,sans-serif;font-size:13px">2016-10-05 5:01 GMT+03:30 </span><span d=
ir=3D"ltr" style=3D"font-family:arial,helvetica,sans-serif;font-size:13px">=
<<a rel=3D"nofollow">arthur...@mixpanel.com</a>></span><span style=3D=
"font-family:arial,helvetica,sans-serif;font-size:13px">:</span><br></div><=
div><div class=3D"gmail_quote"><blockquote class=3D"gmail_quote" style=3D"m=
argin:0px 0.8ex;border-left:1px solid rgb(204,204,204);border-right:1px sol=
id rgb(204,204,204);padding-left:1ex;padding-right:1ex"><div dir=3D"ltr">On=
Tuesday, October 4, 2016 at 10:12:11 AM UTC-7, Farid Mehrabi wrote:<blockq=
uote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1p=
x solid rgb(204,204,204);padding-left:1ex"><div dir=3D"rtl"><span><div styl=
e=3D"text-align:left"><div style=3D"direction:ltr">2016-10-03 23:37 GMT+03:=
30 Nicol Bolas <span dir=3D"ltr"><<a rel=3D"nofollow">jmck...@gmail.com<=
/a>></span>:<br></div></div></span><div><div class=3D"gmail_quote"><span=
><blockquote class=3D"gmail_quote" style=3D"margin:0px 0.8ex;border-left:1p=
x solid rgb(204,204,204);border-right:1px solid rgb(204,204,204);padding-le=
ft:1ex;padding-right:1ex"><div dir=3D"ltr"><span>On Monday, October 3, 2016=
at 3:01:00 PM UTC-4, Farid Mehrabi wrote:<blockquote class=3D"gmail_quote"=
style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);p=
adding-left:1ex"><div dir=3D"rtl"><div style=3D"text-align:left;font-family=
:"arial narrow",sans-serif;font-size:large" dir=3D"ltr">what if I=
want a smart ref which is also a smart ptr?</div></div></blockquote></span=
><div><br>... why would you want to? Why would you want a smart reference t=
o act like a smart pointer? That doesn't make any sense.<br>=C2=A0</div=
><span><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;=
border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir=3D"rtl"><=
div style=3D"text-align:left;font-family:"arial narrow",sans-seri=
f;font-size:large" dir=3D"ltr">what if the content of smart ref is a smart =
ptr?</div></div></blockquote></span><div><br>So what if it is? In accord wi=
th the aforementioned specification, an "operation" (which for so=
me reason member function calls qualify as but data member access do not) o=
n the smart reference type will use operator. to call the referenced object=
if the smart reference itself doesn't have an appropriate function.<br=
><br>So if a smart reference type doesn't have an operator-> or oper=
ator*, then using those operators will attempt to call the referenced type&=
#39;s versions. If it has none, then it's a compile error. If it has on=
e, then it will be called.<br><br>What's the problem?</div></div></bloc=
kquote><div style=3D"text-align:left">=C2=A0</div></span><span><div style=
=3D"text-align:left"><div style=3D"font-family:"arial narrow",san=
s-serif;font-size:large;display:inline" dir=3D"ltr">try this one:=E2=80=8B<=
/div></div><div style=3D"text-align:left"><span style=3D"font-family:"=
arial narrow",sans-serif;font-size:large">struct <div style=3D"font-fa=
mily:"arial narrow",sans-serif;font-size:large;display:inline">=
=E2=80=8B=E2=80=8B</div>test</span></div><div><div style=3D"direction:ltr">=
<font size=3D"4" face=3D"arial narrow, sans-serif">{</font></div><div style=
=3D"direction:ltr"><font size=3D"4" face=3D"arial narrow, sans-serif"><span=
style=3D"white-space:pre-wrap"> </span>void get() {};</font></div><div sty=
le=3D"direction:ltr"><font size=3D"4" face=3D"arial narrow, sans-serif">};<=
/font></div><div style=3D"direction:ltr"><font size=3D"4" face=3D"arial nar=
row, sans-serif"><br></font></div><div style=3D"direction:ltr"><font size=
=3D"4" face=3D"arial narrow, sans-serif">struct<span style=3D"white-space:p=
re-wrap"> </span>=C2=A0=C2=A0smart_ptr {</font></div><div style=3D"directio=
n:ltr"><font size=3D"4" face=3D"arial narrow, sans-serif"><span style=3D"wh=
ite-space:pre-wrap"> </span>std::<div style=3D"font-family:"arial narr=
ow",sans-serif;font-size:large;display:inline">=E2=80=8B=E2=80=8B</div=
>unique_ptr<test> ptr;</font></div><div style=3D"direction:ltr"><font=
size=3D"4" face=3D"arial narrow, sans-serif"><span style=3D"white-space:pr=
e-wrap"> </span>auto& operator ->() { return ptr; };</font></div><di=
v style=3D"direction:ltr"><font size=3D"4" face=3D"arial narrow, sans-serif=
">};</font></div><div style=3D"direction:ltr"><font size=3D"4" face=3D"aria=
l narrow, sans-serif"><br></font></div><div style=3D"direction:ltr"><span s=
tyle=3D"font-family:"arial narrow",sans-serif;font-size:large;whi=
te-space:pre-wrap"> </span><span style=3D"font-family:"arial narrow&qu=
ot;,sans-serif;font-size:large">smart_ptr ptr;</span><br></div><div style=
=3D"direction:ltr"><font size=3D"4" face=3D"arial narrow, sans-serif"><span=
style=3D"white-space:pre-wrap"> </span>ptr->get();//</font><div style=
=3D"font-family:"arial narrow",sans-serif;font-size:large;display=
:inline">=E2=80=8B</div><span style=3D"font-family:"arial narrow"=
,sans-serif;font-size:large">test::get not=C2=A0</span><span style=3D"font-=
family:"arial narrow",sans-serif;font-size:large">unique_ptr::get=
..=C2=A0</span></div><div style=3D"direction:ltr"><span style=3D"font-family=
:"arial narrow",sans-serif;font-size:large"><br></span></div><div=
dir=3D"ltr"><span style=3D"font-family:"arial narrow",sans-serif=
;font-size:large">this bugs (at least me).=C2=A0</span></div></div></span><=
/div></div></div></blockquote><div><br></div><div>You've got a probably=
-a-bug in there: you're returning <font face=3D"courier new, monospace"=
>auto&</font> from your overloaded <font face=3D"courier new, monospace=
">operator-></font> when you probably meant to return <font face=3D"cour=
ier new, monospace">auto*</font>.</div><div>If you make that change, your c=
ode will do what you expect =E2=80=94 it'll call unique_ptr::get().</di=
v><div></div></div><span><div style=3D"text-align:left"><br></div></span></=
blockquote><div style=3D"direction:ltr"><br></div><div style=3D"direction:l=
tr"><div style=3D"font-family:"arial narrow",sans-serif;font-size=
:large">=E2=80=8B=E2=80=8BNo It won't. That would be a syntax error.</d=
iv></div></div></div></div></blockquote><div><br></div></span><div><a href=
=3D"http://melpon.org/wandbox/permlink/vYHBEc5fMnMW6YRQ" rel=3D"nofollow" t=
arget=3D"_blank" onmousedown=3D"this.href=3D'http://www.google.com/url?=
q\x3dhttp%3A%2F%2Fmelpon.org%2Fwandbox%2Fpermlink%2FvYHBEc5fMnMW6YRQ\x26sa\=
x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHbAFj6OONzAwS09f-XRwnTRCAsQA';return =
true;" onclick=3D"this.href=3D'http://www.google.com/url?q\x3dhttp%3A%2=
F%2Fmelpon.org%2Fwandbox%2Fpermlink%2FvYHBEc5fMnMW6YRQ\x26sa\x3dD\x26sntz\x=
3d1\x26usg\x3dAFQjCNHbAFj6OONzAwS09f-XRwnTRCAsQA';return true;">http://=
melpon.org/wandbox/<wbr>permlink/vYHBEc5fMnMW6YRQ</a></div></div></blockquo=
te><div><br></div><div><div style=3D"font-family:"arial narrow",s=
ans-serif;font-size:large;display:inline">No. That was</div>=C2=A0<div styl=
e=3D"font-family:"arial narrow",sans-serif;font-size:large;displa=
y:inline">=E2=80=8Bnot my=E2=80=8B intent. I wanted the=C2=A0</div><div sty=
le=3D"font-family:"arial narrow",sans-serif;font-size:large;displ=
ay:inline">=E2=80=8B'</div><span style=3D"font-family:"arial narro=
w",sans-serif;font-size:large">unique_ptr<div style=3D"font-family:&qu=
ot;arial narrow",sans-serif;font-size:large;display:inline">=E2=80=8B&=
#39;=E2=80=8B not the raw ptr. I know what want.</div></span></div></div></=
div></div></blockquote><div><br>That's what his code gives you. `operat=
or->` returns a `unique_ptr*`. So `ptr->get` accesses `unique_ptr::ge=
t`.<br><br>Please run the code in question.</div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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/269cb659-a9eb-4ea0-8033-deac98904990%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/269cb659-a9eb-4ea0-8033-deac98904990=
%40isocpp.org</a>.<br />
------=_Part_537_971094883.1475853527911--
------=_Part_536_1987926434.1475853527911--
.