21 Strings library [strings]

21.4 Class template basic_string [basic.string]

21.4.6 basic_string modifiers [string.modifiers]

21.4.6.7 basic_string::copy [string::copy]

size_type copy(charT* s, size_type n, size_type pos = 0) const;

Requires: pos <= size()

Throws: out_of_range if pos > size().

Effects: Determines the effective length rlen of the string to copy as the smaller of n and size() - pos. s shall designate an array of at least rlen elements.

The function then replaces the string designated by s with a string of length rlen whose elements are a copy of the string controlled by *this beginning at position pos.

The function does not append a null object to the string designated by s.

Returns: rlen.