12 Apr
2009
12 Apr
'09
1:31 p.m.
Hi, Is it possible to use Boost.Accumulators on data members of a class, with a UnaryFunction or Lamba function ? E.g. struct Data { double data; }; vector<Data> v; // Insert some Data objects here.... accumulator_set< double, features< tag::variance > > acc; acc = for_each( v.begin(), v.end(), ??????? ); cout << "Variance: " << variance(acc) << std::endl; where ???? is an arbitrary UnaryFunction or Lamda function something like "bind<void>( ref(acc), bind(&Data::data, _1)) )" (which did not do the trick) TIA -- Groeten, Joost Kraaijeveld Askesis B.V. Molukkenstraat 14 6524NB Nijmegen tel: 024-3888063 / 06-51855277 fax: 024-3608416 web: www.askesis.nl