| ▲ | Panzerschrek 5 hours ago | |
I understand how C++ standard containers are designed. They are designed in such a way, so that they don't store a pointer to an allocator instance inside. This allows to save memory in the most cases (where the standard allocator is used). Overriding an allocator is possible, but only with some another global allocator (via a template argument), with no possibility to specify a per-object allocator. As I know in newer C++ standards there is something which allows to workaround this issue. Or at least there are proposals for this. | ||
| ▲ | tardedmeme 3 hours ago | parent [-] | |
Each container stores an allocator instance inside, not a pointer to one. If you need shared state, it's up to you to make each allocator instance contain a pointer to the shared state. | ||