Hi!

I am wondering if some boost library (like fusion) or similar may help me solve an awkward problem. In principle I have a class which has an int template parameter, for example:

template <int VAL>
class A {
void print_val() {
   std::cout << "my value is " << VAL << std::endl;
}
};

Now I want to make the parameter VAL of class A available at runtime (of course only a limited range, but still), like this

class Aruntime {

void set_val(int v) { val = v; }
int val;

... and again same stuff from A<val> ...

};

I am sure there is an easy solution to it. One solution would be to use an object factory, I guess. There I would register for each integer the respective class A which I had to wrap into some other class in order to get rid of the template parameter and virtualize the print_val function. This may not be a boost-problem directly, but any help would be great.

Thanks a lot,

Sebastian