Boost logo

Boost Users :

From: someuserat (marktutt_at_[hidden])
Date: 2002-09-12 15:31:40


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<Widget*> col;

This statement compiles...

  vector<Widget*>::const_iterator i =
find_if(col.begin(),col.end(),mem_fun(&Widget::IsPrimary));

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));

I'm thinking I've missed something basic, but it's eluding me...


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