|
Boost : |
Subject: Re: [boost] [shared_ptr] Why operator< uses internal_less?
From: Frank Mori Hess (frank.hess_at_[hidden])
Date: 2008-10-09 11:50:11
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Thursday 09 October 2008 11:32 am, Sebastian Redl wrote:
> dariomt_at_[hidden] wrote:
> > I see that operator== and operator!= are implemented comparing the
> > pointer inside the shared_ptr's using get(), but operator< uses
> > _internal_less, that does a different thing.
> >
> > I thought that operator< would also be implemented using get(), so
> > please, can you share the rationale behind the need for _internal_less?
>
> get() returns px (the raw pointer), _internal_less compares pn (the
> shared_count).
>
> This is peculiar, since it means that alias pointers to different
> subobjects would compare non-equal, but sort equivalent. I'd like to
> know the rationale of this, too.
There is a rationale in n1590.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
iD8DBQFI7ig05vihyNWuA4URAnEWAJ9e9flIoOH1blxeeYJxMD2DlaC3VQCeJjM6
AGjr+bUlqqbhvV8lLAbSn1k=
=9C0j
-----END PGP SIGNATURE-----
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk