Boost logo

Boost Users :

Subject: Re: [Boost-users] shared_ptr to object in stl set container?
From: Jeff Flinn (Jeffrey.Flinn_at_[hidden])
Date: 2011-12-13 08:00:49


Rob Desbois wrote:
> On 13 December 2011 10:06, Nathan Ridge <zeratul976_at_[hidden]
> <mailto:zeratul976_at_[hidden]>> wrote:
>
>
> > Your operators are likely not being called because they are of the
> > incorrect signature.
> >
> > ...
> >
>
> Actually, the reason the operator< is not being invoked is because
> the way it's defined, it compares a Node object to a NodePtr:
>
>
> Doh! I thought I had a feeling there was something more there :-(

IMHO, a better approach may be to supply std::set's sort predicate
rather than overloading global operator<(). There may be places where
you want to compare NodePtr's with normal pointer comparison semantics.

Jeff


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net