Substitution failure is not an error: Difference between revisions

Content deleted Content added
Awfidius (talk | contribs)
m Changed identifier names for clarity (an identifier called "type" leads to sentences containing many derivates of the word "type", increasing cognitive burden on the reader).
Awfidius (talk | contribs)
Line 24:
</source>
 
Here, attempting to use a non-class type in a qualified name (<code>T::typefoo</code>) results in a deduction failure for <code>f<int></code> because <code>int</code> has no nested type named <code>typefoo</code>, but the program is well-formed because a valid function remains in the set of candidate functions.
 
Although SFINAE was introduced to avoid creating ill-formed programs when unrelated template declarations were visible (e.g., through the inclusion of a header file), many developers found the behavior useful for compile-time introspection. Specifically, it allows a template to determine certain properties of its template arguments at instantiation time.