linked list of templates (or a design flaw?)
This may seem a bit of an odd question, but I'm trying to store a list of templates of different types, I don't know if this is possible or not, but all the efforts I've made so far have failed miserably.
I tried a DIY list but I kept getting compilation errors about being unable to specialize template functions, and the STL list errors because the use of a class template requires an argument list.
The reason I'm doing such a thing is to store variables the user can alter at runtime, for instance there may be an integer, character string and floating point variable and the user can go:
I was storing them in a list by registering them:
For each variable I was storing the name so it would be possible for me to look it up when the user tries to alter it, going something like
proper_variable = FindVariable(argument); // would be a string like "myheight", indicating the name to edit
then just after
Is there any kind of mechanism to support what I'm trying to do, or if there's fundamental flaws in the design I'd appreciate ideas on a better way.
Some more background, if you're interested.
I tried a derived class approach but this is a pain because you have to derive a new class for each type you want, and because the types you are setting / returning may be different you can't have the get/set functions in the base class (unless you return/pass by void * - but thats getting pretty messy).