1

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
  • Did you figure it out? Commented Aug 19, 2021 at 7:44

1 Answer 1

0

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. :-/

1
  • Yes I'd like also to do this way, but when there are compilation errors with templates compiler messages can be very hard to read (for me) and I can't figure out easily what the problem can be. I'll try anyway.
    – Jepessen
    Commented Sep 4, 2014 at 7:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.