Back to std::enable_if:

std::enable_if works through the principle of substitution failure is not an error (SFINAE)

For SFINAE to kick in

  1. it has to be used on a (member) function template and
  2. it has to be dependent on a template parameter.

Consider the function:

std::enable_if<false, int>::type  
f() {  
    return 2;

Since std::enable_if<false, void> has no member type of name type, the compiler will never compile that. Hence, we have to be sure that f() will never get compiled. We do that by adhering to the two above conditions, i.e., by transforming the function f() into a template function.

In other words, we could say that template functions are a way to achieve lazy function instantiation.