Feature Request: steal backing array in flat map/set #22
Open
Description
One feature that would greatly decrease peak memory usage in my use-case is to have the ability to "steal" the backing array from the flat-maps (after compacting them into a "normal" array first of course.)
The use-case is currently implemented as follows:
- add / update many objects in a flat_hash_set
- allocate a new array, iterate over the flat_hash_set, adding all to the array
- delete the flat_hash_set
- sort the array of objects
Perhaps something along the lines of:
// Removes and returns an array of all entries in the set. Optimized implementations may re-use an internal array, thus
// lowering memory usage. Only the first size() entries are defined. It is the callers responsibility to delete the returned array.
value_type* remove_all_entries()
Oh, and thank you for the inspired lazy_emplace()! It's still more powerful than other map/set implementations of try_emplace since key creation can be deferred or customized as well.
Metadata
Assignees
Labels
No labels