Daily bit(e) of C++ | Implementing custom allocators
Daily bit(e) of C++ #292, Implementing a custom allocator to completely avoid heap allocation.
Allocators allow us to control the memory allocation patterns of standard containers.
Preferably, one should use well-established allocators. However, implementing a custom allocator from scratch is not complicated.
Keep in mind that stateful allocators increase the size of each object that uses this allocator. The Monostate pattern can potentially prevent this overhead.