t wrote:
:: I understand size() and capacity(), but not max_size().
::
:: Lippman: c.max_size() returns maximum number of elements c can
:: contain, where c is a container.
::
:: This may be stupid, but I don't understand that... Maximum in
:: terms of what?
It's not really clear what the intention originally was, we only know
that you can never create a container larger than max_size() elements.
Normally, you cannot even get close to this number, so it is not very
useful.
This has been reported as a defect in the standard, but the committee
decided that the current wording is good enough:
"max_size() isn't useful for very many things, and the existing
wording is sufficiently clear for the few cases that max_size() can be
used for. None of the attempts to change the existing wording were an
improvement."
http://www.open-std.org/jtc1/sc22/wg...n2405.html#197
Bo Persson