Substitution Failure Is Not An Error

Substitution Failure Is Not An Error (often referred to by the acronym SFINAE) is a compilation principle in object oriented programming, applied to C++ template programming in particular. In attempting to use function template argument deduction to select among a number of candidate function templates, a C++ compiler may attempt an instantiation that fails on one or more of them. For example, consider the following C++ program:
    template  void f( T );    template  void f( T * );    //    f( 1024 ); // instantiates first f 
Even though substitution of the integer for T * in the second f function template would have been incorrect, the attempted substitution does not give rise to an error provided that a correct substitution is found. In this case, the first f is instantiated, and there is no error. Thus, we have the substitution failure is not an error concept, dubbed SFINAE by Vandevoorde and Josuttis.1 SFINAE is an important property in that, without it, it would be difficult to overload function templates; the combination of argument deduction and overloading would render many uses of a set of overloaded function templates illegal. But SFINAE is also valuable as a metaprogramming technique.

 

<< PreviousWord BrowserNext >>
predrag mijatovic
melissa fahn
mystic poets
richard darman
ursula cowgill
gubi sandhu
caisson nemo
kiko loureiro
border states (disambiguation)
rephotography
studebaker starlight
declaration of the rights of woman and the female citizen
methanoids
nicolae rosu
erik williams
lynne marta
john l. williams
tizi ouzou
camera dolly
international league for the protection of horses
ez aquarii
linguistic society of america
user experience
lugalo
carl august of saxe weimar eisenach
jerry gray
superconvergence
clifton college register
mg ff cannon
khayyam
andrea lau
edward pease
user expectations
c4i
north hinksey
badminton horse trials
society for the study of the indigenous languages of the americas
1713 in music
the election of uthman
john vernon
cheering
lenox square
christian opposition to anti semitism
beef fork