sparse-map icon indicating copy to clipboard operation
sparse-map copied to clipboard

Adding support for fancy pointers and scoped_allocator_adaptors

Open LukasKerk opened this issue 3 years ago • 2 comments

This pull request adds support for scoped_allocator_adaptor and allocators with fancy pointers like boost offset pointers.

With these additions, it is now possible to persist the sparse_set and sparse_map via boost's interprocess. When using a stable hash function, an allocator that operates on memory mapped files can be used to store a populated sparse-hash map or set between program executions. The scoped_allocator_adaptor is needed for nested containers. Take a set of sets of integers as an example. Before it wasn't possible to give the inner sets their own custom allocator or to give a single allocator to all sets.

LukasKerk avatar May 27 '21 12:05 LukasKerk

Thank you very much for your contribution.

I have to dig more into it but I'm a bit wary of the size of the change and maintenance burden for something that is interesting but quite niche.

Would it be eventually be possible to just adapt sparse_hash_map without the tests and boost_offset_pointer.h and find the minimal possible change to support these kind of allocators?

Tessil avatar May 31 '21 11:05 Tessil

Sorry for the many commits. A few of the CI problems were a bit tricky to find. The specific tests for the fancy pointers and the scoped allocators are removed, the boost offset pointer header as well. As far as I know the current code changes are as small as possible to still add the functionality described above.

LukasKerk avatar Jun 03 '21 19:06 LukasKerk