Tag dispatch versus static methods on partially specialised classes
Suppose I want to write a generic function void f<T>() , which does one thing if T is a POD type and another thing if T is non-POD (or any other arbitrary predicate). One way to achieve this would be to use a tag-dispatch pattern like the standard library does with iterator categories: template <bool> struct podness {}; typedef podness<true> pod_tag; typedef podness<false> non_pod_tag; template <typename T> void f2(T, pod_tag) { /* POD */ } template <typename T> void f2(T, non_pod_tag) { /* non-POD */ } template <typename T> void f(T x) { // Dispatch to f2 based on tag. f2(x, podness<std::is