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 ...