Boost Accumulator_SET:期望主表达式
boost accumulator_set: expect primary expression
我是提升库的新手。我想要一个可以计算距离向量(类型std::vector < double >
)的最小,最大,均值和差异的程序,然后我编写了以下代码
std::vector < double > dist_err;
// ... do something with dist_err
boost::accumulators::accumulator_set
<
double,
boost::accumulators::stats
<
boost::accumulators::tag::min ,
boost::accumulators::tag::max ,
boost::accumulators::tag::mean,
boost::accumulators::tag::variance
>
> stat_acc;
std::for_each(dist_err.begin(), dist_err.end(), boost::bind < void > (boost::ref(stat_acc), boost::mpl::placeholders::_1));
std::cout << "min[distance error]: " << boost::accumulators::min (stat_acc) << std::endl;
std::cout << "MAX[distance error]: " << boost::accumulators::max (stat_acc) << std::endl;
std::cout << " E[distance error]: " << boost::accumulators::mean (stat_acc) << std::endl;
std::cout << "VAR[distance error]: " << boost::accumulators::variance (stat_acc) << std::endl;
但是该程序在std::for_each(dist_err.begin(), dist_err.end(), boost::bind < void > (boost::ref(stat_acc), boost::mpl::placeholders::_1));
行中给了我一个错误,它说
error: expected primary-expression before ')' token
std::for_each(dist_err.begin(), dist_err.end(), boost::bind < void > (boost::ref(stat_acc), boost::mpl::placeholders::_1));
有人可以给我一些暗示如何解决此错误?
问题是您在不使用MPL的代码中使用boost::mpl::placeholders::_1
。相反,请说_1
。
相关文章:
- (C++)分析树以计算返回错误值的简单算术表达式
- 在VS2010-VS2015下编译时,如何使用decltype作为较大类型表达式的LHS
- 提升精神:解析布尔表达式并简化为规范范式
- 不能在初始值设定项列表中将非常量表达式从类型 'int' 缩小到'unsigned long long'
- 使用正则表达式regex_search在字符串中查找字符串
- 如何确认我的constexpr表达式实际上已经在编译时执行
- 概念中的cv限定符需要表达式参数列表
- 为什么constexpr的性能比正常表达式差
- Boost Accumulator_SET:期望主表达式
- 我有 3 个错误:期望一个")",期望一个表达式,long 类型的参数与 U32 类型的参数不兼容
- 预处理器定义函数期望表达式
- 错误C2057:期望的常量表达式
- 错误:')'令牌强制转换问题之前期望的主表达式
- 错误:当通过P2P通道连接两个NodeContainers时,期望主表达式在ns3中的const之前
- 试图为继承类的子类编写构造函数,猜测语法,期望的主表达式错误
- if语句中的函数:期望的错误表达式
- c++在派生类构造函数中期望的主表达式
- File.cpp:148:错误:期望的主表达式在`.不同的符号
- 在c++中期望主表达式在token之前
- c++期望的主表达式