In my C++ program I need to call a templated function with different data types (int, float, double, char, etc.) and run methods bar1(), bar2().
How to do it without having to explicitly write the call for each type?
foo<int>::bar1()
foo<int>::bar2()
foo<int>::bar3()
...
foo<float>::bar1()
foo<float>::bar2()
foo<float>::bar3()
...
Since they are
voidfunctions in your example, can you rewrite them so that the types can be inferred? Like this:Now the template type can be inferred by the argument passed to the function: