
16 Sep
2004
16 Sep
'04
8:34 p.m.
I'd like to propose adding a template function to shared_ptr to allow the automatic testing of a shared_ptr to its raw ptr. The template is as simple as template <class T> bool operator==(boost::shared_ptr<T> const & a, T * const & b) { return a.get() == b; } Here is the case where I need it. I have a vector<Foo> myFoo. In a method of Foo I need to see if this instance is in the vector. I want to do this vector<Foo>::iterator iter = find( myFoo.begin(), myFoo.end(), this );