In every specialization basic_­string<charT, traits, Allocator>,
the type traits shall satisfy
the character traits requirements ([char.traits]), and
the type traits​::​char_­type shall name the same type as charT.

Ensures:data() points at the first element of an allocated copy
of the array whose first element is pointed at by the original
value str.data(), size() is equal to the
original value of str.size(), and capacity() is a value
at least as large as size().

In the second form, str is left in a valid state with an unspecified value.

Effects:
Constructs an object of class
basic_­string
and determines the effective length rlen of the initial string
value as str.size() - pos in the first form and
as the smaller of str.size() - pos and n in the second form.

Ensures:data() points at the first element of an allocated copy of rlen
consecutive elements of the string controlled by str beginning at position
pos, size() is equal to rlen, and capacity() is a
value at least as large as size().

Ensures:data() points at the first element of an allocated copy
of the array whose first element is pointed at by s,
size() is equal to traits​::​length(s), and
capacity() is a value at least as large as size().

Ensures:data() points at the first element of an allocated copy
of the array whose first element is pointed at by the original
value of str.data(), size() is equal to the
original value of str.size(), capacity() is a value
at least as large as size(), and get_­allocator() is
equal to alloc.

In the second form, str is left in a valid state with an
unspecified value.

Remarks: Shall not participate in overload resolution if
InputIterator is a type that does not qualify as an input iterator,
or if Allocator is a type that does not qualify as an allocator ([container.requirements.general]).

Ensures:
If *this and str are the same object, the member has no effect.

Otherwise,
data() points at the first element of an allocated copy
of the array whose first element is pointed at by str.data(),
size() is equal to str.size(), and
capacity() is a value at least as large as size().

If
n > size(),
the function replaces the string designated by
*this
with a string of length n whose first
size()
elements are a copy of the original string designated by
*this,
and whose remaining elements are all initialized to c.

Effects: The function replaces the string controlled by *this
with a string of length size() + n whose first size()
elements are a copy of the original string controlled by *this
and whose remaining elements are a copy of the initial n elements
of s.

Effects: Replaces the string controlled by *this with a string of
length size() + n whose first pos elements are a copy of
the initial elements of the original string controlled by *this and
whose next n elements are a copy of the elements in s and
whose remaining elements are a copy of the remaining elements of the original
string controlled by *this.

The function then replaces the string controlled by
*this
with a string of length
size() - xlen
whose first pos elements are a copy of the initial elements of the original string controlled by
*this,
and whose remaining elements are a copy of the elements of the original string controlled by
*this
beginning at position
pos + xlen.

Otherwise,
the function replaces the string controlled by *this with a string of
length size() - xlen + n2 whose first pos1 elements are a copy
of the initial elements of the original string controlled by *this,
whose next n2 elements are a copy of the initial n2 elements
of s, and whose remaining elements are a copy of the elements of the
original string controlled by *this beginning at position
pos + xlen.