Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding support for fancy pointers and scoped_allocator_adaptors #17

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

LukasKerk
Copy link

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 and others added 2 commits May 20, 2021 13:27
* Started to add fancy pointer support to the sparse array class and a lot of tests to ensure that nothing is broken.

* Fixxed a bug in the move construction test.

* Started to work on sparse_hash

* Some more changes for the iterators.

* Ported the set tests to work with maps. I could have generalized the tests even more to reduce code duplication, however the tests are already complicated enough.

* Integrated boost::to_address directly into the code.

* A bit of tidy up. Now the fancy pointer tests are integrated into the "normal" test suit and can be compiled with C++-11.

* added test for value() with fancy pointer

* added missing const

* Fixxed a bug in the OffsetAllocator, also did some work on erase.

* added Remove_Const struct for overloading const_cast with @LukasKerk

* Added the "const_cast" for boost offset pointers in its own header.

* Fixed a typo in a test output.

* Corrected comments.

Co-authored-by: Alexander Bigerl <[email protected]>
* Initial commit.
First few tests, found one problem.

* Now scoped allocators can be used. However emplace still does not work as it should.

* Some cleanup.

* Formatting and removing comments.
@LukasKerk LukasKerk changed the title Development Adding support for fancy pointers and scoped_allocator_adaptors May 27, 2021
BOOST_TEST_REQUIRE seems to be a pretty recent addition to the boost unittest framework. It is now replaced by BOOST_REQUIRE
@Tessil
Copy link
Owner

Tessil commented May 31, 2021

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?

LukasKerk and others added 2 commits June 3, 2021 14:54
* reverted whitespace changes

* added typename for sparse_hash::value_type/const_pointer
@LukasKerk
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants