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

Martin Sebor msebor@redhat.com
Wed May 13 14:26:00 GMT 2015


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.

We implemented this in response to user requests and I found
it quite useful myself when testing the containers.

Martin



More information about the Libstdc++ mailing list