accumulator_set< double, features< tag::variance > > acc; acc = for_each( v.begin(), v.end(), ??????? );
using namespace std; using namespace boost; struct data{ data(double value):value_(value){} double value_; }; int main() { typedef std::vector<data> vec_t; vec_t vec; vec.push_back(data(2.0)); vec.push_back(data(1.0)); typedef accumulators::accumulator_set< double, accumulators::features< accumulators::tag::moment<2> > > acc_t; acc_t acc; for_each( begin(vec), end(vec), bind<void>( ref(acc), bind<double>( &data::value_, _1 ) ) ); double result = accumulators::moment<2>(acc); // = 4 + 1 /2 = 2.5 NB: acc = has been ommitted.