Using unique_ptr
as an example, the presenter talks briefly about the empty object problem, ie when classes have non-zero size despite being empty, and then presents two ways to deal with that:
- Empty Base Class Optimization (EBCO): exploits the fact that if a base class is empty, it won’t increase the size of the derived class. The presenter uses this trick through the cool
compressed_pair
to have aunique_ptr
implementation where the deleter doesn’t take an extra byte; [[no_unique_address]]
which is a C++20 feature.
You must log in or register to comment.