在boost中,是否可以动态地从boost::accumulators::tag中删除给定的accumulator_set?
typedef boost::accumulators::features <
boost::accumulators::tag::count,
boost::accumulators::tag::max,
boost::accumulators::tag::min,
boost::accumulators::tag::mean,
boost::accumulators::tag::variance,
boost::accumulators::tag::skewness,
boost::accumulators::tag::kurtosis,
> StatisticalFeatures;
accumulator_set<double, boost::accumulators::stats<StatisticalFeatures>> acc;或者,或者将一个新的boost::accumulators::stats容器分配给accumulator_set,在这里我可以从字符串中指定一些boost::accumulators::tag。例如,如果字符串是min,max,mean,那么我想要创建一个新的accumulator_set<double,bost::accumulators::stats<boost::accumulators::tag::min,boost::accumulators::tag::max,boost::accumulators::tag::mean>> acc。
提前谢谢你的建议。
发布于 2015-01-08 22:09:32
简短回答:不。
更长的答案:通过类型擦除和大量的模板元编程,一切都是可能的。
如果你觉得你真的需要这样做,那么就开始使用.Boost函数或Boost Erasure,或者发布一个更详细的问题,以及你被困的地方。有太多的方法可以解释“向accumulator_set分配一个新的boost::累加器::stats容器,其中我可以指定一些boost::累加器::string中的标记”。
如果组合是有限的,Boost变体是你的朋友。否则,促进任何和..。许多特殊情况下提取的结果。不过,这将是一个/很多/元编程。
在现实中,如果你负担得起,为什么不使用“最大功能”累加器集,并只披露一次根据文本的配置?在运行时,您所做的工作比所需的要多,但是在开发方面可以节省大量的精力。
https://stackoverflow.com/questions/27850058
复制相似问题