October 2011
Beginner to intermediate
1200 pages
35h 33m
English
The copy constructor looks like this:
basic_string(const basic_string& str);
It initializes a new string object using a string argument:
string mel("I'm ok!");string ida(mel);
Here, ida would get a copy of the string managed by mel.
The next constructor additionally requires that you specify an allocator:
basic_string(const basic_string& str, const Allocator&);
The following relationships hold after either of these two constructors is called:
• The data() method returns a pointer to an allocated copy of the array whose first element is pointed to by str.data().
• The size() method returns the value of str.size().
• The capacity() method returns a value at least as large as size().
Moving along, the next ...
Read now
Unlock full access