Initialize a boost::accumulator_set at runtime

223 Views Asked by At

Is there a way to declare at runtime a boost::accumulator_set with features determined as runtime? 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::... >>;
}
1

There are 1 best solutions below

0
Eric Niebler On

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.