I would like to be able to pass to the STL containers (vector, unordered_map, etc) the memory pool from which they need to allocate. I've found this question but it does not address the specific problem I'm facing. I already have a working custom allocator that I can specify in the container declaration but could not figure out a way to pass the address for the allocator to use internally (via the placement new operator), from the application. Basically, I would like to go
From:
std::vector<int, myCustomAllocator<int>> myVector;
to:
void* pool = getMemoryPoolAddress();
std::vector<int, myCustomAllocator<int>/*Specify memory pool somehow*/> myVector;
How can I pass pool
to my allocator?