3 ms·
The article assumes that storing an allocator together with a container inevitably bloats the container by 1-2 CPU words. This is not necessary so. One can requ
by _0w8t 4y ago
The article assumes that storing an allocator together with a container inevitably bloats the container by 1-2 CPU words. This is not necessary so. One can require that it should be possible to get the allocator from a pointer it allocates. With many allocator designs this will costs like one CPU word per CPU page which is trivial.
This still requires to parametrize the container on the type of the allocator, but there will be no penalty on the size of the containers and the API will be safe.