Boost logo

Boost Users :

From: Haroon Khan (haroon.khan_at_[hidden])
Date: 2006-12-11 12:39:49


On 12/10/06, Santosh Joseph <santoshjoseph73_at_[hidden]> wrote:
> boost::function<string&(test_str&)> f =
> bind(&test_str::str, Arg);
> //for_each( v2.begin(), v2.end(), bind(
> insert_func, var(str_con), var(f)));

I think this is because
f is a is a boost::function object. You'e trying to pass a functor
object to a function that takes a std::string& argument, and that's
what the error is saying that it can't coerce f to a std::string type.

Instead of using a boost::function<...> object try passing it directly
to the expression, like as follows.

for_each( v2.begin(), v2.end(), bind(
insert_func, var(str_con), bind(&test_str::str, Arg)));

the boost::lambda::bind function returns a lambda functor.

HTH


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