Created on 1998-09-29.00:00:00 last changed 172 months ago
Rationale:
The LWG believes length_error is the correct exception to throw.
Proposed resolution:
After [basic.string] paragraph 4 ("The functions described in this clause...") add a new paragraph:
For any string operation, if as a result of the operation, size() would exceed max_size() then the operation throws length_error.
Many string member functions throw if size is getting or exceeding npos. However, I wonder why they don't throw if size is getting or exceeding max_size() instead of npos. May be npos is known at compile time, while max_size() is known at runtime. However, what happens if size exceeds max_size() but not npos, then? It seems the standard lacks some clarifications here.
History | |||
---|---|---|---|
Date | User | Action | Args |
2010-10-21 18:28:33 | admin | set | messages: + msg191 |
2010-10-21 18:28:33 | admin | set | messages: + msg190 |
1998-09-29 00:00:00 | admin | create |