Substitution failure is not an error

David Vandevoorde first introduced the acronym SFINAE to describe related programming techniques.

[2] If one or more candidates remain and overload resolution succeeds, the invocation is well-formed.

The following example illustrates a basic instance of SFINAE: Here, attempting to use a non-class type in a qualified name (T::foo) results in a deduction failure for f because int has no nested type named foo, but the program is well-formed because a valid function remains in the set of candidate functions.

Although SFINAE was initially introduced to avoid creating ill-formed programs when unrelated template declarations were visible (e.g., through the inclusion of a header file), many developers later found the behavior useful for compile-time introspection.

An ellipsis is used not only because it will accept any argument, but also because its conversion rank is lowest, so a call to the first function will be preferred if it is possible; this removes ambiguity.