34 #ifndef _GLIBCXX_STRING_VIEW_TCC 35 #define _GLIBCXX_STRING_VIEW_TCC 1 37 #pragma GCC system_header 39 #if __cplusplus <= 201402L 43 namespace std _GLIBCXX_VISIBILITY(default)
45 _GLIBCXX_BEGIN_NAMESPACE_VERSION
47 template<
typename _CharT,
typename _Traits>
48 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 <= this->_M_len ? __pos : npos;
57 if (__n <= this->_M_len)
59 for (; __pos <= this->_M_len - __n; ++__pos)
60 if (traits_type::eq(this->_M_str[__pos], __str[0])
61 && traits_type::compare(this->_M_str + __pos + 1,
62 __str + 1, __n - 1) == 0)
68 template<
typename _CharT,
typename _Traits>
69 typename basic_string_view<_CharT, _Traits>::size_type
70 basic_string_view<_CharT, _Traits>::
71 find(_CharT __c, size_type __pos)
const noexcept
73 size_type __ret = npos;
74 if (__pos < this->_M_len)
76 const size_type __n = this->_M_len - __pos;
77 const _CharT* __p = traits_type::find(this->_M_str + __pos, __n, __c);
79 __ret = __p - this->_M_str;
84 template<
typename _CharT,
typename _Traits>
85 typename basic_string_view<_CharT, _Traits>::size_type
86 basic_string_view<_CharT, _Traits>::
87 rfind(
const _CharT* __str, size_type __pos, size_type __n)
const noexcept
89 __glibcxx_requires_string_len(__str, __n);
91 if (__n <= this->_M_len)
93 __pos =
std::min(size_type(this->_M_len - __n), __pos);
96 if (traits_type::compare(this->_M_str + __pos, __str, __n) == 0)
104 template<
typename _CharT,
typename _Traits>
105 typename basic_string_view<_CharT, _Traits>::size_type
106 basic_string_view<_CharT, _Traits>::
107 rfind(_CharT __c, size_type __pos)
const noexcept
109 size_type __size = this->_M_len;
112 if (--__size > __pos)
114 for (++__size; __size-- > 0; )
115 if (traits_type::eq(this->_M_str[__size], __c))
121 template<
typename _CharT,
typename _Traits>
122 typename basic_string_view<_CharT, _Traits>::size_type
123 basic_string_view<_CharT, _Traits>::
124 find_first_of(
const _CharT* __str, size_type __pos, size_type __n)
const 126 __glibcxx_requires_string_len(__str, __n);
127 for (; __n && __pos < this->_M_len; ++__pos)
129 const _CharT* __p = traits_type::find(__str, __n,
130 this->_M_str[__pos]);
137 template<
typename _CharT,
typename _Traits>
138 typename basic_string_view<_CharT, _Traits>::size_type
139 basic_string_view<_CharT, _Traits>::
140 find_last_of(
const _CharT* __str, size_type __pos, size_type __n)
const 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 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, size_type __n)
const 163 __glibcxx_requires_string_len(__str, __n);
164 for (; __pos < this->_M_len; ++__pos)
165 if (!traits_type::find(__str, __n, this->_M_str[__pos]))
170 template<
typename _CharT,
typename _Traits>
171 typename basic_string_view<_CharT, _Traits>::size_type
172 basic_string_view<_CharT, _Traits>::
173 find_first_not_of(_CharT __c, size_type __pos)
const noexcept
175 for (; __pos < this->_M_len; ++__pos)
176 if (!traits_type::eq(this->_M_str[__pos], __c))
181 template<
typename _CharT,
typename _Traits>
182 typename basic_string_view<_CharT, _Traits>::size_type
183 basic_string_view<_CharT, _Traits>::
184 find_last_not_of(
const _CharT* __str, size_type __pos, size_type __n)
const 186 __glibcxx_requires_string_len(__str, __n);
187 size_type __size = this->_M_len;
190 if (--__size > __pos)
194 if (!traits_type::find(__str, __n, this->_M_str[__size]))
202 template<
typename _CharT,
typename _Traits>
203 typename basic_string_view<_CharT, _Traits>::size_type
204 basic_string_view<_CharT, _Traits>::
205 find_last_not_of(_CharT __c, size_type __pos)
const noexcept
207 size_type __size = this->_M_len;
210 if (--__size > __pos)
214 if (!traits_type::eq(this->_M_str[__size], __c))
222 _GLIBCXX_END_NAMESPACE_VERSION
225 #endif // __cplusplus <= 201402L 227 #endif // _GLIBCXX_STRING_VIEW_TCC ISO C++ entities toplevel namespace is std.
_GLIBCXX14_CONSTEXPR const _Tp & min(const _Tp &, const _Tp &)
This does what you think it does.