34#ifndef _GLIBCXX_STRING_VIEW_TCC
35#define _GLIBCXX_STRING_VIEW_TCC 1
37#pragma GCC system_header
39#if __cplusplus >= 201703L
41namespace 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
50 __glibcxx_requires_string_len(__str, __n);
53 return __pos <= _M_len ? __pos : npos;
57 const _CharT __elem0 = __str[0];
58 const _CharT* __first = _M_str + __pos;
59 const _CharT*
const __last = _M_str + _M_len;
65 __first = traits_type::find(__first, __len - __n + 1, __elem0);
71 if (traits_type::compare(__first, __str, __n) == 0)
72 return __first - _M_str;
73 __len = __last - ++__first;
78 template<
typename _CharT,
typename _Traits>
79 constexpr typename basic_string_view<_CharT, _Traits>::size_type
84 if (__pos < this->_M_len)
86 const size_type __n = this->_M_len - __pos;
87 const _CharT* __p = traits_type::find(this->_M_str + __pos, __n, __c);
89 __ret = __p - this->_M_str;
94 template<
typename _CharT,
typename _Traits>
95 constexpr typename basic_string_view<_CharT, _Traits>::size_type
99 __glibcxx_requires_string_len(__str, __n);
101 if (__n <= this->_M_len)
106 if (traits_type::compare(this->_M_str + __pos, __str, __n) == 0)
114 template<
typename _CharT,
typename _Traits>
115 constexpr typename basic_string_view<_CharT, _Traits>::size_type
122 if (--__size > __pos)
124 for (++__size; __size-- > 0; )
125 if (traits_type::eq(this->_M_str[__size], __c))
131 template<
typename _CharT,
typename _Traits>
132 constexpr typename basic_string_view<_CharT, _Traits>::size_type
137 __glibcxx_requires_string_len(__str, __n);
138 for (; __n && __pos < this->_M_len; ++__pos)
140 const _CharT* __p = traits_type::find(__str, __n,
141 this->_M_str[__pos]);
148 template<
typename _CharT,
typename _Traits>
149 constexpr typename basic_string_view<_CharT, _Traits>::size_type
154 __glibcxx_requires_string_len(__str, __n);
158 if (--__size > __pos)
162 if (traits_type::find(__str, __n, this->_M_str[__size]))
165 while (__size-- != 0);
170 template<
typename _CharT,
typename _Traits>
171 constexpr typename basic_string_view<_CharT, _Traits>::size_type
176 __glibcxx_requires_string_len(__str, __n);
177 for (; __pos < this->_M_len; ++__pos)
178 if (!traits_type::find(__str, __n, this->_M_str[__pos]))
183 template<
typename _CharT,
typename _Traits>
184 constexpr typename basic_string_view<_CharT, _Traits>::size_type
188 for (; __pos < this->_M_len; ++__pos)
189 if (!traits_type::eq(this->_M_str[__pos], __c))
194 template<
typename _CharT,
typename _Traits>
195 constexpr typename basic_string_view<_CharT, _Traits>::size_type
200 __glibcxx_requires_string_len(__str, __n);
204 if (--__size > __pos)
208 if (!traits_type::find(__str, __n, this->_M_str[__size]))
216 template<
typename _CharT,
typename _Traits>
217 constexpr typename basic_string_view<_CharT, _Traits>::size_type
224 if (--__size > __pos)
228 if (!traits_type::eq(this->_M_str[__size], __c))
236_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.
A non-owning reference to a string.