On Saturday, 21 January 2017 at 05:52:49 UTC, bitwise wrote:
I hadn't noticed this, but I immediately see two problems:
1) there is no alignedDeallocate() which is needed because
aligned allocators usually prepend metadata containing a
pointer to the actual start of the memory to be passed to
free(). So deallocate() can't know if the memory came from
allocate() or alignedAllocate(), and hence does not now how to
properly free the memory.
2) The whole point of using an allocator is that is allocates
memory in a different way, but provides a standard interface.
It shouldn't be up to a container to know whether to call
allocate() or alignedAllocate(). A container should simply call
allocate() of whatever allocator it was given.
yes, agreed. alignedAllocate() seems then to make the interface
complexer without reason.