Boost logo

Boost Users :

From: Steven S. Klug (stevenklug_at_[hidden])
Date: 2007-03-03 18:27:30


Is there any way using BLL's bind to bind to shared_ptrs in a container?

e.g.:

class MyClass
{
public:
    std::string MyFunc()
    {
        return str;
    }

private:
    string str;
};

vector<shared_ptr<MyClass> > v;

find_if( v.begin(), v.end(), boost::lambda::bind( &MyClass::MyFunc, _1 ) ==
string( "steve" ) );

In visual studio with the scenario I get errors indicating it can't find
MyFunc in the interface for shared_ptr, which you'd expect, except for the
fact that boost::bind works with shared poiners. Is it the case that
boost::lambda::bind doesn't? If so, that's unfortunate as it rules out
using lambda with containers of shared_ptrs in a lot of cases. What am I
missing?

sklug


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