
1 Jul
2004
1 Jul
'04
4:15 a.m.
I'm trying to use iter_fold with a vector_c to compute the sum of all of the integers in the container. What I have is: template<typename Sequence> struct sum { typedef typename mpl::iter_fold< Sequence, typename mpl::begin<Sequence>::type, mpl::plus< mpl::deref<_1>, mpl::deref<_2> >; // ^ what should this really be? > // what do i put after here? }; Which obviously won't work. I don't know how to keep a running total as I iterate over the sequence with plus. Help! Thanks, -Dan