简体   繁体   English

boost :: accumulator:sample_type的哪些运算符?

[英]boost::accumulator: which operators for sample_type?

I want to use a boost::accumulator for defining a moving average of my custom class: 我想使用boost :: accumulator来定义我的自定义类的移动平均值:

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 . 在这篇文章中看到可以为std :: vectors定义累加器,但是它没有指定必须重载哪个运算符,因为它会通过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? 如果要对用户定义的样本类使用累加器,必须重载哪个运算符,以及如何重载?

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. 我能给出的最佳答案是尝试对其进行编译,查看错误消息,添加所需的运算符,冲洗,然后重复直到一切正常为止。 :-/ :-/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM