Substitution failure is not an error: Difference between revisions

Content deleted Content added
Add a link and less cryptic summary
added connection words to improve readability
Line 25:
Here, attempting to use a non-class type in a qualified name (<code>T::foo</code>) results in a deduction failure for <code>f<int></code> because <code>int</code> has no nested type named <code>foo</code>, 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. Specifically, it allows a template to determine certain properties of its template arguments at instantiation time.
 
For example, SFINAE can be used to determine if a type contains a certain typedef: