Lets say I have 10 templated functions, for example:
command1<T>(const std::string&)
command10<T>(const std::string&, int timeInSeconds)
At a point in time in my code I will establish that I wish to execute a particular command. I will then request information regarding the type associated with this command (at runtime), which is returned to me via an enum. So I establish that I wish to execute command2 and the enum contains STRING. I therefore wish to call:
command2<std::string>(id, param1, param2);
What would you recommend as a good approach for doing this mapping?
The enum can contain INT, BOOL; DOUBLE or STRING. The arguments passed to a particular command are not dependant on the enum's value.
Example:
Here's an example to explain a little better:
Lets say my program receives "command4 a" from the command line. I parse this input and establish that I need to call command4. I then lookup the type associated with "a" and in this case get INT. I now need to call command4<int>("a");