21 Strings library [strings]

21.4 Class template basic_string [basic.string]

21.4.7 basic_string string operations [string.ops]

21.4.7.8 basic_string::substr [string::substr]

basic_string substr(size_type pos = 0, size_type n = npos) 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.

Returns: basic_string(data()+pos,rlen).