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

construct() and destroy() should work without uses_allocator, with local storage #6

Open
potswa opened this issue Sep 17, 2015 · 1 comment
Labels

Comments

@potswa
Copy link
Owner

potswa commented Sep 17, 2015

Currently is_small disables local storage according to std::uses_allocator. If uses_allocator returns false_type and local storage is applied, then construct and destroy don't get called.

Instead, construct and destroy should be applied to the local storage. A copy of the allocator needs to be saved to call destroy, but hopefully this can be avoided.

Detect whether the allocator actually implements destroy; if not, use ordinary destruction.

If the allocator is scoped_allocator_adaptor and get_allocator() works on the target, then it would be nice to use that for destruction. But, that would be too presumptuous. It might be OK to check for implementation of destroy on scoped_allocator_adaptor::outer_allocator_type. A more generic means would be nice.

@potswa potswa added the bug label Sep 17, 2015
@potswa potswa changed the title construct() and destroy() should work without uses_allocator, with local storage construct() and destroy() should work without uses_allocator, with local storage Sep 17, 2015
potswa added a commit that referenced this issue Mar 9, 2016
@potswa
Copy link
Owner Author

potswa commented Mar 9, 2016

Also, erasures created without an allocator should not include std::allocator but should use ::new and ::delete instead. (This implies separate, simplified classes.)

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

No branches or pull requests

1 participant