Topic: Add comparison operators between smart pointers and
Author: MasterT <tom.deseyn@gmail.com>
Date: Mon, 23 Sep 2013 12:46:53 -0700 (PDT)
Raw View
------=_Part_3793_28396238.1379965613810
Content-Type: text/plain; charset=ISO-8859-1
Hi all,
There are some questions on stack overflow related using a raw pointer for
lookup in a unique_ptr container:
*
http://stackoverflow.com/questions/17851088/using-a-stdunordered-set-of-stdunique-ptr
*
http://stackoverflow.com/questions/18055183/no-standard-way-to-compare-smart-pointer-with-regular-pointer
*
http://stackoverflow.com/questions/18939882/raw-pointer-lookup-for-sets-of-unique-ptrs
The second question is by me, and the third question triggered me writing
down this post to know your thoughts on the following:
Wouldn't it make sense to have comparison operators (==, !=, <, ...)
between smart pointers and raw pointers?
Currently the operators require the type to match, and this drags in
"ownership" into the equation.
If the pointers are equal, they should have the same idea about ownership
anyhow.
When comparing to the raw pointer, you indicate you do not want to take the
ownership into account.
As smart pointers are ordered/hashed based on raw pointer values, a
heterogeneous lookup can work.
Thanks for your inputs,
Wkr,
Tom
--
---
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_3793_28396238.1379965613810
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">Hi all,<div><br></div><div>There are some questions on sta=
ck overflow related using a raw pointer for lookup in a unique_ptr containe=
r:</div><div><div>* http://stackoverflow.com/questions/17851088/using-a-std=
unordered-set-of-stdunique-ptr</div><div>* http://stackoverflow.com/questio=
ns/18055183/no-standard-way-to-compare-smart-pointer-with-regular-pointer</=
div></div><div>* <a href=3D"http://stackoverflow.com/questions/1893988=
2/raw-pointer-lookup-for-sets-of-unique-ptrs">http://stackoverflow.com/ques=
tions/18939882/raw-pointer-lookup-for-sets-of-unique-ptrs</a></div><div><br=
></div><div>The second question is by me, and the third question triggered =
me writing down this post to know your thoughts on the following:</div><div=
><br></div><div>Wouldn't it make sense to have comparison operators (=3D=3D=
, !=3D, <, ...) between smart pointers and raw pointers?</div><div>Curre=
ntly the operators require the type to match, and this drags in "ownership"=
into the equation.</div><div>If the pointers are equal, they should have t=
he same idea about ownership anyhow.</div><div>When comparing to the raw po=
inter, you indicate you do not want to take the ownership into account.<br>=
</div><div><br></div><div>As smart pointers are ordered/hashed based on raw=
pointer values, a heterogeneous lookup can work.</div><div><br></div><div>=
Thanks for your inputs,</div><div>Wkr,</div><div><br></div><div>Tom</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" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<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_3793_28396238.1379965613810--
.