[v3 patch] Implement LWG 2466 (allocator_traits::max_size() is stoopid)

Jonathan Wakely jwakely@redhat.com
Wed May 13 16:07:00 GMT 2015


On 13/05/15 08:26 -0600, Martin Sebor wrote:
>On 05/13/2015 06:21 AM, Jonathan Wakely wrote:
>>http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#2466
>>
>>We agreed to move this to Ready in Lenexa.
>>
>>I'd like to see max_size() deprecated, it's useless, but if we can't
>>do that it might as well not give an impossible answer.
>
>FWIW, I think it's unfortunate that the LWG decided in their
>response to issue 197 to leave max_size so poorly specified
>as to render it useless.
>
>The function can be made useful by having each container use
>Allocator::max_size in determining its maximum size. It doesn't
>cost anything in terms of efficiency (for the default Allocator)
>but allows programs to provide a specialized Allocator that
>returns a value that controls the size of each container object.

This is what we do, although it's not right for std::deque and
std::unordered_xxx, because we really need some formula involving the
max_size of two different specializations of the allocator (one for
the table of pointers and one for the pages/nodes containing
elements).



More information about the Libstdc++ mailing list