34 #ifndef _GLIBCXX_STRING_VIEW_TCC
35 #define _GLIBCXX_STRING_VIEW_TCC 1
37 #pragma GCC system_header
39 #if __cplusplus >= 201703L
41 namespace std _GLIBCXX_VISIBILITY(default)
43 _GLIBCXX_BEGIN_NAMESPACE_VERSION
45 template<
typename _CharT,
typename _Traits>
46 constexpr
typename basic_string_view<_CharT, _Traits>::size_type
47 basic_string_view<_CharT, _Traits>::
48 find(
const _CharT* __str, size_type __pos, size_type __n)
const noexcept
50 __glibcxx_requires_string_len(__str, __n);
53 return __pos <= this->_M_len ? __pos : npos;
55 if (__n <= this->_M_len)
57 for (; __pos <= this->_M_len - __n; ++__pos)
58 if (traits_type::eq(this->_M_str[__pos], __str[0])
59 && traits_type::compare(this->_M_str + __pos + 1,
60 __str + 1, __n - 1) == 0)
66 template<
typename _CharT,
typename _Traits>
67 constexpr
typename basic_string_view<_CharT, _Traits>::size_type
68 basic_string_view<_CharT, _Traits>::
69 find(_CharT __c, size_type __pos)
const noexcept
71 size_type __ret = npos;
72 if (__pos < this->_M_len)
74 const size_type __n = this->_M_len - __pos;
75 const _CharT* __p = traits_type::find(this->_M_str + __pos, __n, __c);
77 __ret = __p - this->_M_str;
82 template<
typename _CharT,
typename _Traits>
83 constexpr
typename basic_string_view<_CharT, _Traits>::size_type
84 basic_string_view<_CharT, _Traits>::
85 rfind(
const _CharT* __str, size_type __pos, size_type __n)
const noexcept
87 __glibcxx_requires_string_len(__str, __n);
89 if (__n <= this->_M_len)
91 __pos =
std::min(size_type(this->_M_len - __n), __pos);
94 if (traits_type::compare(this->_M_str + __pos, __str, __n) == 0)
102 template<
typename _CharT,
typename _Traits>
103 constexpr
typename basic_string_view<_CharT, _Traits>::size_type
104 basic_string_view<_CharT, _Traits>::
105 rfind(_CharT __c, size_type __pos)
const noexcept
107 size_type __size = this->_M_len;
110 if (--__size > __pos)
112 for (++__size; __size-- > 0; )
113 if (traits_type::eq(this->_M_str[__size], __c))
119 template<
typename _CharT,
typename _Traits>
120 constexpr
typename basic_string_view<_CharT, _Traits>::size_type
121 basic_string_view<_CharT, _Traits>::
122 find_first_of(
const _CharT* __str, size_type __pos,
123 size_type __n)
const noexcept
125 __glibcxx_requires_string_len(__str, __n);
126 for (; __n && __pos < this->_M_len; ++__pos)
128 const _CharT* __p = traits_type::find(__str, __n,
129 this->_M_str[__pos]);
136 template<
typename _CharT,
typename _Traits>
137 constexpr
typename basic_string_view<_CharT, _Traits>::size_type
138 basic_string_view<_CharT, _Traits>::
139 find_last_of(
const _CharT* __str, size_type __pos,
140 size_type __n)
const noexcept
142 __glibcxx_requires_string_len(__str, __n);
143 size_type __size = this->size();
146 if (--__size > __pos)
150 if (traits_type::find(__str, __n, this->_M_str[__size]))
153 while (__size-- != 0);
158 template<
typename _CharT,
typename _Traits>
159 constexpr
typename basic_string_view<_CharT, _Traits>::size_type
160 basic_string_view<_CharT, _Traits>::
161 find_first_not_of(
const _CharT* __str, size_type __pos,
162 size_type __n)
const noexcept
164 __glibcxx_requires_string_len(__str, __n);
165 for (; __pos < this->_M_len; ++__pos)
166 if (!traits_type::find(__str, __n, this->_M_str[__pos]))
171 template<
typename _CharT,
typename _Traits>
172 constexpr
typename basic_string_view<_CharT, _Traits>::size_type
173 basic_string_view<_CharT, _Traits>::
174 find_first_not_of(_CharT __c, size_type __pos)
const noexcept
176 for (; __pos < this->_M_len; ++__pos)
177 if (!traits_type::eq(this->_M_str[__pos], __c))
182 template<
typename _CharT,
typename _Traits>
183 constexpr
typename basic_string_view<_CharT, _Traits>::size_type
184 basic_string_view<_CharT, _Traits>::
185 find_last_not_of(
const _CharT* __str, size_type __pos,
186 size_type __n)
const noexcept
188 __glibcxx_requires_string_len(__str, __n);
189 size_type __size = this->_M_len;
192 if (--__size > __pos)
196 if (!traits_type::find(__str, __n, this->_M_str[__size]))
204 template<
typename _CharT,
typename _Traits>
205 constexpr
typename basic_string_view<_CharT, _Traits>::size_type
206 basic_string_view<_CharT, _Traits>::
207 find_last_not_of(_CharT __c, size_type __pos)
const noexcept
209 size_type __size = this->_M_len;
212 if (--__size > __pos)
216 if (!traits_type::eq(this->_M_str[__size], __c))
224 _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.