
Discover more from Daily bit(e) of C++
Random C++ knowledge organized in arbitrary order.
Over 1,000 subscribers
Already have an account? Sign in
Daily bit(e) of C++ | std::allocator and custom allocators
Daily bit(e) of C++ #290, The allocator mechanism in STL: std::allocator and custom allocators.
Allocators are one of the more esoteric parts of C++.
All containers rely on allocators, defaulting to std::allocator.
If we want to use a different allocator, we can specify it as the last template argument.
Because template arguments are part of the type, the allocator cannot be easily switched when exposing types through API boundaries.