+ 10
Can I somehow input the type for a template class or function?
I have a generic Matrix Class which is finally working for all data types, except char. Is there a way I can input the data type in the console so as to customize the output everytime? Will using if else with strings or switch with cases be the only way? Is there NO way we can input data types? Pls help me...
2 Respostas
0
I guess it's not possible, as C++ templates are type-safe, meaning that they're checked and expanded at compile time. That is, they must have specific types when compiling, thus making it not possible to depend on user's input.
+ 10
Thanks!