Boost logo

Boost Users :

From: Allen Bierbaum (allenb_at_[hidden])
Date: 2003-11-20 17:57:54

Hello all.

I am having trouble with the boost lambda library. I am convinced that
my troubles come from some little thing I am overlooking, but for the
life of me I can't seem to find the problem. I have been looking at it
for the entire afternoon with no solution in sight.

I have included some sample code below showing the basic idea of what I
am trying to accomplish. Can anyone provide me with a working solution?

The summary is:
- I have a vector of shared_ptr's to a class A
- That class has a method that returns a value I would like to test for
in a find_if call


namespace bl = boost::lambda

class A
    int getInt();

class Foo
    A bar();

std::vector<shared_ptr<Foo> > foos;
shared_ptr<Foo> foo_ptr;
A test_val;

test_val = (bl::_1 ->* &Foo::bar )(foo_ptr);

int find_int = 10;
iter found = find_if(foos.begin(), foos.end(),
                      (bl::_1->* &Foo::bar).getInt() == child_guid);


Can anyone tell me how I can call a method from a lamda method iterating
over a sequence of shared_ptrs? And then how do I have this method
also call another method?


Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at