I think I am missing something obvious. Maybe someone can set me on the right track.
For some reason (not to be discussed here) I cannot use the normal operator new
for a certain map, so I want to replace the memory allocation for this particular
map. I have the impression that the template parameter Allocator is there for this
purpose.
A map is declared as
template <class Key, class T, class Compare = less<Key>
class Allocator = allocator<T> >
class map;
I don't understand the allocator<T> part of it.
I think that a map needs to allocate more that only objects of class T.
I assume that elements of a map not only contain an object of
class T, but also an object of class K and probably also some
pointers to other elements.
So, in my understanding not only objects of class T need an allocator,
but there needs to be an allocator for a complete element of a map.
Or is a map designed in such a way that only the allocation of class T
objects can be replaced, but that the allocation of other parts of the
elements are always performed using the standard operator new?
In this case replacing the allocator would not be the solution for my problem.
F.Z.