Unifying the types.
Thanks for the memory (allocator)
by Glennan Carnie
From the article:
One of the design goals of Modern C++ is to find new – better, more effective – ways of doing things we could already do in C++. Some might argue this is one of the more frustrating aspects of Modern C++ – if it works, don’t fix it (alternatively: why use lightbulbs when we have perfectly good candles?!)
This time we’ll look at a new aspect of Modern C++: the Allocator model for dynamic containers. This is currently experimental, but has been accepted into C++20.
The Allocator model allows programmers to provide their own memory management strategy in place of their default library implementation. Although it is not specified by the C++ standard, many implementations use malloc/free.
Understanding this feature is important if you work on a high-integrity, or safety-critical, project where your project standards say ‘no’ to malloc...
Add a Comment
Comments are closed.