EDIT: I was wrong, you can use mpl::plus
directly, using the placeholder expressions. This simplifies the whole notation:
typedef mpl::accumulate<ints, mpl::int_<0>, mpl::plus<mpl::_1, mpl::_2> >::type sum;
Of course it is also possible to obtain the same effect using a metafunction class (which for adding is an overkill, but for something more complex might be reasonable):
struct plus_mpl
{
template <class T1, class T2>
struct apply
{
typedef typename mpl::plus<T1,T2>::type type;
};
};
typedef mpl::accumulate<ints, mpl::int_<0>, plus_mpl >::type sum;