Answer
SFINAE means substitution failure is not an error in specified template substitution contexts. • When substitution creates an invalid type or expression in the immediate context, that candidate is removed. • Another viable overload or specialization may then be selected. • Modern C++ often expresses such constraints more clearly with concepts and requires clauses.
💡 C++ Example
template<class T>
auto size_of(const T& value) -> decltype(value.size()) {
return value.size();
}
⚡ Quick Revision
SFINAE removes invalid template candidates instead of rejecting the whole program.