简体   繁体   English

在运行时初始化boost :: accumulator_set

[英]Initialize a boost::accumulator_set at runtime

Is there a way to declare at runtime a boost::accumulator_set with features determined as runtime? 有没有一种方法可以在运行时声明具有确定为运行时功能的boost::accumulator_set Something like: 就像是:

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::... >>;
}

There isn't. 没有。 You would need to write a type-erased accumulator set wrapper. 您将需要编写一个类型擦除的累加器集包装器。 That would perform badly at runtime, which is why it isn't supported our off the box. 这将在运行时表现不佳,这就是为什么我们现成的不支持它的原因。

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

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