Boost logo

Boost Users :

Subject: Re: [Boost-users] how to use boost.phoenix with std:for_each?
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2009-04-22 21:15:53


AMDG

Bruce Laing wrote:
> Hi, I would like to do something like this:
>
> struct a_name { std::string name; };
> a_name names[] = { std::string("one"), std::string("two") };
> std::for_each( &names[0], &names[1],
> if_(1)
> [
> std::cout << arg1.name
> ]
> );
>
> but VC8 complains "error C2039: 'name' : is not a member of
> 'boost::phoenix::actor<Eval>'"
>
> Can anyone tell me what I'm doing wrong here?
>
> Thanks for your insights,
>

Try bind(&a_name::name, arg1).
For arg1.name to work, all the possible member names would
have to be enumerated in the definition of arg1 which is not
feasible.

In Christ,
Steven Watanabe


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