size_type copy(charT* s, size_type n, size_type pos = 0) const;
Позвольте rlen быть меньшим из n и size() - pos.
Throws:
out_of_range если pos > size().
Requires:
[s, s + rlen) допустимый диапазон.
Effects:
Эквивалентно traits::copy(s, data() + pos, rlen).
constexpr basic_string_view substr(size_type pos = 0, size_type n = npos) const;
Позвольте rlen быть меньшим из n и size() - pos.
Throws:
out_of_range если pos > size().
Effects:
Определяет rlenэффективную длину строки для ссылки.
Returns:
basic_string_view(data() + pos, rlen).
constexpr int compare(basic_string_view str) const noexcept;
Позвольте rlen быть меньшим из size() и str.size().
Effects:
Определяет rlenэффективную длину сравниваемых строк. Затем функция сравнивает две строки, вызывая traits::compare(data(), str.data(), rlen).
Returns:
Ненулевой результат, если результат сравнения отличен от нуля. В противном случае возвращает значение, указанное в таблице 66.
Таблица
66 -
compare() результаты
Состояние | Возвращаемое значение |
size() < str.size() | < 0 |
size() == str.size() | 0 |
size() > str.size() | > 0 |
constexpr int compare(size_type pos1, size_type n1, basic_string_view str) const;
Effects:
Эквивалентен: return substr(pos1, n1).compare(str);
constexpr int compare(size_type pos1, size_type n1, basic_string_view str,
size_type pos2, size_type n2) const;
Effects:
Эквивалентен: return substr(pos1, n1).compare(str.substr(pos2, n2));
constexpr int compare(const charT* s) const;
Effects:
Эквивалентен: return compare(basic_string_view(s));
constexpr int compare(size_type pos1, size_type n1, const charT* s) const;
Effects:
Эквивалентен: return substr(pos1, n1).compare(basic_string_view(s));
constexpr int compare(size_type pos1, size_type n1,
const charT* s, size_type n2) const;
Effects:
Эквивалентен: return substr(pos1, n1).compare(basic_string_view(s, n2));