|
Boost : |
From: Jody Hagins (jody-boost-011304_at_[hidden])
Date: 2006-07-10 17:31:28
On Mon, 10 Jul 2006 23:52:45 +0300
"Peter Dimov" <pdimov_at_[hidden]> wrote:
> Daryle Walker wrote:
>
> > Looking at <http://www.boost.org/libs/smart_ptr/shared_ptr.htm>,
> > i.e. the Boost version, it seems that the authors fell into the
> > "fake operator <" trap. If any of those authors are reading this,
> > can you tell us why you added the fake operator instead of a
> > custom-named comparison class?
>
> shared_ptr defines operator< for map<shared_ptr<>, V> to work. What do
> you mean by "fake"?
I think that's what he means by "fake." You defined an operator<() so
that it could be used with an STL container using the "default"
comparator, while providing a
shared-ptr-less-than-by-comparing-the-pointer comparator would be more
appropriate.
Of course, it would require passing the comparator instaed of using the
default std::less, but it does not introduce an operator<() that may not
be appropriate for some cases of shared_ptr<>.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk