Cartesius00
Cartesius00

Reputation: 24364

Custom allocator in std::vector

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

Upvotes: 37

Views: 58856

Answers (1)

bitmask
bitmask

Reputation: 34628

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.

Upvotes: 19

Related Questions