const charT* c_str() const noexcept;
const charT* data() const noexcept;
Returns: Указательp такой, чтоp + i == &operator[](i) для каждого
i в[0, size()].
Complexity: Постоянное время.
Requires:
Программа не должна изменять никаких значений, хранящихся в массиве символов.
charT* data() noexcept;
Returns: Указательp такой, чтоp + i == &operator[](i) для каждого
i в[0, size()].
Complexity: Постоянное время.
Requires:
Программа не должна изменять значение, хранящееся вp + size().
operator basic_string_view<charT, traits>() const noexcept;
Effects: Эквивалентен:
return basic_string_view<charT, traits>(data(), size());
allocator_type get_allocator() const noexcept;
Returns:
Копия
Allocator
объекта, используемого для создания строки, или, если этот распределитель был заменен, копия самой последней замены.
size_type find(basic_string_view<charT, traits> sv, size_type pos = 0) const noexcept;
Effects:
Определяетxpos, если возможно, самое низкое положение , при котором выполняются оба следующих условия:
pos <= xpos и
xpos + sv.size() <= size();
traits::eq(at(xpos + I), sv.at(I))
для всех элементовI данных, на которые ссылаетсяsv.
Returns:
xpos если функция может определить такое значение дляxpos. В противном случае возвращается
npos.
size_type find(const basic_string& str, size_type pos = 0) const noexcept;
Effects:
Эквивалентен:return find(basic_string_view<charT, traits>(str), pos);
size_type find(const charT* s, size_type pos, size_type n) const;
Returns:
find(basic_string_view<charT, traits>(s, n), pos).
size_type find(const charT* s, size_type pos = 0) const;
Requires:s указывает на массив, состоящий как минимум изtraits::length(s) + 1
элементовcharT.
Returns:
find(basic_string_view<charT, traits>(s), pos).
size_type find(charT c, size_type pos = 0) const;
Returns:
find(basic_string(1, c), pos).
size_type rfind(basic_string_view<charT, traits> sv, size_type pos = npos) const noexcept;
Effects:
Определяетxpos, если возможно, наивысшее положение , при котором выполняются оба следующих условия:
xpos <= pos
и
xpos + sv.size() <= size();
traits::eq(at(xpos + I), sv.at(I))
для всех элементовI данных, на которые ссылаетсяsv.
Returns:
xpos если функция может определить такое значение дляxpos. В противном случае возвращается
npos.
size_type rfind(const basic_string& str, size_type pos = npos) const noexcept;
Effects:
Эквивалентен:return rfind(basic_string_view<charT, traits>(str), pos);
size_type rfind(const charT* s, size_type pos, size_type n) const;
Returns:
rfind(basic_string_view<charT, traits>(s, n), pos).
size_type rfind(const charT* s, size_type pos = npos) const;
Requires:s указывает на массив, состоящий как минимум изtraits::length(s) + 1
элементовcharT.
Returns:
rfind(basic_string_view<charT, traits>(s), pos).
size_type rfind(charT c, size_type pos = npos) const;
Returns:
rfind(basic_string(1, c), pos).
size_type find_first_of(basic_string_view<charT, traits> sv, size_type pos = 0) const noexcept;
Effects:
Определяетxpos, если возможно, самое низкое положение , при котором выполняются оба следующих условия:
pos <= xpos
и
xpos < size();
traits::eq(at(xpos), sv.at(I))
для некоторого элементаI данных, на который ссылаетсяsv.
Returns:
xpos если функция может определить такое значение дляxpos. В противном случае возвращается
npos.
size_type find_first_of(const basic_string& str, size_type pos = 0) const noexcept;
Effects:
Эквивалентен:return find_first_of(basic_string_view<charT, traits>(str), pos);
size_type find_first_of(const charT* s, size_type pos, size_type n) const;
Returns:
find_first_of(basic_string_view<charT, traits>(s, n), pos).
size_type find_first_of(const charT* s, size_type pos = 0) const;
Requires:s указывает на массив, состоящий как минимум изtraits::length(s) + 1
элементовcharT.
Returns:
find_first_of(basic_string_view<charT, traits>(s), pos).
size_type find_first_of(charT c, size_type pos = 0) const;
Returns:
find_first_of(basic_string(1, c), pos).
size_type find_last_of(basic_string_view<charT, traits> sv, size_type pos = npos) const noexcept;
Effects:
Определяетxpos, если возможно, наивысшее положение , при котором выполняются оба следующих условия:
xpos <= pos
и
xpos < size();
traits::eq(at(xpos), sv.at(I))
для некоторого элементаI данных, на который ссылаетсяsv.
Returns:
xpos если функция может определить такое значение дляxpos. В противном случае возвращается
npos.
size_type find_last_of(const basic_string& str, size_type pos = npos) const noexcept;
Effects:
Эквивалентен:return find_last_of(basic_string_view<charT, traits>(str), pos);
size_type find_last_of(const charT* s, size_type pos, size_type n) const;
Returns:
find_last_of(basic_string_view<charT, traits>(s, n), pos).
size_type find_last_of(const charT* s, size_type pos = npos) const;
Requires:s указывает на массив, состоящий как минимум изtraits::length(s) + 1
элементовcharT.
Returns:
find_last_of(basic_string_view<charT, traits>(s), pos).
size_type find_last_of(charT c, size_type pos = npos) const;
Returns:
find_last_of(basic_string(1, c), pos).
size_type find_first_not_of(basic_string_view<charT, traits> sv,
size_type pos = 0) const noexcept;
Effects:
Определяетxpos, если возможно, самое низкое положение , при котором выполняются оба следующих условия:
pos <= xpos
и
xpos < size();
traits::eq(at(xpos), sv.at(I))
для ни одного элементаI данных, на который ссылаетсяsv.
Returns:
xpos если функция может определить такое значение дляxpos. В противном случае возвращается
npos.
size_type find_first_not_of(const basic_string& str, size_type pos = 0) const noexcept;
Effects:
Эквивалентен:
return find_first_not_of(basic_string_view<charT, traits>(str), pos);
size_type find_first_not_of(const charT* s, size_type pos, size_type n) const;
Returns:
find_first_not_of(basic_string_view<charT, traits>(s, n), pos).
size_type find_first_not_of(const charT* s, size_type pos = 0) const;
Requires:s указывает на массив, состоящий как минимум изtraits::length(s) + 1
элементовcharT.
Returns:
find_first_not_of(basic_string_view<charT, traits>(s), pos).
size_type find_first_not_of(charT c, size_type pos = 0) const;
Returns:
find_first_not_of(basic_string(1, c), pos).
size_type find_last_not_of(basic_string_view<charT, traits> sv,
size_type pos = npos) const noexcept;
Effects:
Определяетxpos, если возможно, наивысшее положение , при котором выполняются оба следующих условия:
xpos <= pos
и
xpos < size();
traits::eq(at(xpos), sv.at(I))
для ни одного элементаI данных, на который ссылаетсяsv.
Returns:
xpos если функция может определить такое значение дляxpos. В противном случае возвращается
npos.
size_type find_last_not_of(const basic_string& str, size_type pos = npos) const noexcept;
Effects:
Эквивалентен:
return find_last_not_of(basic_string_view<charT, traits>(str), pos);
size_type find_last_not_of(const charT* s, size_type pos, size_type n) const;
Returns:
find_last_not_of(basic_string_view<charT, traits>(s, n), pos).
size_type find_last_not_of(const charT* s, size_type pos = npos) const;
Requires:s указывает на массив, состоящий как минимум изtraits::length(s) + 1
элементовcharT.
Returns:
find_last_not_of(basic_string_view<charT, traits>(s), pos).
size_type find_last_not_of(charT c, size_type pos = npos) const;
Returns:
find_last_not_of(basic_string(1, c), pos).
basic_string substr(size_type pos = 0, size_type n = npos) const;
Throws:
out_of_range
если
pos > size().
Effects:
Определяет эффективную длинуrlen копируемой строки как меньшее из значенийn и
size() - pos.
Returns:
basic_string(data()+pos, rlen).
int compare(basic_string_view<charT, traits> sv) const noexcept;
Effects:
Определяет эффективную длину
rlen
строк для сравнения как меньшее из значений
size()
и
sv.size(). Затем функция сравнивает две строки, вызывая
traits::compare(data(), sv.data(), rlen).
Returns:
Ненулевой результат, если результат сравнения отличен от нуля. В противном случае возвращает значение, указанное в таблице63.
Таблица
63 -
compare() результаты
Состояние | Возвращаемое значение |
size() < sv.size() | < 0 |
size() == sv.size() | 0 |
size() > sv.size() | > 0 |
int compare(size_type pos1, size_type n1, basic_string_view<charT, traits> sv) const;
Effects:
Эквивалентен:
return basic_string_view<charT, traits>(data(), size()).substr(pos1, n1).compare(sv);
template<class T>
int compare(size_type pos1, size_type n1, const T& t,
size_type pos2, size_type n2 = npos) const;
Effects:
Эквивалентен:
basic_string_view<charT, traits> sv = t;
return basic_string_view<charT, traits>(
data(), size()).substr(pos1, n1).compare(sv.substr(pos2, n2));
Remarks:
Эта функция не будет участвовать в разрешении перегрузки , еслиis_convertible_v<const T&, basic_string_view<charT, traits>>
неtrue иis_convertible_v<const T&, const charT*> являетсяfalse.
int compare(const basic_string& str) const noexcept;
Effects:
Эквивалентен:
return compare(basic_string_view<charT, traits>(str));
int compare(size_type pos1, size_type n1, const basic_string& str) const;
Effects:
Эквивалентен:
return compare(pos1, n1, basic_string_view<charT, traits>(str));
int compare(size_type pos1, size_type n1,
const basic_string& str,
size_type pos2, size_type n2 = npos) const;
Effects: Эквивалентен:
return compare(pos1, n1, basic_string_view<charT, traits>(str), pos2, n2);
int compare(const charT* s) const;
Returns:
compare(basic_string(s)).
int compare(size_type pos, size_type n1, const charT* s) const;
Returns:basic_string(*this, pos, n1).compare(basic_string(s)).
int compare(size_type pos, size_type n1, const charT* s, size_type n2) const;
Returns:basic_string(*this, pos, n1).compare(basic_string(s, n2)).