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

Fixing Allocator support in Trial.Json #35

Open
glenfe opened this issue Sep 23, 2019 · 1 comment
Open

Fixing Allocator support in Trial.Json #35

glenfe opened this issue Sep 23, 2019 · 1 comment

Comments

@glenfe
Copy link

glenfe commented Sep 23, 2019

This library looks good, and good things provoke requests like these. Here's an initial list:

  • An Allocator doesn't have to be a template with a single parameter. i.e. The template parameter shouldn't be template<typename> class Allocator but instead just class Allocator. You can default it to std::allocator<char>, it doesn't matter, since you'll be rebinding as necessary.

  • An Allocator doesn't have to be default constructible or stateless. All functions should accept an allocator instance, const Allocator& a. You can default this to an instance of Allocator() but users who use allocators where this is not an option, can supply the appropriate instance.

  • Allocator construction shouldn't use addressof(*ptr) but instead to_address(ptr) (using addressof(*ptr) here before ptr references an object of T is undefined behavior).

  • Allocators might be final so do not derive from them unconditionally. Instead of deriving from Allocator, derive from a facility like boost::empty_value<Allocator> (which will use inheritance if not final, or otherwise just store a member).

@breese
Copy link
Owner

breese commented Sep 28, 2019

Thank you for the report. I decided to split them into four separate issues to make it easier to track.

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

No branches or pull requests

2 participants