|
Boost Users : |
Subject: Re: [Boost-users] [phoenix] accumulate with data member binding
From: Christian Henning (chhenning_at_[hidden])
Date: 2008-11-03 11:17:03
Joel,
> See spirit/phoenix/test/algorithm for some examples. For example:
>
> void accumulate_test()
> {
> using namespace boost::phoenix;
> using namespace boost::phoenix::arg_names;
> int array[] = {1,2,3};
> BOOST_TEST(accumulate(arg1, 0)(array) == 6);
> BOOST_TEST(boost::phoenix::accumulate(
> arg1, 0, std::minus<int>())(array) == -6);
> return;
> }
>
I know about that example. I was interested in how I can use that
phoenix::accumulate when iterating over my _prob? In essence how can I
rewrite the following code to use phoenix's version of accumulate?
std::vector< point > d;
double sum_prob = std::accumulate( d.begin()
, d.end()
, 0.0
, bind( &point::_prob, arg2 )
);
Thanks,
Christian
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