Re: [Boost-users] mpl::accumulate

Hello,
can someone tell me what exactly a parameter State in the mpl::accumulate means.
After the evaluation is finished, which type is returned by accumulate? State? Which types are
passed to the binary ForwardOp?
I do not exactly understand this example:
typedef vector

"Ovanes Markarian"
Hello,
can someone tell me what exactly a parameter State in the mpl::accumulate means.
It's exactly like the second form of std::accumulate http://www.sgi.com/tech/stl/accumulate.html
After the evaluation is finished, which type is returned by accumulate? State?
No. For example, if the elements are (e1, e2, e3), the type returned is
mpl::apply<
binary_op
, mpl::apply<
binary_op
, mpl::apply
Which types are passed to the binary ForwardOp?
See above.
I do not exactly understand this example:
typedef vector
types; typedef accumulate< types , int_<0> , if_< is_float<_2>,next<_1>,_1 > >::type number_of_floats;
The whole expression returns a type-representation of the number of instances of "float" in the sequence "types." State is int_<0>, a type-representation of the number zero. binary_op is lambda expression that returns either its first argument or a type-representation of its first argument plus one. <plug> BTW, http://www.boost-consulting.com/mplbook has a pretty good explanation of this material. </plug> HTH, -- Dave Abrahams Boost Consulting www.boost-consulting.com
participants (2)
-
David Abrahams
-
Ovanes Markarian