30 #ifndef _VSTRING_UTIL_H 31 #define _VSTRING_UTIL_H 1 33 #pragma GCC system_header 46 namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
48 _GLIBCXX_BEGIN_NAMESPACE_VERSION
50 template<
typename _CharT,
typename _Traits,
typename _Alloc>
51 struct __vstring_utility
53 typedef typename _Alloc::template rebind<_CharT>::other _CharT_alloc_type;
55 typedef _Traits traits_type;
56 typedef typename _Traits::char_type value_type;
57 typedef typename _CharT_alloc_type::size_type size_type;
58 typedef typename _CharT_alloc_type::difference_type difference_type;
59 typedef typename _CharT_alloc_type::pointer pointer;
60 typedef typename _CharT_alloc_type::const_pointer const_pointer;
88 template<
typename _Alloc1>
92 _Alloc_hider(_CharT* __ptr)
93 : _Alloc1(), _M_p(__ptr) { }
95 _Alloc_hider(
const _Alloc1& __a, _CharT* __ptr)
96 : _Alloc1(__a), _M_p(__ptr) { }
104 _S_copy(_CharT* __d,
const _CharT* __s, size_type __n)
107 traits_type::assign(*__d, *__s);
109 traits_type::copy(__d, __s, __n);
113 _S_move(_CharT* __d,
const _CharT* __s, size_type __n)
116 traits_type::assign(*__d, *__s);
118 traits_type::move(__d, __s, __n);
122 _S_assign(_CharT* __d, size_type __n, _CharT __c)
125 traits_type::assign(*__d, __c);
127 traits_type::assign(__d, __n, __c);
132 template<
typename _Iterator>
134 _S_copy_chars(_CharT* __p, _Iterator __k1, _Iterator __k2)
136 for (; __k1 != __k2; ++__k1, ++__p)
137 traits_type::assign(*__p, *__k1);
141 _S_copy_chars(_CharT* __p, __sso_iterator __k1, __sso_iterator __k2)
142 { _S_copy_chars(__p, __k1.base(), __k2.base()); }
145 _S_copy_chars(_CharT* __p, __const_sso_iterator __k1,
146 __const_sso_iterator __k2)
147 { _S_copy_chars(__p, __k1.base(), __k2.base()); }
150 _S_copy_chars(_CharT* __p, __rc_iterator __k1, __rc_iterator __k2)
151 { _S_copy_chars(__p, __k1.base(), __k2.base()); }
154 _S_copy_chars(_CharT* __p, __const_rc_iterator __k1,
155 __const_rc_iterator __k2)
156 { _S_copy_chars(__p, __k1.base(), __k2.base()); }
159 _S_copy_chars(_CharT* __p, _CharT* __k1, _CharT* __k2)
160 { _S_copy(__p, __k1, __k2 - __k1); }
163 _S_copy_chars(_CharT* __p,
const _CharT* __k1,
const _CharT* __k2)
164 { _S_copy(__p, __k1, __k2 - __k1); }
167 _S_compare(size_type __n1, size_type __n2)
169 const difference_type __d = difference_type(__n1 - __n2);
171 if (__d > __numeric_traits_integer<int>::__max)
172 return __numeric_traits_integer<int>::__max;
173 else if (__d < __numeric_traits_integer<int>::__min)
174 return __numeric_traits_integer<int>::__min;
180 _GLIBCXX_END_NAMESPACE_VERSION
GNU extensions for public use.
Template class __versa_string.Data structure managing sequences of characters and character-like obje...