5 ms·
Except that std::vector can be specialized with custom arena allocators, which isn't uncommon in performance sensitive applications.
by krona 7y ago
Except that std::vector can be specialized with custom arena allocators, which isn't uncommon in performance sensitive applications.
- gpderetta 7y agostd vector needs to be countiguous, so you cannot use a segmented storage.
- krona 7y agoMost applications need more than one vector. Management of this with custom allocators pays dividends fairly quickly.
- gpderetta 7y agoSorry, there is some confusion here. The OP is literally implementing a custom allocator. I'm saying that using std::vector for the backing store of your allocator is wrong because resizing will invalidate your already allocated objects (which is a no-can-do in a general purpose allocator) and the copying is wasteful. A custom fixed size chunk based allocator woud be better.