This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [v3 patch] Implement LWG 2466 (allocator_traits::max_size() is stoopid)
- From: Jonathan Wakely <jwakely at redhat dot com>
- To: Martin Sebor <msebor at redhat dot com>
- Cc: libstdc++ at gcc dot gnu dot org
- Date: Wed, 13 May 2015 17:07:47 +0100
- Subject: Re: [v3 patch] Implement LWG 2466 (allocator_traits::max_size() is stoopid)
- Authentication-results: sourceware.org; auth=none
- References: <20150513122130 dot GE30202 at redhat dot com> <55535F1C dot 7030106 at redhat dot com>
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).