boost::accumulator: which operators for sample_type?

时光毁灭记忆、已成空白 提交于 2019-12-08 12:15:38

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!