34 #ifndef _GLIBCXX_EXPERIMENTAL_STRING_VIEW_TCC
35 #define _GLIBCXX_EXPERIMENTAL_STRING_VIEW_TCC 1
37 #pragma GCC system_header
39 #if __cplusplus >= 201402L
41 namespace std _GLIBCXX_VISIBILITY(default)
43 _GLIBCXX_BEGIN_NAMESPACE_VERSION
45 namespace experimental
47 inline namespace fundamentals_v1
49 template<
typename _CharT,
typename _Traits>
50 constexpr
typename basic_string_view<_CharT, _Traits>::size_type
51 basic_string_view<_CharT, _Traits>::
52 find(
const _CharT* __str, size_type __pos, size_type __n)
const noexcept
54 __glibcxx_requires_string_len(__str, __n);
57 return __pos <= this->_M_len ? __pos : npos;
59 if (__n <= this->_M_len)
61 for (; __pos <= this->_M_len - __n; ++__pos)
62 if (traits_type::eq(this->_M_str[__pos], __str[0])
63 && traits_type::compare(this->_M_str + __pos + 1,
64 __str + 1, __n - 1) == 0)
70 template<
typename _CharT,
typename _Traits>
71 constexpr
typename basic_string_view<_CharT, _Traits>::size_type
72 basic_string_view<_CharT, _Traits>::
73 find(_CharT __c, size_type __pos)
const noexcept
75 size_type __ret = npos;
76 if (__pos < this->_M_len)
78 const size_type __n = this->_M_len - __pos;
79 const _CharT* __p = traits_type::find(this->_M_str + __pos, __n, __c);
81 __ret = __p - this->_M_str;
86 template<
typename _CharT,
typename _Traits>
87 constexpr
typename basic_string_view<_CharT, _Traits>::size_type
88 basic_string_view<_CharT, _Traits>::
89 rfind(
const _CharT* __str, size_type __pos, size_type __n)
const noexcept
91 __glibcxx_requires_string_len(__str, __n);
93 if (__n <= this->_M_len)
95 __pos =
std::min(size_type(this->_M_len - __n), __pos);
98 if (traits_type::compare(this->_M_str + __pos, __str, __n) == 0)
106 template<
typename _CharT,
typename _Traits>
107 constexpr
typename basic_string_view<_CharT, _Traits>::size_type
108 basic_string_view<_CharT, _Traits>::
109 rfind(_CharT __c, size_type __pos)
const noexcept
111 size_type __size = this->_M_len;
114 if (--__size > __pos)
116 for (++__size; __size-- > 0; )
117 if (traits_type::eq(this->_M_str[__size], __c))
123 template<
typename _CharT,
typename _Traits>
124 constexpr
typename basic_string_view<_CharT, _Traits>::size_type
125 basic_string_view<_CharT, _Traits>::
126 find_first_of(
const _CharT* __str, size_type __pos, size_type __n)
const
128 __glibcxx_requires_string_len(__str, __n);
129 for (; __n && __pos < this->_M_len; ++__pos)
131 const _CharT* __p = traits_type::find(__str, __n,
132 this->_M_str[__pos]);
139 template<
typename _CharT,
typename _Traits>
140 constexpr
typename basic_string_view<_CharT, _Traits>::size_type
141 basic_string_view<_CharT, _Traits>::
142 find_last_of(
const _CharT* __str, size_type __pos, size_type __n)
const
144 __glibcxx_requires_string_len(__str, __n);
145 size_type __size = this->
size();
148 if (--__size > __pos)
152 if (traits_type::find(__str, __n, this->_M_str[__size]))
155 while (__size-- != 0);
160 template<
typename _CharT,
typename _Traits>
161 constexpr
typename basic_string_view<_CharT, _Traits>::size_type
162 basic_string_view<_CharT, _Traits>::
163 find_first_not_of(
const _CharT* __str, size_type __pos, size_type __n)
const
165 __glibcxx_requires_string_len(__str, __n);
166 for (; __pos < this->_M_len; ++__pos)
167 if (!traits_type::find(__str, __n, this->_M_str[__pos]))
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(_CharT __c, size_type __pos)
const noexcept
177 for (; __pos < this->_M_len; ++__pos)
178 if (!traits_type::eq(this->_M_str[__pos], __c))
183 template<
typename _CharT,
typename _Traits>
184 constexpr
typename basic_string_view<_CharT, _Traits>::size_type
185 basic_string_view<_CharT, _Traits>::
186 find_last_not_of(
const _CharT* __str, size_type __pos, size_type __n)
const
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))
226 _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.