You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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).
The text was updated successfully, but these errors were encountered:
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 justclass Allocator
. You can default it tostd::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 ofAllocator()
but users who use allocators where this is not an option, can supply the appropriate instance.Allocator construction shouldn't use
addressof(*ptr)
but insteadto_address(ptr)
(usingaddressof(*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 likeboost::empty_value<Allocator>
(which will use inheritance if not final, or otherwise just store a member).The text was updated successfully, but these errors were encountered: