Boost logo

Boost Users :

From: Joel de Guzman (joel_at_[hidden])
Date: 2006-08-22 13:24:43


Christian Henning wrote:
> Hi Joel,
>
>> Oops, that should be
>>
>> typedef mpl::vector_c<int, 4> consts_type;
>> typedef fusion::vector<int, float, int, double> vars_type;
>>
>> vars_type vars;
>> fusion::joint_view<consts_type, vars_type> s3(consts_type(), vars);
>>
>> Anyway, I'm sure you got the point. With our 's3' above, we can,
>> for exemple, write (using boost::lambda):
>>
>> fusion::for_each(s3, cout << _1 << endl);
>>
>> to print all the items.
>>
>
> I just tried your suggestion and it works until the fusion::for_each()
> call. There, I get a million compiler errors. I'm sure I'm must
> missing something simple here.
>
> This is what I'm doing:

[snip code]

My mistake. The code should be:

    typedef mpl::vector_c<int, 4> consts_type;
    typedef fusion::vector<int, float, int, double> vars_type;

    consts_type consts;
    vars_type vars;
    fusion::joint_view<consts_type, vars_type> view(consts, vars);

    fusion::for_each( view, cout << _1 << "\n" );

(Sometimes I can't figure out various aspects of lambda. Here,
it can't grok std::endl. Anyway, that's an unrelated issue. You
can simply throw in your function/function-object there.)

> When I got the CVS head there was no fusion documentation included. Is
> that correct?

It's there now.

Regards,

-- 
Joel de Guzman
http://www.boost-consulting.com
http://spirit.sf.net

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