I need to create a template function like this:
template void foo(T a) { if (T is a subclass of class Bar) do this else d
I like this clear style:
void foo_detail(T a, const std::true_type&) { //do sub-class thing } void foo_detail(T a, const std::false_type&) { //do else } void foo(T a) { foo_detail(a, std::is_base_of::value); }