Skip to Content
Hands-On Design Patterns with C++
book

Hands-On Design Patterns with C++

by Fedor G. Pikus
January 2019
Intermediate to advanced
512 pages
14h 5m
English
Packt Publishing
Content preview from Hands-On Design Patterns with C++

Basic SFINAE

Let's start with a very basic problemwe have some general code that we want to call for all objects, except for built-in types. For integers and other built-in types, we have a specialized version of our code. This problem can be solved by explicitly listing all built-in types in a set of overloaded functions. And let's not forget raw pointers; they are also built-in types. And references. And constant pointers. With care, this approach can be made to work. But perhaps it would be simpler to somehow test whether our type is a class or not. We just need to find something that classes have, and built-in types do not. The obvious distinction is member pointers. Any function declaration that uses the member pointer syntax will fail ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Structural Design Patterns in Modern C++

Structural Design Patterns in Modern C++

Umar Lone

Publisher Resources

ISBN: 9781788832564Supplemental Content