[Q] shared_ptr less than operator for std::set
I am trying to use shared_ptr in std::set and std::vector. For std::set I was expecting that when I define a less than comparasing operation in my class (wrapped by shared ptr) -- it would actually get invoked. Instead I think it is the less than of the shared_ptr that is being invoked So I do not get the ordering I expect in my std::set container. Therefore wanted to ask -- how can it be done, that the operator.< of my class and not the shared_ptr's is being used by std::set I searched for posting on this subject but did not come up with the solution. Only discussions about the details of pointer comparasing http://aspn.activestate.com/ASPN/Mail/Message/boost/1863117 VSP -- V S P toreason@fastmail.fm -- http://www.fastmail.fm - Same, same, but different...
I found the solution to my question, it was not in shared_ptr
but instead every associative container had to be modified with a
template
argument functor that does lessthan.
On Tue, 24 Feb 2009 23:58 -0500, "V S P"
I am trying to use shared_ptr in std::set and std::vector. For std::set I was expecting that when I define a less than comparasing operation in my class (wrapped by shared ptr) -- it would actually get invoked.
Instead I think it is the less than of the shared_ptr that is being invoked So I do not get the ordering I expect in my std::set container.
Therefore wanted to ask -- how can it be done, that the operator.< of my class and not the shared_ptr's is being used by std::set
I searched for posting on this subject but did not come up with the solution. Only discussions about the details of pointer comparasing
http://aspn.activestate.com/ASPN/Mail/Message/boost/1863117
VSP
-- V S P toreason@fastmail.fm
-- http://www.fastmail.fm - Same, same, but different...
-- V S P toreason@fastmail.fm -- http://www.fastmail.fm - Faster than the air-speed velocity of an unladen european swallow
participants (1)
-
V S P