Boost logo

Boost Users :

From: dick.bridges_at_[hidden]
Date: 2003-04-11 13:53:33


This is probably more of a C++ than an boost question but, since it
involves shared_ptr, I thought I'd try it here first. I've got a vector of
shared_ptrS (e.g., vector<shared_ptr<T> > v;) and I need to find the entry
given the 'real' pointer to the underlying T. Looping thru the vector like
this:

<snippet>
for( vector<shared_ptr<T>::iterator itr = v.begin(); itr != v.end(); itr++)
{
    if( itr->get() == real_this){...}
}
</snippet>

works but seems klunky. I should be able to use [find_if( v.begin(), v.end
(), ???)] but I can't work out the predicate. Any help or "pointers" ;)
will be greatly appreciated.

TIA


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