36 using underlying_type = std::basic_string_view<CharT, Traits>;
37 using traits_type =
typename underlying_type::traits_type;
38 using value_type =
typename underlying_type::value_type;
39 using pointer =
typename underlying_type::pointer;
40 using const_pointer =
typename underlying_type::const_pointer;
41 using reference =
typename underlying_type::reference;
42 using const_reference =
typename underlying_type::const_reference;
43 using const_iterator =
typename underlying_type::const_iterator;
44 using iterator =
typename underlying_type::iterator;
45 using const_reverse_iterator =
typename underlying_type::const_reverse_iterator;
46 using reverse_iterator =
typename underlying_type::reverse_iterator;
47 using size_type =
typename underlying_type::size_type;
48 using difference_type =
typename underlying_type::difference_type;
50 static constexpr size_type npos = underlying_type::npos;
57 template <
typename Allocator>
59 const std::basic_string<CharT, Traits, Allocator>& str)
63 template <
typename Iter,
typename End>
69 constexpr operator underlying_type()
const noexcept {
73 constexpr const_iterator begin()
const noexcept {
77 constexpr const_iterator cbegin()
const noexcept {
78 return view_.cbegin();
81 constexpr const_iterator end()
const noexcept {
85 constexpr const_iterator cend()
const noexcept {
89 constexpr const_reverse_iterator rbegin()
const noexcept {
90 return view_.rbegin();
93 constexpr const_reverse_iterator crbegin()
const noexcept {
94 return view_.crbegin();
97 constexpr const_reverse_iterator rend()
const noexcept {
101 constexpr const_reverse_iterator crend()
const noexcept {
102 return view_.crend();
105 constexpr const_reference operator[](size_type index)
const {
109 constexpr const_reference
at(size_type index)
const {
110 return view_.at(index);
113 constexpr const_reference front()
const {
114 return view_.front();
117 constexpr const_reference back()
const {
121 constexpr const_pointer data()
const noexcept {
125 constexpr const_pointer c_str()
const noexcept {
129 constexpr size_type size()
const noexcept {
133 constexpr size_type length()
const noexcept {
134 return view_.length();
137 constexpr size_type max_size()
const noexcept {
138 return view_.max_size();
141 [[nodiscard]]
constexpr bool empty()
const noexcept {
142 return view_.empty();
145 constexpr size_type find(
basic_zstring_view view, size_type offset = 0)
const noexcept {
146 return view_.find(view, offset);
149 constexpr size_type find(CharT ch, size_type offset = 0)
const noexcept {
150 return view_.find(ch, offset);
153 constexpr size_type find(
const CharT* str, size_type offset, size_type count)
const {
154 return view_.find(str, offset, count);
157 constexpr size_type find(
const CharT* str, size_type offset = 0)
const {
158 return view_.rfind(str, offset);
161 constexpr size_type rfind(
basic_zstring_view view, size_type offset = npos)
const noexcept {
162 return view_.rfind(view, offset);
165 constexpr size_type rfind(CharT ch, size_type offset = npos)
const noexcept {
166 return view_.rfind(ch, offset);
169 constexpr size_type rfind(
const CharT* str, size_type offset, size_type count)
const {
170 return view_.rfind(str, offset, count);
173 constexpr size_type rfind(
const CharT* str, size_type offset = npos)
const {
174 return view_.rfind(str, offset);
177 constexpr size_type find_first_of(
basic_zstring_view view, size_type offset = 0)
const noexcept {
178 return view_.find_first_of(view, offset);
181 constexpr size_type find_first_of(CharT ch, size_type offset = 0)
const noexcept {
182 return view_.find_first_of(ch, offset);
185 constexpr size_type find_first_of(
const CharT* str, size_type offset, size_type count)
const {
186 return view_.find_first_of(str, offset, count);
189 constexpr size_type find_first_of(
const CharT* str, size_type offset = 0)
const {
190 return view_.find_first_of(str, offset);
193 constexpr size_type find_last_of(
basic_zstring_view view, size_type offset = npos)
const noexcept {
194 return view_.find_last_of(view, offset);
197 constexpr size_type find_last_of(CharT ch, size_type offset = npos)
const noexcept {
198 return view_.find_last_of(ch, offset);
201 constexpr size_type find_last_of(
const CharT* str, size_type offset, size_type count)
const {
202 return view_.find_last_of(str, offset, count);
205 constexpr size_type find_last_of(
const CharT* str, size_type offset = npos)
const {
206 return view_.find_last_of(str, offset);
209 constexpr size_type find_first_not_of(
basic_zstring_view view, size_type offset = 0)
const noexcept {
210 return view_.find_first_not_of(view, offset);
213 constexpr size_type find_first_not_of(CharT ch, size_type offset = 0)
const noexcept {
214 return view_.find_first_not_of(ch, offset);
217 constexpr size_type find_first_not_of(
const CharT* str, size_type offset, size_type count)
const {
218 return view_.find_first_not_of(str, offset, count);
221 constexpr size_type find_first_not_of(
const CharT* str, size_type offset = 0)
const {
222 return view_.find_first_not_of(str, offset);
225 constexpr size_type find_last_not_of(
basic_zstring_view view, size_type offset = npos)
const noexcept {
226 return view_.find_first_not_of(view, offset);
229 constexpr size_type find_last_not_of(CharT ch, size_type offset = npos)
const noexcept {
230 return view_.find_first_not_of(ch, offset);
233 constexpr size_type find_last_not_of(
const CharT* str, size_type offset, size_type count)
const {
234 return view_.find_first_not_of(str, offset, count);
237 constexpr size_type find_last_not_of(
const CharT* str, size_type offset = npos)
const {
238 return view_.find_first_not_of(str, offset);
241 template <
typename OtherTraits>
242 friend constexpr bool operator==(
244 return left.view_ == right.view_;
247#if __has_include(<compare>)
248 template <
typename OtherTraits>
249 friend constexpr auto operator<=>(
251 return left.view_ <=> right.view_;
256 underlying_type view_;