[Bug libstdc++/72792] allocator_traits is too strict about rebinding

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Feb 14 18:34:00 GMT 2017


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72792

--- Comment #8 from Jonathan Wakely <redi at gcc dot gnu.org> ---
If you don't provide this, then allocator_traits::rebind_alloc can't be used,
even after this bug is fixed. That means you can't use your allocators with
node-based contains like std::list.

So adding the rebind improves your allocators anyway.

Simply removing the static_assert from allocator_traits doesn't make your
allocator more useful, it just means you don't notice the problem until you try
to use it in a node-based container (or with std::allocate_shared, or in
std::promise, or several other places).


More information about the Gcc-bugs mailing list