Skip to main content

Substitution failure is not an error (SFINAE) refers to a situation in C++ where an invalid substitution of template parameters is not in itself an error. This exploit can be used as a means to implement several template metaprogramming techniques.

Substitution Failure Is Not An Error - SFINAE.

This rule applies during overload resolution of function templates: When substituting the deduced type for the template parameter fails, the specialization is discarded from the overload set instead of causing a compile error. This feature can be used as a means to implement several template metaprogramming techniques, such as the std::enable_if standard template.

Visit the Wikipedia page and the SFINAE entry on cppreference.com for more details.