You can change the way memory is allocated for STL containers with a combination of the Allocator template type and the allocator object passed to the constructor.
I asked a question on how to make a stack repository in a vector, and got this answer. You may find it interesting.
Zan lynx
source share