During my daily work, the senior member of the team always advises me that the list is not cached, so I have to vector . I understand that list not continuous, so the memory allocation is scattered throughout the memory.
However, very often I need the functionality of list (or map ). Therefore, I am wondering if I can write my own distributor, which is vector under it. Every time I push_back , my own dispenser allocates a new element from the selected vector .
When I move list / map , cache location is saved.
Does that make sense for any of you?
c ++ allocator
user152503
source share