Closed vinniefalco closed 5 years ago
You are right. operator new is guaranteed to be aligned to any type without extended alignment attributes, but the char-rebound Allocator type could only guarantee byte alignment. I'll review design alternatives to guarantee aligned allocations.
I'm not really happy with the polymorphic allocator / memory resource design but that's not Boost.Container's problem. How do you implement a reference-counted memory resource? Seems there's no way.
I had to roll my own as you can see here: https://github.com/vinniefalco/BeastLounge/blob/develop/include/boost/beast/_experimental/json/storage.hpp#L34
memory_resource isn't thought for that use case, many would not like to pay for a reference-counted design that they won't use ;-)
Thanks for the bug report!
resource_adaptor
rebinds the caller's Allocator type tochar
, which destroys the alignment information. Then inallocate
it ignores thealignment
parameter. Is this the right thing to do?