N3485 20.6.9.1 [allocator.members]/1 says:
Calls to these functions that allocate or deallocate a particular unit of storage shall occur in a single total order, and each such deallocation call shall happen before the next allocation (if any) in this order.
This last requirement confuses me. It looks like the standard is saying that if one allocates a block of memory (let's call it block a
), and then allocates another block (let's call it block b
), then it is not allowed to deallocate block a
until it has deallocated block b
.
If this is indeed what this paragraph entails, I don't see how one could implement something like vector
's growing in a space efficient manner; because one couldn't allocate a bigger buffer and then deallocate the previously allocated (too small) buffer.
Is this actually what this paragraph means, or am I misreading this section?