R. Clayton (rclayton@clayton.cs.monmouth.edu)
(no date)
Those of you that ran the experiment I suggested yesterday now know that my
guess was wrong. Here is what I hope is the final word on putting things at
the end of strings; see Table 11.3 and Section 11.2.8 in The C++ Standard
Library by Josuttis for details.
The += operator is defined when its right-hand argument has type string
str1 += str2
character array
str1 += "hello"
or character
str1 += 'a'
The append() member function is overloaded for a string argument
str1.append(str2)
the subsequence [i, j - 1] of a string argument
str1.append(str2, i, j)
a character array
str1.append("hello")
a sequence of n characters (which is not a character array because there
doesn't necessarily have to be a null byte)
str.append(chars, n)
n copies of a character c
str.append(n, c)
and the character sequence defined by the iterator range (b, e)
str.append(b, e)
The push_back() member function is defined only for a single character
argument.
str.push_back('!')
This archive was generated by hypermail 2.0b3 on Fri May 10 2002 - 12:45:04 EDT