Replies: 1 comment
-
I'm not sure I understand the question. Just create a single pool and pass it to all sets, they will only store a reference by default. Sharing the allocator is in fact the default behavior. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Is there any way to share a memory_pool<> between multiple standard containers?
To generalize the situation I'm dealing with:
class Item;
using ItemSet = std::set;
using ItemGroups = std::map<uint64_t /groupid/, ItemSet>;
I'd like all the ItemSets to share a memory pool, as there will be a fairly fixed number of items, but I don't know how they're going to be placed in the various groups. So rather than each group needing it's own pool of items, and therefor wasting a lot of memory, I can use a shared pool of the size needed.
Beta Was this translation helpful? Give feedback.
All reactions