...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
boost::accumulators::accumulator_set — A set of accumulators.
// In header: <boost/accumulators/accumulators_fwd.hpp> template<typename Sample, typename Features, typename Weight = void> struct accumulator_set { // construct/copy/destruct template<typename A1> explicit accumulator_set(A1 const &); // public member functions template<typename UnaryFunction> void visit(UnaryFunction const &); template<typename FilterPred, typename UnaryFunction> void visit_if(UnaryFunction const &); void operator()(); template<typename A1> void operator()(A1 const &); template<typename Feature> apply< Feature >::type & extract(); template<typename Feature> apply< Feature >::type const & extract() const; template<typename Feature> void drop(); };
accumulator_set resolves the dependencies between features and ensures that the accumulators in the set are updated in the proper order.
acccumulator_set provides a general mechanism to visit the accumulators in the set in order, with or without a filter. You can also fetch a reference to an accumulator that corresponds to a feature.
accumulator_set
public member functionstemplate<typename UnaryFunction> void visit(UnaryFunction const & func);
Visitation
Parameters: |
|
template<typename FilterPred, typename UnaryFunction> void visit_if(UnaryFunction const & func);
Conditional visitation
Parameters: |
|
void operator()();
Accumulation
template<typename A1> void operator()(A1 const & a1);
template<typename Feature> apply< Feature >::type & extract();Extraction.
template<typename Feature> apply< Feature >::type const & extract() const;
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<typename Feature> void drop();Drop.