This page is a snapshot from the LWG issues list, see theLibrary Active Issues List for more information and the meaning ofC++14 status.
basic_string constructorsSection: 27.4.3.3[string.cons]Status:C++14Submitter: Juan SoulieOpened: 2013-01-17Last modified: 2016-01-28
Priority:Not Prioritized
View all otherissues in [string.cons].
View all issues withC++14 status.
Discussion:
In 27.4.3.3[string.cons], I believe tighter requirements should be imposed onbasic_string's constructors taking ans argument (or, a behavior should be provided for the undefined cases).These requirements are properly stated in the other members functions takings arguments (append,assign,insert,...).
basic_string(const charT* s, size_type n, const Allocator& a = Allocator());
Relative to N3485, 27.4.3.3[string.cons]/6 says "Requires:s shall not be a null pointer andn < npos", where it should say: "Requires:s points to an array of at leastn elements ofcharT"
basic_string(const charT* s, const Allocator& a = Allocator());
27.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 leasttraits::length(s) + 1 elements ofcharT"
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 betweenRequirements andEffects clauses. Consensus that we do want to say something likethis for theRequirements 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 27.4.3.3[string.cons]/6 as indicated:
basic_string(const charT* s, size_type n, const Allocator& a = Allocator());-6-Requires:
sshall not be a null pointer andpoints to an array of at leastn < nposnelements ofcharT.
Change 27.4.3.3[string.cons]/8 as indicated:
basic_string(const charT* s, const Allocator& a = Allocator());-8-Requires:
sshall not be a null pointerpoints to an array of at leasttraits::length(s) + 1elements ofcharT.