2. Techniques

This chapter presents a host of C++ techniques that are used throughout the book. Because they are of help in various contexts, the techniques presented tend to be general and reusable, so you might find applications for them in other contexts. Some of the techniques, such as partial template specialization, are language features. Others, such as compile-time assertions, come with some support code.

In this chapter you will get acquainted with the following techniques and tools:

• Compile-time assertions

• Partial template specialization

• Local classes

• Mappings between types and values (the Int2Type and Type2Type class templates)

• The Select class template, a tool that chooses a type at compile time based on a Boolean condition ...

Get Modern C++ Design: Generic Programming and Design Patterns Applied now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.