Design Patterns in Modern C++20: Reusable Approaches for Object-Oriented Software Design
by Dmitri Nesteruk
Part ICreational
Even in the absence of Creational patterns, the act of creating an object in C++ is fraught with peril. Should we create it on the stack or on the heap? Should we use a raw pointer, a unique or shared pointer, or something else entirely? Finally, is creating objects manually still kosher, or should we instead defer the creation of all key aspects of our infrastructure to specialized constructs such as Factories (more on them in just a moment!) or Inversion of Control containers?
Whichever option you choose, creation of objects can still be a chore, especially if the construction process is complicated or needs to abide by special rules. So that’s where Creational patterns come from: they are common approaches related to ...
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.
Read now
Unlock full access