Technical requirements
Here is the example code: https://github.com/PacktPublishing/Hands-On-Design-Patterns-with-CPP-Second-Edition/tree/master/Chapter11.
You will also need the Google Benchmark library installed and configured: https://github.com/google/benchmark (see Chapter 4, Swap – From Simple to Subtle, for installation instructions).
This chapter is rather heavy on advanced C++ features, so keep a C++ reference nearby (https://en.cppreference.com unless you want to dig through the standard itself).
Finally, a very thorough and complete implementation of ScopeGuard can be found in the Folly library: https://github.com/facebook/folly/blob/master/folly/ScopeGuard.h; it includes C++ library programming details beyond those covered in this book.