boost::shared_ptr confusion...
I've just started working on my first project trying to fully utilize
STL and the boost libraries, and have already run into something that
I can't seem to figure out...
I'm trying to use find_if to check if a member function of an object
contained in an array returns true. It will only return true for a
single object in the collection, so I just need the first instance.
When the vector is declared like this:
vector
From: "someuserat"
However, when I try to use the boost::shared_ptr library like so...
typedef boost::shared_ptr<Widget> WidgetPtr;
vector<WidgetPtr> col;
This statement causes gcc to bark with all manner of errors...
vector<WidgetPtr>::const_iterator i = find_if(col.begin(),col.end(),mem_fun(&Widget::IsPrimary));
Change std::mem_fun (it doesn't recognize smart pointers) to boost::mem_fn.
participants (2)
-
Peter Dimov
-
someuserat