Is there a generic way to adapt a function template to be a polymorphic function object?
I have some function templates, for example template <typename T> void foo(T); template <typename T> void bar(T); // others and I need to pass each one to an algorithm that will call it with various types, e.g. template <typename F> void some_algorithm(F f) { // call f with argument of type int // call f with argument of type SomeClass // etc. } I can't pass in my function template uninstantiated, but I can't instantiate it with any specific type either because some_algorithm will need to call it with arguments of several different types. I could adapt my function templates to be polymorphic