Constructor That Uses n Copies of a Character

A constructor that uses n copies of a character creates a string object that consists of n consecutive characters, all having the value c:

basic_string(size_type n, charT c, const Allocator& a = Allocator());

This constructor requires that n < npos. If n equals npos, the constructor throws an out_of_range exception. Otherwise, the following relationships hold after the constructor is called:

• The data() method returns a pointer to the first element of a string of n elements, each set to c.

• The size() method returns n.

• The capacity() method returns a value at least as large as size().

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.235.176