Is there a better way to do the following?
#include template T Bar(); template <> int Bar() { return 3; }
This could work:
template T Bar() { T::ERROR_invalid_template_argument_; } template <> int Bar() { return 3; }
You could also use the highest size possible if you're afraid of using 0:
static_assert(sizeof(T) == -1, "No specialization");