Is it possible to parameterize non-type template arguments? I'm trying to generate a thunk that forwards its arguments to one of two compile time constant functions based on some runtime check, to get something hopefully along the lines of this:
#include <stdlib.h> int a(int, int, char) { return 0; } int b(int, int, char) { return 0; } // This doesn't work template<typename ReturnType, typename... Params> template<ReturnType (*first)(Params...), ReturnType (*second)(Params...)> ReturnType coin_flip(Params... params) { if (rand() % 2) { return first(params...); } else { return second(params...); } } int main() { return coin_flip<a, b>(1, 2, '3'); }