问题
I want to use a boost::accumulator for defining a moving average of my custom class:
boost::accumulators::accumulator_set<MySample, boost::accumulators::stats<boost::accumulators::tag::rolling_mean> >
My problem is that my sample is a user defined class (vector implementation of another library).
I've seen in this post that's possible to define accumulators for std::vectors, but it does not specify which operator must be overloaded because it overloads them with boost/accumulators/numeric/functional/vector.hpp
.
If I want to use accumulator with an user-defined sample class, which operator I must overload and how?
回答1:
The answer is going to differ depending on the stats you use, and sadly none of this is well documented. The best answer I can give is to try to compile it, look at the error message, add the needed operator, rinse, repeat until things work. :-/
来源:https://stackoverflow.com/questions/25639953/boostaccumulator-which-operators-for-sample-type