34 #ifndef _GLIBCXX_EXPERIMENTAL_STRING_VIEW_TCC 35 #define _GLIBCXX_EXPERIMENTAL_STRING_VIEW_TCC 1 37 #pragma GCC system_header 39 #if __cplusplus <= 201103L 43 namespace std _GLIBCXX_VISIBILITY(default)
45 namespace experimental
47 inline namespace fundamentals_v1
49 _GLIBCXX_BEGIN_NAMESPACE_VERSION
51 template<
typename _CharT,
typename _Traits>
52 typename basic_string_view<_CharT, _Traits>::size_type
53 basic_string_view<_CharT, _Traits>::
54 find(
const _CharT* __str, size_type __pos, size_type __n)
const noexcept
56 __glibcxx_requires_string_len(__str, __n);
59 return __pos <= this->_M_len ? __pos : npos;
61 if (__n <= this->_M_len)
63 for (; __pos <= this->_M_len - __n; ++__pos)
64 if (traits_type::eq(this->_M_str[__pos], __str[0])
65 && traits_type::compare(this->_M_str + __pos + 1,
66 __str + 1, __n - 1) == 0)
72 template<
typename _CharT,
typename _Traits>
73 typename basic_string_view<_CharT, _Traits>::size_type
74 basic_string_view<_CharT, _Traits>::
75 find(_CharT __c, size_type __pos)
const noexcept
77 size_type __ret = npos;
78 if (__pos < this->_M_len)
80 const size_type __n = this->_M_len - __pos;
81 const _CharT* __p = traits_type::find(this->_M_str + __pos, __n, __c);
83 __ret = __p - this->_M_str;
88 template<
typename _CharT,
typename _Traits>
89 typename basic_string_view<_CharT, _Traits>::size_type
90 basic_string_view<_CharT, _Traits>::
91 rfind(
const _CharT* __str, size_type __pos, size_type __n)
const noexcept
93 __glibcxx_requires_string_len(__str, __n);
95 if (__n <= this->_M_len)
97 __pos =
std::min(size_type(this->_M_len - __n), __pos);
100 if (traits_type::compare(this->_M_str + __pos, __str, __n) == 0)
108 template<
typename _CharT,
typename _Traits>
109 typename basic_string_view<_CharT, _Traits>::size_type
110 basic_string_view<_CharT, _Traits>::
111 rfind(_CharT __c, size_type __pos)
const noexcept
113 size_type __size = this->_M_len;
116 if (--__size > __pos)
118 for (++__size; __size-- > 0; )
119 if (traits_type::eq(this->_M_str[__size], __c))
125 template<
typename _CharT,
typename _Traits>
126 typename basic_string_view<_CharT, _Traits>::size_type
127 basic_string_view<_CharT, _Traits>::
128 find_first_of(
const _CharT* __str, size_type __pos, size_type __n)
const 130 __glibcxx_requires_string_len(__str, __n);
131 for (; __n && __pos < this->_M_len; ++__pos)
133 const _CharT* __p = traits_type::find(__str, __n,
134 this->_M_str[__pos]);
141 template<
typename _CharT,
typename _Traits>
142 typename basic_string_view<_CharT, _Traits>::size_type
143 basic_string_view<_CharT, _Traits>::
144 find_last_of(
const _CharT* __str, size_type __pos, size_type __n)
const 146 __glibcxx_requires_string_len(__str, __n);
147 size_type __size = this->size();
150 if (--__size > __pos)
154 if (traits_type::find(__str, __n, this->_M_str[__size]))
157 while (__size-- != 0);
162 template<
typename _CharT,
typename _Traits>
163 typename basic_string_view<_CharT, _Traits>::size_type
164 basic_string_view<_CharT, _Traits>::
165 find_first_not_of(
const _CharT* __str, size_type __pos, size_type __n)
const 167 __glibcxx_requires_string_len(__str, __n);
168 for (; __pos < this->_M_len; ++__pos)
169 if (!traits_type::find(__str, __n, this->_M_str[__pos]))
174 template<
typename _CharT,
typename _Traits>
175 typename basic_string_view<_CharT, _Traits>::size_type
176 basic_string_view<_CharT, _Traits>::
177 find_first_not_of(_CharT __c, size_type __pos)
const noexcept
179 for (; __pos < this->_M_len; ++__pos)
180 if (!traits_type::eq(this->_M_str[__pos], __c))
185 template<
typename _CharT,
typename _Traits>
186 typename basic_string_view<_CharT, _Traits>::size_type
187 basic_string_view<_CharT, _Traits>::
188 find_last_not_of(
const _CharT* __str, size_type __pos, size_type __n)
const 190 __glibcxx_requires_string_len(__str, __n);
191 size_type __size = this->_M_len;
194 if (--__size > __pos)
198 if (!traits_type::find(__str, __n, this->_M_str[__size]))
206 template<
typename _CharT,
typename _Traits>
207 typename basic_string_view<_CharT, _Traits>::size_type
208 basic_string_view<_CharT, _Traits>::
209 find_last_not_of(_CharT __c, size_type __pos)
const noexcept
211 size_type __size = this->_M_len;
214 if (--__size > __pos)
218 if (!traits_type::eq(this->_M_str[__size], __c))
226 _GLIBCXX_END_NAMESPACE_VERSION
231 #endif // __cplusplus <= 201103L 233 #endif // _GLIBCXX_EXPERIMENTAL_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.