S
shaun roe
I have a file which describes data and their type, unfortunately I have
to call a templatized function using the type I read in (these are
primitive types, by the way)
Is there any cleverer way other than doing a 'switch' statement on the
typename and calling the appropriate templatized function?
what I'm doing now is something like:
.... read in "myval" (which is a value) and its type as a strings...
if (inputType=="int"){
insert<int>(myval);
}
if (inputType=="unsigned long"){
insert<unsigned long>(myval);
}
if (inputType=="string"){
insert<string>(myval);
}
etc
cheers
shaun
to call a templatized function using the type I read in (these are
primitive types, by the way)
Is there any cleverer way other than doing a 'switch' statement on the
typename and calling the appropriate templatized function?
what I'm doing now is something like:
.... read in "myval" (which is a value) and its type as a strings...
if (inputType=="int"){
insert<int>(myval);
}
if (inputType=="unsigned long"){
insert<unsigned long>(myval);
}
if (inputType=="string"){
insert<string>(myval);
}
etc
cheers
shaun