This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++14 status.
Section: 23.4.3.3 [string.cons] Status: C++14 Submitter: Juan Soulie Opened: 2013-01-17 Last modified: 2016-01-28
Priority: Not Prioritized
View all other issues in [string.cons].
View all issues with C++14 status.
Discussion:
In 23.4.3.3 [string.cons], I believe tighter requirements should be imposed on basic_string's constructors taking an s argument (or, a behavior should be provided for the undefined cases). These requirements are properly stated in the other members functions taking s arguments (append, assign, insert,...).
basic_string(const charT* s, size_type n, const Allocator& a = Allocator());
Relative to N3485, 23.4.3.3 [string.cons]/6 says "Requires: s shall not be a null pointer and n < npos", where it should say: "Requires: s points to an array of at least n elements of charT"
basic_string(const charT* s, const Allocator& a = Allocator());
23.4.3.3 [string.cons]/8 says "Requires: s shall not be a null pointer.", where it should say: "Requires: s points to an array of at least traits::length(s) + 1 elements of charT"
Daniel:
I think that 16.4.5.9 [res.on.arguments] p1 b2 basically requires this already, but the wording is indeed worth improving it.
[2013-03-15 Issues Teleconference]
Moved to Review.
The resolution could be worded more cleanly, and there is some concern about redundancy between Requirements and Effects clauses. Consensus that we do want to say something like this for the Requirements though.
[2013-04-18, Bristol]
Move to Ready
[2013-09-29, Bristol]
Apply to the Working Paper
Proposed resolution:
This wording is relative to N3485.
Change 23.4.3.3 [string.cons]/6 as indicated:
basic_string(const charT* s, size_type n, const Allocator& a = Allocator());-6- Requires: s
shall not be a null pointer and n < npospoints to an array of at least n elements of charT.
Change 23.4.3.3 [string.cons]/8 as indicated:
basic_string(const charT* s, const Allocator& a = Allocator());-8- Requires: s
shall not be a null pointerpoints to an array of at least traits::length(s) + 1 elements of charT.