I would like to do something to the following effect:
template <class A>
A doThings(A input) { /* do something */ }
void doTwoThings(ClassB inputB, ClassC inputC, template <class A> A(A) func) // This syntax is wrong but how to achieve this effect?
{
std::cout << func<ClassB>(inputB);
std::cout << func<ClassC>(inputC);
}
doTwoThings(5, "testStr", doThings);
Basically, I am trying to pass a function template as an argument to a normal function, and within that function, specialise the function template into two or more overloads and use them. Is there a way to do that in C++?