n
Copies of a CharacterA 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(
).
13.59.197.213