在运行时初始化 boost::accumulator_set

Initialize a boost::accumulator_set at runtime

本文关键字:accumulator set boost 运行时 初始化      更新时间:2023-10-16

有没有办法在运行时声明一个boost::accumulator_set,其功能被确定为运行时?像这样:

accumulator_set *acc;
if (SomeUserInput1)
{
  acc = new accumulator_set< double, features< tag::min >>;
}
if (SomeUserInput2)
{
  acc = new accumulator_set< double, features< tag::min, tag::max, tag::mean, tag::... >>;
}
没有

。您需要编写一个类型擦除的累加器集包装器。这会在运行时表现不佳,这就是为什么我们不支持开箱即用的原因。