SFINAE, Concepts, and Overload Resolution Management
The idiom we study in this chapter, Substitution Failure Is Not An Error (SFINAE), is one of the more complex in terms of the language features it uses. Thus, it tends to get inordinate amounts of attention from C++ programmers. There is something in this feature that appeals to the mindset of a typical C++ programmer - a normal person thinks that, if it isn’t broken, don’t mess with it. A programmer, especially one writing in C++, tends to think that, if it isn’t broken, you’re not using it to its full potential. Let’s just say that SFINAE has a lot of potential.
We will cover the following topics in this chapter:
- What are function overloading and overload resolution? What are type deduction and substitution?
- What is SFINAE, and why was it necessary in C++?
- How can SFINAE be used to write insanely complex, and sometimes useful, programs?