This is the code repository for Hands-On Design Patterns with C++, published by Packt.
Solve common C++ problems with modern design patterns and build robust applications
C++ is a general-purpose programming language built with a bias towards embedded programming and systems programming. Design patterns are, in essence, a library of reusable components, only for software architecture, not for a concrete implementation.
This book covers the following exciting features:
- Recognize some of the most common design patterns used in C++, and what additional information is expressed by their use in context.
- Understand how to use C++ generic programming to solve some of the most common design problems.
- Explore the most powerful C++ idioms, their strengths, and drawbacks.
- Rediscover some of the most popular C++ idioms, such as Resource Acquisition Is Initialization, and learn the new ways they can be used together with generic programming.
- Understand the impact of different design and implementation choices on the program performance, and how to write well-designed and readable programs without sacrificing performance.
If you feel this book is for you, get your copy today!
All of the code is organized into folders. For example, Chapter02.
The code will look like the following:
template <typename T>
T increment(T x) { return x + 1; }
Following is what you need for this book: This book is for experienced C++ developers and programmers who wish to learn about software design patterns and principles and apply them to create robust, reusable, and easily maintainable apps.
With the following software and hardware list you can run all code files present in the book (Chapter 1-18).
Chapter | Software required | OS required |
---|---|---|
5,6,8-11,15 | Google Benchmark | Windows, Mac OS X, and Linux |
5 | Google Test | Windows, Mac OS X, and Linux |
3,4 | Guidelines Support Library (GSL) | Windows, Mac OS X, and Linux |
11 | Folly | Windows, Mac OS X, and Linux |
Fedor G Pikus is a chief engineering scientist in the Design-to-Silicon division of Mentor Graphics (a Siemens business), and is responsible for the long-term technical direction of Calibre products, the design and architecture of software, and research into new software technologies. His earlier positions include senior software engineer at Google and chief software architect at Mentor Graphics. Fedor is a recognized expert on high-performance computing and C++. He has presented his works at CPPCon, SD West, DesignCon, and in software development journals, and is also an O'Reilly author. Fedor has over 25 patents, and over 100 papers and conference presentations on physics, EDA, software design, and C++.
Click here if you have any feedback or suggestions.
- Install Google Benchmark according to the documentation. See Google Benchmark installation.
- Here the short version:
$ git clone https://github.com/google/benchmark.git $ git clone https://github.com/google/googletest.git benchmark/googletest $ cd benchmark && mkdir build && cd build $ cmake -DCMAKE_BUILD_TYPE=Release .. $ cmake --build . $ cmake --build . --target test $ sudo cmake --build . --target install
- Install Google Test.
- It is a standard CMake build with installation:
$ git clone https://github.com/google/googletest.git $ cd googletest && mkdir build && cd build $ cmake .. $ cmake --build . $ sudo cmake --build . --target install
- Install
cpupower
to inhibit cpu frequency scaling. See CPU Frequency Scaling using Google Benchmark.$ sudo apt install linux-tools-common linux-tools-generic $ sudo cpupower frequency-set --governor performance $ ./mybench $ sudo cpupower frequency-set --governor powersave