Performance & Memory Consideration
Explore how std optional in C++17 increases memory usage due to alignment rules and a boolean flag for managing nullable values. Understand how this affects performance and data structure size to write safer and more efficient code.
We'll cover the following...
We'll cover the following...
std::optional Memory Footprint
When you use std::optional, you’ll pay with an increased memory footprint.
The optional class wraps your type, prepares space for it and then adds one boolean parameter. This means it will extend the size of your ...