I would like to find a way to store several std::vectors , each of which is different, but well-known and quite small in adjacent memory. I understand that I can write my own class, say, with a very large array and with pointers to the beginning of each subsection of the array in a larger array, treated as a separate object, but there seems to be a smarter way to do this.
Is there a way to use allocators , for example, to create contiguous std::vectors ? I would not want to reinvent the wheel just because I want this memory locality to be otherwise normal std::vectors
I do not know how to start coding. I need to create a allocator that takes a pointer to memory, allocates a vector there and then somehow returns the address of the end of this vector, so the next std::vector allocator could grab this and do it again. How to return allocator value?
c ++ arrays vector allocator
sunny
source share