Robustness and Performance
C++ is often the first choice when it comes to selecting an object-oriented programming language with performance and flexibility as key goals. Modern C++ provides language and library features, such as rvalue references, move semantics, and smart pointers.
When combined with good practices for exception handling, constant correctness, type-safe conversions, resource allocation, and releasing, C++ enables developers to write better, more robust, and performant code. This chapter's recipes address all of these essential topics.
This chapter includes the following recipes:
- Using exceptions for error handling
- Using
noexcept
for functions that do not throw exceptions - Ensuring constant correctness for a program
- Creating compile-time constant expressions
- Creating immediate functions
- Performing correct type casts
- Using
unique_ptr
to uniquely own a memory resource - Using
shared_ptr
to share...