This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++11 status.
Section: 20.3.2 [basic.string] Status: C++11 Submitter: Daniel Krügler Opened: 2008-08-22 Last modified: 2016-12-23
Priority: Not Prioritized
View other active issues in [basic.string].
View all other issues in [basic.string].
View all issues with C++11 status.
During the Sophia Antipolis meeting it was decided to split-off some parts of the n2647 ("Concurrency modifications for basic_string") proposal into a separate issue, because these weren't actually concurrency-related. The here proposed changes refer to the recent update document n2668 and attempt to take advantage of the stricter structural requirements.
Indeed there exists some leeway for more guarantees that would be very useful for programmers, especially if interaction with transactionary or exception-unaware C API code is important. This would also allow compilers to take advantage of more performance optimizations, because more functions can have throw() specifications. This proposal uses the form of "Throws: Nothing" clauses to reach the same effect, because there already exists a different issue in progress to clean-up the current existing "schizophrenia" of the standard in this regard.
Due to earlier support for copy-on-write, we find the following unnecessary limitations for C++0x:
The proposed resolution is split into a main part (A) and a secondary part (B) (earlier called "Adjunct Adjunct Proposal"). (B) extends (A) by also making access to index position size() of the at() overloads a no-throw operation. This was separated, because this part is theoretically observable in specifically designed test programs.
[ San Francisco: ]
We oppose part 1 of the issue but hope to address size() in issue 877.
We do not support part B. 4 of the issue because of the breaking API change.
We support part A. 2 of the issue.
On support part A. 3 of the issue:
Pete's broader comment: now that we know that basic_string will be a block of contiguous memory, we should just rewrite its specification with that in mind. The expression of the specification will be simpler and probably more correct as a result.
[ 2009-07 Frankfurt ]
Move proposed resolution A to Ready.
[ Howard: Commented out part B. ]
In 22.214.171.124 [string.capacity], just after p. 1 add a new paragraph:
In 126.96.36.199 [string.access] replace p. 1 by the following 4 paragraghs:
Requires: pos ≤ size().
Returns: If pos < size(), returns *(begin() + pos). Otherwise, returns a reference to a charT() that shall not be modified.
Complexity: Constant time.
In 188.8.131.52.1 [string.accessors] replace the now common returns clause of c_str() and data() by the following three paragraphs:
Returns: A pointer p such that p+i == &operator(i) for each i in [0, size()].
Complexity: Constant time.