10
Implementing Patterns and Idioms
Design patterns are general reusable solutions that can be applied to common problems that appear in software development. Idioms are patterns, algorithms, or ways to structure the code in one or more programming languages. A great number of books has been written on design patterns. This chapter is not intended to reiterate them, but rather to show how to implement several useful patterns and idioms, with a focus on readability, performance, and robustness, in terms of modern C++.
The recipes included in this chapter are as follows:
- Avoiding repetitive
if-else
statements in factory patterns - Implementing the pimpl idiom
- Implementing the named parameter idiom
- Separating interfaces and implementations with ...
Get Modern C++ Programming Cookbook - Third Edition 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.