David Abrahams
So this is pretty verbose using lambdas because the sum is repeated, among other things. You might do better to build a custom metafunction that gets you the new state:
template
struct next_state { typedef typename PrevState::first prev_sequence; typedef typename PrevState::second prev_sum; typedef mpl::size_t<(prev_sum::value + Element::nr_)> new_sum; typedef typename mpl::push_back< prev_sequence , mpl::pair >::type new_sequence; typedef mpl::pair type; }; typedef mpl::fold< some_list, mpl::fold<_,_> >::type pair_seq_sum;
typedef pair_seq_sum::first new_sequence;
Heh, this probably would've been easier using zip_view. Oh, well, I'm outta time for this one right now. Again, sorry. -- Dave Abrahams Boost Consulting www.boost-consulting.com