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

Custom allocator support, Figure out STL container reliance, and other considerations #5

Open
Capital-Asterisk opened this issue Jan 13, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@Capital-Asterisk
Copy link
Owner

So far, only IntArrayMultiMap has partial support for custom allocators (but uses a few default stl containers on the inside lol).

I'm not much of a fan of using stl containers, but I'm lazy.

This might be a bit extreme, but I'm considering entirely separating the responsibility of allocation out of the HierarchicalBitset and other classes. Most of their functions simply don't allocate memory. Almost all of them can be made std::string_view-like, simply pointing at a region of memory instead of managing their own.

There's a few advantages to this:

  • Simplifies the code
  • Allows using the class without needing to know their allocator
  • More flexibility on how to arrange memory

Earlier versions of C++ heavily abstracts away memory. Getting a bit opinionated here, the need for custom allocators arose from realizing that memory is important. They're designed to support a 'legacy' style of classes being responsible for allocations. It's possible to code in way that uses memory 'normally', which is kind of the point of this library :p

The allocator can still be bundled together in a separate class to provide the same traditional STL-style interface when needed.

@Capital-Asterisk Capital-Asterisk added the enhancement New feature or request label Jan 13, 2022
@jonesmz
Copy link
Contributor

jonesmz commented Jan 19, 2022

std::string_view

probably use std::span instead.

I think I'm going to start making noise in OSP this year about moving to C++20. Maybe not right this second, but not terribly far away.

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

No branches or pull requests

2 participants