RE: [Boost-Users] Unary predicate for shared_ptr == 'real' pointe r?
From: dick.bridges@tais.com [mailto:dick.bridges@tais.com] Sent: Friday, April 11, 2003 11:54 AM
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
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
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.
Here's how I like to do it, though my co-workers sometimes complain:
#include "boost/shared_ptr.hpp"
#include "boost/bind.hpp"
#include <vector>
#include <iostream>
int main()
{
typedef std::vector
participants (1)
-
Tom Matelich