34#ifndef _GLIBCXX_STRING_VIEW_TCC
35#define _GLIBCXX_STRING_VIEW_TCC 1
38#pragma GCC system_header
41#if __cplusplus >= 201703L
43namespace std _GLIBCXX_VISIBILITY(default)
45_GLIBCXX_BEGIN_NAMESPACE_VERSION
47 template<
typename _CharT,
typename _Traits>
48 constexpr typename basic_string_view<_CharT, _Traits>::size_type
49 basic_string_view<_CharT, _Traits>::
50 find(
const _CharT* __str, size_type __pos, size_type __n)
const noexcept
52 __glibcxx_requires_string_len(__str, __n);
55 return __pos <= _M_len ? __pos : npos;
59 const _CharT __elem0 = __str[0];
60 const _CharT* __first = _M_str + __pos;
61 const _CharT*
const __last = _M_str + _M_len;
62 size_type __len = _M_len - __pos;
67 __first = traits_type::find(__first, __len - __n + 1, __elem0);
73 if (traits_type::compare(__first, __str, __n) == 0)
74 return __first - _M_str;
75 __len = __last - ++__first;
80 template<
typename _CharT,
typename _Traits>
81 constexpr typename basic_string_view<_CharT, _Traits>::size_type
82 basic_string_view<_CharT, _Traits>::
83 find(_CharT __c, size_type __pos)
const noexcept
85 size_type __ret = npos;
86 if (__pos < this->_M_len)
88 const size_type __n = this->_M_len - __pos;
89 const _CharT* __p = traits_type::find(this->_M_str + __pos, __n, __c);
91 __ret = __p - this->_M_str;
96 template<
typename _CharT,
typename _Traits>
97 constexpr typename basic_string_view<_CharT, _Traits>::size_type
98 basic_string_view<_CharT, _Traits>::
99 rfind(
const _CharT* __str, size_type __pos, size_type __n)
const noexcept
101 __glibcxx_requires_string_len(__str, __n);
103 if (__n <= this->_M_len)
105 __pos =
std::min(size_type(this->_M_len - __n), __pos);
108 if (traits_type::compare(this->_M_str + __pos, __str, __n) == 0)
116 template<
typename _CharT,
typename _Traits>
117 constexpr typename basic_string_view<_CharT, _Traits>::size_type
118 basic_string_view<_CharT, _Traits>::
119 rfind(_CharT __c, size_type __pos)
const noexcept
121 size_type __size = this->_M_len;
124 if (--__size > __pos)
126 for (++__size; __size-- > 0; )
127 if (traits_type::eq(this->_M_str[__size], __c))
133 template<
typename _CharT,
typename _Traits>
134 constexpr typename basic_string_view<_CharT, _Traits>::size_type
135 basic_string_view<_CharT, _Traits>::
136 find_first_of(
const _CharT* __str, size_type __pos,
137 size_type __n)
const noexcept
139 __glibcxx_requires_string_len(__str, __n);
140 for (; __n && __pos < this->_M_len; ++__pos)
142 const _CharT* __p = traits_type::find(__str, __n,
143 this->_M_str[__pos]);
150 template<
typename _CharT,
typename _Traits>
151 constexpr typename basic_string_view<_CharT, _Traits>::size_type
152 basic_string_view<_CharT, _Traits>::
153 find_last_of(
const _CharT* __str, size_type __pos,
154 size_type __n)
const noexcept
156 __glibcxx_requires_string_len(__str, __n);
157 size_type __size = this->
size();
160 if (--__size > __pos)
164 if (traits_type::find(__str, __n, this->_M_str[__size]))
167 while (__size-- != 0);
172 template<
typename _CharT,
typename _Traits>
173 constexpr typename basic_string_view<_CharT, _Traits>::size_type
174 basic_string_view<_CharT, _Traits>::
175 find_first_not_of(
const _CharT* __str, size_type __pos,
176 size_type __n)
const noexcept
178 __glibcxx_requires_string_len(__str, __n);
179 for (; __pos < this->_M_len; ++__pos)
180 if (!traits_type::find(__str, __n, this->_M_str[__pos]))
185 template<
typename _CharT,
typename _Traits>
186 constexpr typename basic_string_view<_CharT, _Traits>::size_type
187 basic_string_view<_CharT, _Traits>::
188 find_first_not_of(_CharT __c, size_type __pos)
const noexcept
190 for (; __pos < this->_M_len; ++__pos)
191 if (!traits_type::eq(this->_M_str[__pos], __c))
196 template<
typename _CharT,
typename _Traits>
197 constexpr typename basic_string_view<_CharT, _Traits>::size_type
198 basic_string_view<_CharT, _Traits>::
199 find_last_not_of(
const _CharT* __str, size_type __pos,
200 size_type __n)
const noexcept
202 __glibcxx_requires_string_len(__str, __n);
203 size_type __size = this->_M_len;
206 if (--__size > __pos)
210 if (!traits_type::find(__str, __n, this->_M_str[__size]))
218 template<
typename _CharT,
typename _Traits>
219 constexpr typename basic_string_view<_CharT, _Traits>::size_type
220 basic_string_view<_CharT, _Traits>::
221 find_last_not_of(_CharT __c, size_type __pos)
const noexcept
223 size_type __size = this->_M_len;
226 if (--__size > __pos)
230 if (!traits_type::eq(this->_M_str[__size], __c))
238_GLIBCXX_END_NAMESPACE_VERSION
constexpr const _Tp & min(const _Tp &, const _Tp &)
This does what you think it does.
ISO C++ entities toplevel namespace is std.
constexpr auto size(const _Container &__cont) noexcept(noexcept(__cont.size())) -> decltype(__cont.size())
Return the size of a container.