Custom allocator in std::vector

Cartesius00 picture Cartesius00 · Aug 10, 2012 · Viewed 35.3k times · Source

Is it possible to use custom allocator for std::vector internal allocations? If yes, how?

Answer

bitmask picture bitmask · Aug 10, 2012

You basically have to implement your allocator type to conform to the Allocator concept.

The linked page lists all requirements of that type, but the core functionality is implemented in the allocate member function.