Unary predicate for shared_ptr == 'real' pointer?
11 Apr
2003
11 Apr
'03
6:53 p.m.
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
7833
Age (days ago)
7833
Last active (days ago)
0 comments
1 participants
participants (1)
-
dick.bridges@tais.com