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++

Advanced SFINAE revisited

The problem we considered in the previous section, calling a sort() member function if one exists, naturally led us to ask the question Does a sort() member function exist? We came up with two ways to ask this question—first, we can ask Does the class have a member function named sort, and what is the type of a pointer to it? This question fails when the answer is yes, it has two, and the type of the pointer depends on which one you mean. The second way to ask was Does the class have a void sort() member function? This question fails when the answer is No, but it has one that you can call anyway. Perhaps the question we should have asked all along was, If I write x.sort(), will it compile?

To avoid falling into this ...

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