2 ms·
I understood the comment to be more about some way to parameterize allocators on a per-type basis for standard library types, and not a specific mechanism. C++
by fweimer 4y ago
I understood the comment to be more about some way to parameterize allocators on a per-type basis for standard library types, and not a specific mechanism.
C++ nowadays has stateful allocators (e.g., allocate in this specific pool please). With that, even the variant with a type parameter on the type benefits from a constructor argument that specifies an allocator object explicitly.
And I don't think the type-parameter-on-functions-only approach can be made safe for immutable data structures because the allocators used for allocation and deallocation must match. And the appropriate allocator needs to be known at Drop time anyway.