I have code that looks like
template<typename C>
void invoke() {
  if (thing_known_at_runtime) {
    C::template run<int>(4);
  } else {
    C::template run<char>('a');
  }
}
struct output {
  template<typename T>
  static void run(T x) {
    cout << x;
  }
};
invoke<output>();
And it works.
But I don't like the heavyweight definition of output. I'd like to be able to write:
template<typename T>
void output(T x) {
  cout << x;
}
And then call either invoke<output>() or invoke(output). Is there a way to define invoke so that this works?
(Both output and invoke are more complicated -- this is a simplified version for asking the question with. No, solutions that involve knowing int when I call invoke are not helpful.)