Skip to content

Commit d330fa1

Browse files
committed
Stop stripping zeroes when assigning specified-length strings
1 parent 65f9232 commit d330fa1

File tree

2 files changed

+1
-5
lines changed

2 files changed

+1
-5
lines changed

bvt/bvt07.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ void TestString (void)
1313
static const char c_TestString2[] = "abcdefghijklmnopqrstuvwxyz";
1414
static const char c_TestString3[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
1515
string s1 (c_TestString1);
16-
string s2 (VectorRange (c_TestString2));
16+
string s2 (VectorRange(c_TestString2)-1);
1717
string s3 (s1);
1818

1919
cout << s1 << endl;

ustring.cc

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,6 @@ void string::assign (const_pointer s)
6565
/// Assigns itself the value of string \p s of length \p len.
6666
void string::assign (const_pointer s, size_type len)
6767
{
68-
while (len && s[len - 1] == 0)
69-
-- len;
7068
resize (len);
7169
copy_n (s, len, begin());
7270
}
@@ -81,8 +79,6 @@ void string::append (const_pointer s)
8179
/// Appends to itself the value of string \p s of length \p len.
8280
void string::append (const_pointer s, size_type len)
8381
{
84-
while (len && s[len - 1] == 0)
85-
-- len;
8682
resize (size() + len);
8783
copy_n (s, len, end() - len);
8884
}

0 commit comments

Comments
 (0)