有没有办法在运行时声明功能确定为运行时的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::... >>;
}

最佳答案

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

关于c++ - 在运行时初始化boost::accumulator_set,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/36462724/

10-15 06:53