The 500 hats of the standard allocator

The standard allocator model must have seemed amazing in 2011. We're about to see how, with just one C++ type, we can accomplish all of the following feats:

  • Specify a memory resource to be used for allocating memory.
  • Annotate each allocated pointer with some metadata that will be carried along for its whole lifetime, all the way to deallocation time.
  • Associate a container object with a particular memory resource, and make sure that association is "sticky"--this container object will always use the given heap for its allocations.
  • Associate a container value with a particular memory resource, meaning that the container can be efficiently moved around using value semantics without forgetting how to deallocate ...

Get Mastering the C++17 STL now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.