Topic: comparison operators for smart and dumb pointers


Author: purplekarrot@gmail.com
Date: Thu, 22 Jan 2015 05:08:22 -0800 (PST)
Raw View
------=_Part_485_1219861477.1421932102721
Content-Type: multipart/alternative;
 boundary="----=_Part_486_185466030.1421932102722"

------=_Part_486_185466030.1421932102722
Content-Type: text/plain; charset=UTF-8

Hi,

Is there a reason *not* to provide comparison operators that compare smart
pointers with their underlying T* or was this just not considered yet?
I imagine something like the following (plus implementations for !=,<,<=,>,
and >=):

template<class T, class D>
bool operator==(const unique_ptr<T, D>& x, T* y)
{
return x.get() == y;
}


My use case:

std::vector<std::unique_ptr<T>> storage;
T* p = ...;
auto it = find(begin(storage), end(storage), p);


cheers, Daniel

--

---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

------=_Part_486_185466030.1421932102722
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Hi,<div><br></div><div>Is there a reason *not* to provide =
comparison operators that compare smart pointers with their underlying T* o=
r was this just not considered yet?</div>I imagine something like the follo=
wing (plus implementations for !=3D,&lt;,&lt;=3D,&gt;, and &gt;=3D):<div><b=
r><blockquote style=3D"margin: 0 0 0 40px; border: none; padding: 0px;"><di=
v><div>template&lt;class T, class D&gt;</div></div><div><div>bool operator=
=3D=3D(const unique_ptr&lt;T, D&gt;&amp; x, T* y)</div></div><div><div>{</d=
iv></div><div><div><span class=3D"Apple-tab-span" style=3D"white-space:pre"=
> </span>return x.get() =3D=3D y;</div></div><div><div>}</div></div></block=
quote><div><div><br></div></div></div><div>My use case:</div><div><br></div=
><blockquote style=3D"margin: 0 0 0 40px; border: none; padding: 0px;"><div=
>std::vector&lt;std::unique_ptr&lt;T&gt;&gt; storage;</div><div>T* p =3D ..=
..;</div><div>auto it =3D find(begin(storage), end(storage), p);</div></bloc=
kquote><div><br></div><div>cheers, Daniel</div></div>

<p></p>

-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_486_185466030.1421932102722--
------=_Part_485_1219861477.1421932102721--

.


Author: masse.nicolas@gmail.com
Date: Thu, 22 Jan 2015 06:24:59 -0800 (PST)
Raw View
------=_Part_513_771876145.1421936699330
Content-Type: multipart/alternative;
 boundary="----=_Part_514_2121141135.1421936699330"

------=_Part_514_2121141135.1421936699330
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

Hi,=20
I think the question is whether we want smart pointer to compare just like=
=20
normal pointer (using their memory adresses) or if we want them to delegate=
=20
the comparaison to their pointed data (assuming they are comparable).

Le jeudi 22 janvier 2015 14:08:22 UTC+1, Daniel Pfeifer a =C3=A9crit :
>
> Hi,
>
> Is there a reason *not* to provide comparison operators that compare smar=
t=20
> pointers with their underlying T* or was this just not considered yet?
> I imagine something like the following (plus implementations for=20
> !=3D,<,<=3D,>, and >=3D):
>
> template<class T, class D>
> bool operator=3D=3D(const unique_ptr<T, D>& x, T* y)
> {
> return x.get() =3D=3D y;
> }
>
>
> My use case:
>
> std::vector<std::unique_ptr<T>> storage;
> T* p =3D ...;
> auto it =3D find(begin(storage), end(storage), p);
>
>
> cheers, Daniel
>

--=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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.

------=_Part_514_2121141135.1421936699330
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Hi, <br>I think the question is whether we want smart poin=
ter to compare just like normal pointer (using their memory adresses) or if=
 we want them to delegate the comparaison to their pointed data (assuming t=
hey are comparable).<br><br>Le jeudi 22 janvier 2015 14:08:22 UTC+1, Daniel=
 Pfeifer a =C3=A9crit&nbsp;:<blockquote class=3D"gmail_quote" style=3D"marg=
in: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><d=
iv dir=3D"ltr">Hi,<div><br></div><div>Is there a reason *not* to provide co=
mparison operators that compare smart pointers with their underlying T* or =
was this just not considered yet?</div>I imagine something like the followi=
ng (plus implementations for !=3D,&lt;,&lt;=3D,&gt;, and &gt;=3D):<div><br>=
<blockquote style=3D"margin:0 0 0 40px;border:none;padding:0px"><div><div>t=
emplate&lt;class T, class D&gt;</div></div><div><div>bool operator=3D=3D(co=
nst unique_ptr&lt;T, D&gt;&amp; x, T* y)</div></div><div><div>{</div></div>=
<div><div><span style=3D"white-space:pre"> </span>return x.get() =3D=3D y;<=
/div></div><div><div>}</div></div></blockquote><div><div><br></div></div></=
div><div>My use case:</div><div><br></div><blockquote style=3D"margin:0 0 0=
 40px;border:none;padding:0px"><div>std::vector&lt;std::unique_ptr&lt;T&gt;=
<wbr>&gt; storage;</div><div>T* p =3D ...;</div><div>auto it =3D find(begin=
(storage), end(storage), p);</div></blockquote><div><br></div><div>cheers, =
Daniel</div></div></blockquote></div>

<p></p>

-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_514_2121141135.1421936699330--
------=_Part_513_771876145.1421936699330--

.


Author: Daniel Pfeifer <purplekarrot@gmail.com>
Date: Thu, 22 Jan 2015 07:22:35 -0800 (PST)
Raw View
------=_Part_557_2008261575.1421940155922
Content-Type: multipart/alternative;
 boundary="----=_Part_558_1263603780.1421940155928"

------=_Part_558_1263603780.1421940155928
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

On Thursday, January 22, 2015 at 3:24:59 PM UTC+1, masse....@gmail.com=20
wrote:
>
> Hi,=20
> I think the question is whether we want smart pointer to compare just lik=
e=20
> normal pointer (using their memory adresses) or if we want them to delega=
te=20
> the comparaison to their pointed data (assuming they are comparable).
>

Comparing two values of type T* compares the addresses, not the content.
Comparing two values of type unique_ptr<T> compares the addresses, not the=
=20
content.
I think comparing unique_ptr<T> with T* should follow this tradition.
=20

> Le jeudi 22 janvier 2015 14:08:22 UTC+1, Daniel Pfeifer a =C3=A9crit :
>>
>> Hi,
>>
>> Is there a reason *not* to provide comparison operators that compare=20
>> smart pointers with their underlying T* or was this just not considered =
yet?
>> I imagine something like the following (plus implementations for=20
>> !=3D,<,<=3D,>, and >=3D):
>>
>> template<class T, class D>
>> bool operator=3D=3D(const unique_ptr<T, D>& x, T* y)
>> {
>> return x.get() =3D=3D y;
>> }
>>
>>
>> My use case:
>>
>> std::vector<std::unique_ptr<T>> storage;
>> T* p =3D ...;
>> auto it =3D find(begin(storage), end(storage), p);
>>
>>
>> cheers, Daniel
>>
>

--=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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.

------=_Part_558_1263603780.1421940155928
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Thursday, January 22, 2015 at 3:24:59 PM UTC+1, masse..=
...@gmail.com 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=
"ltr">Hi, <br>I think the question is whether we want smart pointer to comp=
are just like normal pointer (using their memory adresses) or if we want th=
em to delegate the comparaison to their pointed data (assuming they are com=
parable).<br></div></blockquote><div><br></div><div>Comparing two values of=
 type T* compares the addresses, not the content.</div><div>Comparing two v=
alues of type unique_ptr&lt;T&gt; compares the addresses, not the content.<=
/div><div>I think comparing unique_ptr&lt;T&gt; with T* should follow this =
tradition.<br></div><div>&nbsp;<br></div><blockquote class=3D"gmail_quote" =
style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-l=
eft: 1ex;"><div dir=3D"ltr">Le jeudi 22 janvier 2015 14:08:22 UTC+1, Daniel=
 Pfeifer a =C3=A9crit&nbsp;:<blockquote class=3D"gmail_quote" style=3D"marg=
in:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div di=
r=3D"ltr">Hi,<div><br></div><div>Is there a reason *not* to provide compari=
son operators that compare smart pointers with their underlying T* or was t=
his just not considered yet?</div>I imagine something like the following (p=
lus implementations for !=3D,&lt;,&lt;=3D,&gt;, and &gt;=3D):<div><br><bloc=
kquote style=3D"margin:0 0 0 40px;border:none;padding:0px"><div><div>templa=
te&lt;class T, class D&gt;</div></div><div><div>bool operator=3D=3D(const u=
nique_ptr&lt;T, D&gt;&amp; x, T* y)</div></div><div><div>{</div></div><div>=
<div><span style=3D"white-space:pre"> </span>return x.get() =3D=3D y;</div>=
</div><div><div>}</div></div></blockquote><div><div><br></div></div></div><=
div>My use case:</div><div><br></div><blockquote style=3D"margin:0 0 0 40px=
;border:none;padding:0px"><div>std::vector&lt;std::unique_ptr&lt;T&gt;<wbr>=
&gt; storage;</div><div>T* p =3D ...;</div><div>auto it =3D find(begin(stor=
age), end(storage), p);</div></blockquote><div><br></div><div>cheers, Danie=
l</div></div></blockquote></div></blockquote></div>

<p></p>

-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_558_1263603780.1421940155928--
------=_Part_557_2008261575.1421940155922--

.


Author: Nevin Liber <nevin@eviloverlord.com>
Date: Thu, 22 Jan 2015 10:15:32 -0600
Raw View
--001a1138ef18a6d912050d3ffd94
Content-Type: text/plain; charset=UTF-8

On 22 January 2015 at 07:08, <purplekarrot@gmail.com> wrote:

> Hi,
>
> Is there a reason *not* to provide comparison operators that compare smart
> pointers with their underlying T* or was this just not considered yet?
> I imagine something like the following (plus implementations for
> !=,<,<=,>, and >=):
>
> template<class T, class D>
> bool operator==(const unique_ptr<T, D>& x, T* y)
> {
> return x.get() == y;
> }
>
>
While I don't think equality comparisons would be controversial, ordered
comparisons most certainly would be (smart pointers are required to provide
a strict weak total order while raw pointers are not).


> My use case:
>
> std::vector<std::unique_ptr<T>> storage;
> T* p = ...;
> auto it = find(begin(storage), end(storage), p);
>
>
Given that you can write this as:

auto it = find_if(begin(storage), end(storage), [&](auto&& u){ return
u.get() == p; });

combined with how rarely one has to perform that operation at all, I don't
find the use case particularly compelling.
--
 Nevin ":-)" Liber  <mailto:nevin@eviloverlord.com>  (847) 691-1404

--

---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

--001a1138ef18a6d912050d3ffd94
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On 22 January 2015 at 07:08,  <span dir=3D"ltr">&lt;<a hre=
f=3D"mailto:purplekarrot@gmail.com" target=3D"_blank">purplekarrot@gmail.co=
m</a>&gt;</span> wrote:<br><div class=3D"gmail_extra"><div class=3D"gmail_q=
uote"><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-l=
eft:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr">Hi,<div><br></div><di=
v>Is there a reason *not* to provide comparison operators that compare smar=
t pointers with their underlying T* or was this just not considered yet?</d=
iv>I imagine something like the following (plus implementations for !=3D,&l=
t;,&lt;=3D,&gt;, and &gt;=3D):<div><br><blockquote style=3D"margin:0 0 0 40=
px;border:none;padding:0px"><div><div>template&lt;class T, class D&gt;</div=
></div><div><div>bool operator=3D=3D(const unique_ptr&lt;T, D&gt;&amp; x, T=
* y)</div></div><div><div>{</div></div><div><div><span style=3D"white-space=
:pre-wrap"> </span>return x.get() =3D=3D y;</div></div><div><div>}</div></d=
iv></blockquote></div></div></blockquote><div><br></div><div>While I don&#3=
9;t think equality comparisons would be controversial, ordered comparisons =
most certainly would be (smart pointers are required to provide a strict we=
ak total order while raw pointers are not).</div><div>=C2=A0<br></div><bloc=
kquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #cc=
c solid;padding-left:1ex"><div dir=3D"ltr"><div><div><div>My use case:<br><=
/div></div></div><div><br></div><blockquote style=3D"margin:0 0 0 40px;bord=
er:none;padding:0px"><div>std::vector&lt;std::unique_ptr&lt;T&gt;&gt; stora=
ge;</div><div>T* p =3D ...;</div><div>auto it =3D find(begin(storage), end(=
storage), p);</div></blockquote></div></blockquote><div><br></div><div>Give=
n that you can write this as:</div><div><br></div><div><font face=3D"monosp=
ace, monospace" size=3D"1">auto it =3D find_if(begin(storage), end(storage)=
, [&amp;](auto&amp;&amp; u){ return u.get() =3D=3D p; });</font></div><div>=
<br></div><div>combined with how rarely one has to perform that operation a=
t all, I don&#39;t find the use case particularly compelling.</div></div>--=
 <br><div class=3D"gmail_signature">=C2=A0Nevin &quot;:-)&quot; Liber=C2=A0=
 &lt;mailto:<a href=3D"mailto:nevin@eviloverlord.com" target=3D"_blank">nev=
in@eviloverlord.com</a>&gt;=C2=A0 (847) 691-1404</div>
</div></div>

<p></p>

-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

--001a1138ef18a6d912050d3ffd94--

.


Author: Zhihao Yuan <zy@miator.net>
Date: Thu, 22 Jan 2015 11:21:34 -0500
Raw View
On Thu, Jan 22, 2015 at 8:08 AM,  <purplekarrot@gmail.com> wrote:
> Is there a reason *not* to provide comparison operators that compare smart
> pointers with their underlying T* or was this just not considered yet?
> I imagine something like the following (plus implementations for !=,<,<=,>,
> and >=):
>

I guess, for some consistency w.r.t. the rest of the library,
where class A comparable with B, then A is implicitly
convertible from B.

> My use case:
>
> std::vector<std::unique_ptr<T>> storage;
> T* p = ...;
> auto it = find(begin(storage), end(storage), p);
>

Nevin suggested std::find_if.  In addition, with
the in-construction standard ranges library, you can write

  auto it = find(storage, p, &decltype(storage)::value_type::get);

--
Zhihao Yuan, ID lichray
The best way to predict the future is to invent it.
___________________________________________________
4BSD -- http://bit.ly/blog4bsd

--

---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

.


Author: Ville Voutilainen <ville.voutilainen@gmail.com>
Date: Thu, 22 Jan 2015 18:36:58 +0200
Raw View
On 22 January 2015 at 18:21, Zhihao Yuan <zy@miator.net> wrote:
> Nevin suggested std::find_if.  In addition, with
> the in-construction standard ranges library, you can write
>
>   auto it = find(storage, p, &decltype(storage)::value_type::get);


Digression: I seriously hope people don't start using such decltype expressions,
because they will need a remove_reference_t to go along with it if storage is
a reference. So, nice try at writing shorter/more-generic code, but
&std::unique_ptr<T>::get is actually shorter and works better.

On the other hand, perhaps we should allow using member access operators with
reference types. ;)

--

---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

.


Author: Zhihao Yuan <zy@miator.net>
Date: Thu, 22 Jan 2015 11:52:31 -0500
Raw View
On Thu, Jan 22, 2015 at 11:36 AM, Ville Voutilainen
<ville.voutilainen@gmail.com> wrote:
>>
>>   auto it = find(storage, p, &decltype(storage)::value_type::get);
>
>
> Digression: I seriously hope people don't start using such decltype expressions,
> because they will need a remove_reference_t to go along with it if storage is
> a reference. So, nice try at writing shorter/more-generic code, but
> &std::unique_ptr<T>::get is actually shorter and works better.
>

Yea, I found the code disgusting after I post it...

> On the other hand, perhaps we should allow using member access operators with
> reference types. ;)
>

What I hope is to have some language support for generic member
access:

  [].first
  [].get()

Same as the trend to replace std::less<T> with std::less<>, when the
algorithm is generic, the function it calls had better also be generic.

--
Zhihao Yuan, ID lichray
The best way to predict the future is to invent it.
___________________________________________________
4BSD -- http://bit.ly/blog4bsd

--

---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

.


Author: David Krauss <potswa@gmail.com>
Date: Sat, 24 Jan 2015 21:27:32 +0800
Raw View
--Apple-Mail=_11A88937-00A2-4A26-BB47-FDF820C6AB01
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=UTF-8


> On 2015=E2=80=9301=E2=80=9323, at 12:36 AM, Ville Voutilainen <ville.vout=
ilainen@gmail.com> wrote:
>=20
> On the other hand, perhaps we should allow using member access operators =
with
> reference types. ;)

Yes, someone propose this, please :) . (To be pedantic, it=E2=80=99s the sc=
ope resolution operator that is finicky.)

--=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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.

--Apple-Mail=_11A88937-00A2-4A26-BB47-FDF820C6AB01
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=UTF-8

<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html charset=
=3Dutf-8"></head><body style=3D"word-wrap: break-word; -webkit-nbsp-mode: s=
pace; -webkit-line-break: after-white-space;" class=3D""><br class=3D""><di=
v><blockquote type=3D"cite" class=3D""><div class=3D"">On 2015=E2=80=9301=
=E2=80=9323, at 12:36 AM, Ville Voutilainen &lt;<a href=3D"mailto:ville.vou=
tilainen@gmail.com" class=3D"">ville.voutilainen@gmail.com</a>&gt; wrote:</=
div><br class=3D"Apple-interchange-newline"><div class=3D""><span style=3D"=
font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: =
normal; font-weight: normal; letter-spacing: normal; line-height: normal; o=
rphans: auto; text-align: start; text-indent: 0px; text-transform: none; wh=
ite-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-wid=
th: 0px; float: none; display: inline !important;" class=3D"">On the other =
hand, perhaps we should allow using member access operators with</span><br =
style=3D"font-family: Helvetica; font-size: 12px; font-style: normal; font-=
variant: normal; font-weight: normal; letter-spacing: normal; line-height: =
normal; orphans: auto; text-align: start; text-indent: 0px; text-transform:=
 none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-s=
troke-width: 0px;" class=3D""><span style=3D"font-family: Helvetica; font-s=
ize: 12px; font-style: normal; font-variant: normal; font-weight: normal; l=
etter-spacing: normal; line-height: normal; orphans: auto; text-align: star=
t; text-indent: 0px; text-transform: none; white-space: normal; widows: aut=
o; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display:=
 inline !important;" class=3D"">reference types. ;)</span></div></blockquot=
e></div><br class=3D""><div class=3D"">Yes, someone propose this, please :)=
 . (To be pedantic, it=E2=80=99s the scope resolution operator that is fini=
cky.)</div></body></html>

<p></p>

-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

--Apple-Mail=_11A88937-00A2-4A26-BB47-FDF820C6AB01--

.


Author: =?UTF-8?Q?R=C3=B3bert_D=C3=A1vid?= <lrdxgm@gmail.com>
Date: Sun, 25 Jan 2015 13:56:07 -0800 (PST)
Raw View
------=_Part_285_313695992.1422222967324
Content-Type: multipart/alternative;
 boundary="----=_Part_286_216184159.1422222967324"

------=_Part_286_216184159.1422222967324
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable



2015. janu=C3=A1r 22., cs=C3=BCt=C3=B6rt=C3=B6k 15:24:59 UTC+1 id=C5=91pont=
ban masse....@gmail.com a=20
k=C3=B6vetkez=C5=91t =C3=ADrta:
>
> Hi,=20
> I think the question is whether we want smart pointer to compare just lik=
e=20
> normal pointer (using their memory adresses) or if we want them to delega=
te=20
> the comparaison to their pointed data (assuming they are comparable).
>
>
Well, delegating feels more reference-ish than pointer-ish. Shouldn't=20
comparison of smart pointers look like comparison of raw pointers than=20
comparison of references?
T *x =3D .., *y =3D ..;
x =3D=3D y;  //compares addresses
I expect this to work the same when I replace x or y (or both) to a smart=
=20
pointer.
Same as
T &x=3D.., &y=3D..;
x =3D=3D y; //calls operator=3D=3D
should work the same if x is a "smart reference" (practically, std::ref)

Best, Robert

--=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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.

------=_Part_286_216184159.1422222967324
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><br>2015. janu=C3=A1r 22., cs=C3=BCt=C3=B6rt=C3=B6k 15=
:24:59 UTC+1 id=C5=91pontban masse....@gmail.com a k=C3=B6vetkez=C5=91t =C3=
=ADrta:<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">Hi, <b=
r>I think the question is whether we want smart pointer to compare just lik=
e normal pointer (using their memory adresses) or if we want them to delega=
te the comparaison to their pointed data (assuming they are comparable).<br=
><br></div></blockquote><div><br>Well, delegating feels more reference-ish =
than pointer-ish. Shouldn't comparison of smart pointers look like comparis=
on of raw pointers than comparison of references?<br>T *x =3D .., *y =3D ..=
;<br>x =3D=3D y;&nbsp; //compares addresses<br>I expect this to work the sa=
me when I replace x or y (or both) to a smart pointer.<br>Same as<br>T &amp=
;x=3D.., &amp;y=3D..;<br>x =3D=3D y; //calls operator=3D=3D<br>should work =
the same if x is a "smart reference" (practically, std::ref)<br><br>Best, R=
obert<br></div></div>

<p></p>

-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_286_216184159.1422222967324--
------=_Part_285_313695992.1422222967324--

.