32 #pragma GCC system_header
34 #if __cplusplus >= 201103L
35 #include <initializer_list>
42 namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
44 _GLIBCXX_BEGIN_NAMESPACE_VERSION
54 template<
typename _CharT,
typename _Traits,
typename _Alloc,
55 template <
typename,
typename,
typename>
class _Base>
57 :
private _Base<_CharT, _Traits, _Alloc>
59 typedef _Base<_CharT, _Traits, _Alloc> __vstring_base;
60 typedef typename __vstring_base::_CharT_alloc_type _CharT_alloc_type;
64 typedef _Traits traits_type;
65 typedef typename _Traits::char_type value_type;
66 typedef _Alloc allocator_type;
67 typedef typename _CharT_alloc_type::size_type size_type;
68 typedef typename _CharT_alloc_type::difference_type difference_type;
69 typedef value_type& reference;
70 typedef const value_type& const_reference;
71 typedef typename _CharT_alloc_type::pointer pointer;
72 typedef typename _CharT_alloc_type::const_pointer const_pointer;
73 typedef __gnu_cxx::__normal_iterator<pointer, __versa_string> iterator;
74 typedef __gnu_cxx::__normal_iterator<const_pointer, __versa_string>
81 static const size_type
npos =
static_cast<size_type
>(-1);
85 _M_check(size_type __pos,
const char* __s)
const
87 if (__pos > this->
size())
88 std::__throw_out_of_range(__N(__s));
93 _M_check_length(size_type __n1, size_type __n2,
const char* __s)
const
96 std::__throw_length_error(__N(__s));
101 _M_limit(size_type __pos, size_type __off)
const
103 const bool __testoff = __off < this->
size() - __pos;
104 return __testoff ? __off : this->
size() - __pos;
109 _M_disjunct(
const _CharT* __s)
const
113 + this->
size(), __s));
120 {
return iterator(this->_M_data()); }
124 {
return iterator(this->_M_data() + this->_M_length()); }
135 : __vstring_base() { }
142 : __vstring_base(__a) { }
150 : __vstring_base(__str) { }
152 #if __cplusplus >= 201103L
162 : __vstring_base(
std::
move(__str)) { }
170 const _Alloc& __a = _Alloc())
171 : __vstring_base(__l.
begin(), __l.
end(), __a) { }
181 size_type __n = npos)
182 : __vstring_base(__str._M_data()
183 + __str._M_check(__pos,
184 "__versa_string::__versa_string"),
185 __str._M_data() + __str._M_limit(__pos, __n)
186 + __pos, _Alloc()) { }
196 size_type __n,
const _Alloc& __a)
197 : __vstring_base(__str._M_data()
198 + __str._M_check(__pos,
199 "__versa_string::__versa_string"),
200 __str._M_data() + __str._M_limit(__pos, __n)
213 const _Alloc& __a = _Alloc())
214 : __vstring_base(__s, __s + __n, __a) { }
222 : __vstring_base(__s, __s ? __s + traits_type::
length(__s) :
232 : __vstring_base(__n, __c, __a) { }
240 #if __cplusplus >= 201103L
241 template<
class _InputIterator,
242 typename = std::_RequireInputIter<_InputIterator>>
244 template<
class _InputIterator>
247 const _Alloc& __a = _Alloc())
248 : __vstring_base(__beg, __end, __a) { }
261 {
return this->
assign(__str); }
263 #if __cplusplus >= 201103L
286 this->
assign(__l.begin(), __l.end());
297 {
return this->
assign(__s); }
322 return iterator(this->_M_data());
331 {
return const_iterator(this->_M_data()); }
341 return iterator(this->_M_data() + this->
size());
349 end() const _GLIBCXX_NOEXCEPT
350 {
return const_iterator(this->_M_data() + this->
size()); }
359 {
return reverse_iterator(this->
end()); }
366 const_reverse_iterator
368 {
return const_reverse_iterator(this->
end()); }
377 {
return reverse_iterator(this->
begin()); }
384 const_reverse_iterator
386 {
return const_reverse_iterator(this->
begin()); }
388 #if __cplusplus >= 201103L
395 {
return const_iterator(this->_M_data()); }
403 {
return const_iterator(this->_M_data() + this->
size()); }
410 const_reverse_iterator
412 {
return const_reverse_iterator(this->
end()); }
419 const_reverse_iterator
421 {
return const_reverse_iterator(this->
begin()); }
430 {
return this->_M_length(); }
436 {
return this->_M_length(); }
441 {
return this->_M_max_size(); }
454 resize(size_type __n, _CharT __c);
468 { this->
resize(__n, _CharT()); }
470 #if __cplusplus >= 201103L
491 {
return this->_M_capacity(); }
512 { this->_M_reserve(__res_arg); }
519 { this->_M_clear(); }
527 {
return this->
size() == 0; }
543 _GLIBCXX_DEBUG_ASSERT(__pos <= this->
size());
544 return this->_M_data()[__pos];
561 _GLIBCXX_DEBUG_ASSERT(__pos <= this->
size());
563 _GLIBCXX_DEBUG_PEDASSERT(__pos < this->
size());
565 return this->_M_data()[__pos];
579 at(size_type __n)
const
581 if (__n >= this->
size())
582 std::__throw_out_of_range(__N(
"__versa_string::at"));
583 return this->_M_data()[__n];
600 if (__n >= this->
size())
601 std::__throw_out_of_range(__N(
"__versa_string::at"));
603 return this->_M_data()[__n];
606 #if __cplusplus >= 201103L
648 {
return this->
append(__str); }
657 {
return this->
append(__s); }
671 #if __cplusplus >= 201103L
679 {
return this->
append(__l.begin(), __l.end()); }
689 {
return _M_append(__str._M_data(), __str.
size()); }
706 {
return _M_append(__str._M_data()
707 + __str._M_check(__pos,
"__versa_string::append"),
708 __str._M_limit(__pos, __n)); }
719 __glibcxx_requires_string_len(__s, __n);
720 _M_check_length(size_type(0), __n,
"__versa_string::append");
721 return _M_append(__s, __n);
732 __glibcxx_requires_string(__s);
733 const size_type __n = traits_type::length(__s);
734 _M_check_length(size_type(0), __n,
"__versa_string::append");
735 return _M_append(__s, __n);
748 {
return _M_replace_aux(this->
size(), size_type(0), __n, __c); }
750 #if __cplusplus >= 201103L
757 append(std::initializer_list<_CharT> __l)
758 {
return this->
append(__l.begin(), __l.end()); }
769 #if __cplusplus >= 201103L
770 template<
class _InputIterator,
771 typename = std::_RequireInputIter<_InputIterator>>
773 template<
class _InputIterator>
776 append(_InputIterator __first, _InputIterator __last)
777 {
return this->
replace(_M_iend(), _M_iend(), __first, __last); }
786 const size_type __size = this->
size();
787 if (__size + 1 > this->
capacity() || this->_M_is_shared())
788 this->_M_mutate(__size, size_type(0), 0, size_type(1));
789 traits_type::assign(this->_M_data()[__size], __c);
790 this->_M_set_length(__size + 1);
801 this->_M_assign(__str);
805 #if __cplusplus >= 201103L
837 {
return _M_replace(size_type(0), this->
size(), __str._M_data()
838 + __str._M_check(__pos,
"__versa_string::assign"),
839 __str._M_limit(__pos, __n)); }
855 __glibcxx_requires_string_len(__s, __n);
856 return _M_replace(size_type(0), this->
size(), __s, __n);
871 __glibcxx_requires_string(__s);
872 return _M_replace(size_type(0), this->
size(), __s,
873 traits_type::length(__s));
887 {
return _M_replace_aux(size_type(0), this->
size(), __n, __c); }
898 #if __cplusplus >= 201103L
899 template<
class _InputIterator,
900 typename = std::_RequireInputIter<_InputIterator>>
902 template<
class _InputIterator>
905 assign(_InputIterator __first, _InputIterator __last)
906 {
return this->
replace(_M_ibegin(), _M_iend(), __first, __last); }
908 #if __cplusplus >= 201103L
915 assign(std::initializer_list<_CharT> __l)
916 {
return this->
assign(__l.begin(), __l.end()); }
933 insert(iterator __p, size_type __n, _CharT __c)
934 { this->
replace(__p, __p, __n, __c); }
948 #if __cplusplus >= 201103L
949 template<
class _InputIterator,
950 typename = std::_RequireInputIter<_InputIterator>>
952 template<
class _InputIterator>
955 insert(iterator __p, _InputIterator __beg, _InputIterator __end)
956 { this->
replace(__p, __p, __beg, __end); }
958 #if __cplusplus >= 201103L
966 insert(iterator __p, std::initializer_list<_CharT> __l)
967 { this->
insert(__p, __l.begin(), __l.end()); }
984 {
return this->
replace(__pos1, size_type(0),
985 __str._M_data(), __str.
size()); }
1007 size_type __pos2, size_type __n)
1008 {
return this->
replace(__pos1, size_type(0), __str._M_data()
1009 + __str._M_check(__pos2,
"__versa_string::insert"),
1010 __str._M_limit(__pos2, __n)); }
1029 insert(size_type __pos,
const _CharT* __s, size_type __n)
1030 {
return this->
replace(__pos, size_type(0), __s, __n); }
1050 __glibcxx_requires_string(__s);
1051 return this->
replace(__pos, size_type(0), __s,
1052 traits_type::length(__s));
1072 insert(size_type __pos, size_type __n, _CharT __c)
1073 {
return _M_replace_aux(_M_check(__pos,
"__versa_string::insert"),
1074 size_type(0), __n, __c); }
1092 _GLIBCXX_DEBUG_PEDASSERT(__p >= _M_ibegin() && __p <= _M_iend());
1093 const size_type __pos = __p - _M_ibegin();
1094 _M_replace_aux(__pos, size_type(0), size_type(1), __c);
1095 this->_M_set_leaked();
1096 return iterator(this->_M_data() + __pos);
1115 erase(size_type __pos = 0, size_type __n = npos)
1117 this->_M_erase(_M_check(__pos,
"__versa_string::erase"),
1118 _M_limit(__pos, __n));
1133 _GLIBCXX_DEBUG_PEDASSERT(__position >= _M_ibegin()
1134 && __position < _M_iend());
1135 const size_type __pos = __position - _M_ibegin();
1136 this->_M_erase(__pos, size_type(1));
1137 this->_M_set_leaked();
1138 return iterator(this->_M_data() + __pos);
1152 erase(iterator __first, iterator __last)
1154 _GLIBCXX_DEBUG_PEDASSERT(__first >= _M_ibegin() && __first <= __last
1155 && __last <= _M_iend());
1156 const size_type __pos = __first - _M_ibegin();
1157 this->_M_erase(__pos, __last - __first);
1158 this->_M_set_leaked();
1159 return iterator(this->_M_data() + __pos);
1162 #if __cplusplus >= 201103L
1170 { this->_M_erase(
size()-1, 1); }
1192 {
return this->
replace(__pos, __n, __str._M_data(), __str.
size()); }
1215 size_type __pos2, size_type __n2)
1217 return this->
replace(__pos1, __n1, __str._M_data()
1218 + __str._M_check(__pos2,
1219 "__versa_string::replace"),
1220 __str._M_limit(__pos2, __n2));
1242 replace(size_type __pos, size_type __n1,
const _CharT* __s,
1245 __glibcxx_requires_string_len(__s, __n2);
1246 return _M_replace(_M_check(__pos,
"__versa_string::replace"),
1247 _M_limit(__pos, __n1), __s, __n2);
1266 replace(size_type __pos, size_type __n1,
const _CharT* __s)
1268 __glibcxx_requires_string(__s);
1269 return this->
replace(__pos, __n1, __s, traits_type::length(__s));
1290 replace(size_type __pos, size_type __n1, size_type __n2, _CharT __c)
1291 {
return _M_replace_aux(_M_check(__pos,
"__versa_string::replace"),
1292 _M_limit(__pos, __n1), __n2, __c); }
1309 {
return this->
replace(__i1, __i2, __str._M_data(), __str.
size()); }
1326 replace(iterator __i1, iterator __i2,
const _CharT* __s, size_type __n)
1328 _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
1329 && __i2 <= _M_iend());
1330 return this->
replace(__i1 - _M_ibegin(), __i2 - __i1, __s, __n);
1347 replace(iterator __i1, iterator __i2,
const _CharT* __s)
1349 __glibcxx_requires_string(__s);
1350 return this->
replace(__i1, __i2, __s, traits_type::length(__s));
1368 replace(iterator __i1, iterator __i2, size_type __n, _CharT __c)
1370 _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
1371 && __i2 <= _M_iend());
1372 return _M_replace_aux(__i1 - _M_ibegin(), __i2 - __i1, __n, __c);
1389 #if __cplusplus >= 201103L
1390 template<
class _InputIterator,
1391 typename = std::_RequireInputIter<_InputIterator>>
1394 _InputIterator __k1, _InputIterator __k2)
1396 _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
1397 && __i2 <= _M_iend());
1398 __glibcxx_requires_valid_range(__k1, __k2);
1399 return this->_M_replace_dispatch(__i1, __i2, __k1, __k2,
1400 std::__false_type());
1403 template<
class _InputIterator>
1405 replace(iterator __i1, iterator __i2,
1406 _InputIterator __k1, _InputIterator __k2)
1408 _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
1409 && __i2 <= _M_iend());
1410 __glibcxx_requires_valid_range(__k1, __k2);
1411 typedef typename std::__is_integer<_InputIterator>::__type _Integral;
1412 return this->_M_replace_dispatch(__i1, __i2, __k1, __k2, _Integral());
1419 replace(iterator __i1, iterator __i2, _CharT* __k1, _CharT* __k2)
1421 _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
1422 && __i2 <= _M_iend());
1423 __glibcxx_requires_valid_range(__k1, __k2);
1424 return this->
replace(__i1 - _M_ibegin(), __i2 - __i1,
1429 replace(iterator __i1, iterator __i2,
1430 const _CharT* __k1,
const _CharT* __k2)
1432 _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
1433 && __i2 <= _M_iend());
1434 __glibcxx_requires_valid_range(__k1, __k2);
1435 return this->
replace(__i1 - _M_ibegin(), __i2 - __i1,
1440 replace(iterator __i1, iterator __i2, iterator __k1, iterator __k2)
1442 _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
1443 && __i2 <= _M_iend());
1444 __glibcxx_requires_valid_range(__k1, __k2);
1445 return this->
replace(__i1 - _M_ibegin(), __i2 - __i1,
1446 __k1.base(), __k2 - __k1);
1450 replace(iterator __i1, iterator __i2,
1451 const_iterator __k1, const_iterator __k2)
1453 _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
1454 && __i2 <= _M_iend());
1455 __glibcxx_requires_valid_range(__k1, __k2);
1456 return this->
replace(__i1 - _M_ibegin(), __i2 - __i1,
1457 __k1.base(), __k2 - __k1);
1460 #if __cplusplus >= 201103L
1475 std::initializer_list<_CharT> __l)
1476 {
return this->
replace(__i1, __i2, __l.begin(), __l.end()); }
1480 template<
class _Integer>
1482 _M_replace_dispatch(iterator __i1, iterator __i2, _Integer __n,
1483 _Integer __val, std::__true_type)
1484 {
return _M_replace_aux(__i1 - _M_ibegin(), __i2 - __i1, __n, __val); }
1486 template<
class _InputIterator>
1488 _M_replace_dispatch(iterator __i1, iterator __i2, _InputIterator __k1,
1489 _InputIterator __k2, std::__false_type);
1492 _M_replace_aux(size_type __pos1, size_type __n1, size_type __n2,
1496 _M_replace(size_type __pos, size_type __len1,
const _CharT* __s,
1497 const size_type __len2);
1500 _M_append(
const _CharT* __s, size_type __n);
1517 copy(_CharT* __s, size_type __n, size_type __pos = 0)
const;
1528 { this->_M_swap(__s); }
1539 {
return this->_M_data(); }
1549 {
return this->_M_data(); }
1556 {
return allocator_type(this->_M_get_allocator()); }
1571 find(
const _CharT* __s, size_type __pos, size_type __n)
const;
1586 {
return this->
find(__str.
data(), __pos, __str.
size()); }
1599 find(
const _CharT* __s, size_type __pos = 0)
const
1601 __glibcxx_requires_string(__s);
1602 return this->
find(__s, __pos, traits_type::length(__s));
1616 find(_CharT __c, size_type __pos = 0) const _GLIBCXX_NOEXCEPT;
1631 {
return this->
rfind(__str.data(), __pos, __str.size()); }
1646 rfind(
const _CharT* __s, size_type __pos, size_type __n)
const;
1659 rfind(
const _CharT* __s, size_type __pos = npos)
const
1661 __glibcxx_requires_string(__s);
1662 return this->
rfind(__s, __pos, traits_type::length(__s));
1676 rfind(_CharT __c, size_type __pos = npos) const _GLIBCXX_NOEXCEPT;
1691 {
return this->
find_first_of(__str.data(), __pos, __str.size()); }
1706 find_first_of(
const _CharT* __s, size_type __pos, size_type __n)
const;
1721 __glibcxx_requires_string(__s);
1722 return this->
find_first_of(__s, __pos, traits_type::length(__s));
1739 {
return this->
find(__c, __pos); }
1770 find_last_of(
const _CharT* __s, size_type __pos, size_type __n)
const;
1785 __glibcxx_requires_string(__s);
1786 return this->
find_last_of(__s, __pos, traits_type::length(__s));
1803 {
return this->
rfind(__c, __pos); }
1834 size_type __n)
const;
1849 __glibcxx_requires_string(__s);
1880 size_type __pos = npos) const _GLIBCXX_NOEXCEPT
1897 size_type __n)
const;
1912 __glibcxx_requires_string(__s);
1943 substr(size_type __pos = 0, size_type __n = npos)
const
1945 return __versa_string(*
this, _M_check(__pos,
"__versa_string::substr"),
1966 if (this->_M_compare(__str))
1969 const size_type __size = this->
size();
1970 const size_type __osize = __str.
size();
1971 const size_type __len =
std::min(__size, __osize);
1973 int __r = traits_type::compare(this->_M_data(), __str.
data(), __len);
1975 __r = this->_S_compare(__size, __osize);
1999 compare(size_type __pos, size_type __n,
2027 size_type __pos2, size_type __n2)
const;
2045 compare(
const _CharT* __s)
const;
2069 compare(size_type __pos, size_type __n1,
const _CharT* __s)
const;
2096 compare(size_type __pos, size_type __n1,
const _CharT* __s,
2097 size_type __n2)
const;
2107 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2108 template <
typename,
typename,
typename>
class _Base>
2109 __versa_string<_CharT, _Traits, _Alloc, _Base>
2110 operator+(
const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,
2111 const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs);
2119 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2120 template <
typename,
typename,
typename>
class _Base>
2121 __versa_string<_CharT, _Traits, _Alloc, _Base>
2122 operator+(
const _CharT* __lhs,
2123 const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs);
2131 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2132 template <
typename,
typename,
typename>
class _Base>
2133 __versa_string<_CharT, _Traits, _Alloc, _Base>
2134 operator+(_CharT __lhs,
2135 const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs);
2143 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2144 template <
typename,
typename,
typename>
class _Base>
2145 __versa_string<_CharT, _Traits, _Alloc, _Base>
2146 operator+(
const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,
2147 const _CharT* __rhs);
2155 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2156 template <
typename,
typename,
typename>
class _Base>
2157 __versa_string<_CharT, _Traits, _Alloc, _Base>
2158 operator+(
const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,
2161 #if __cplusplus >= 201103L
2162 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2163 template <
typename,
typename,
typename>
class _Base>
2164 inline __versa_string<_CharT, _Traits, _Alloc, _Base>
2165 operator+(__versa_string<_CharT, _Traits, _Alloc, _Base>&& __lhs,
2166 const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs)
2167 {
return std::move(__lhs.append(__rhs)); }
2169 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2170 template <
typename,
typename,
typename>
class _Base>
2171 inline __versa_string<_CharT, _Traits, _Alloc, _Base>
2172 operator+(
const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,
2173 __versa_string<_CharT, _Traits, _Alloc, _Base>&& __rhs)
2174 {
return std::move(__rhs.insert(0, __lhs)); }
2176 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2177 template <
typename,
typename,
typename>
class _Base>
2178 inline __versa_string<_CharT, _Traits, _Alloc, _Base>
2179 operator+(__versa_string<_CharT, _Traits, _Alloc, _Base>&& __lhs,
2180 __versa_string<_CharT, _Traits, _Alloc, _Base>&& __rhs)
2182 const auto __size = __lhs.size() + __rhs.size();
2183 const bool __cond = (__size > __lhs.capacity()
2184 && __size <= __rhs.capacity());
2185 return __cond ?
std::move(__rhs.insert(0, __lhs))
2189 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2190 template <
typename,
typename,
typename>
class _Base>
2191 inline __versa_string<_CharT, _Traits, _Alloc, _Base>
2193 __versa_string<_CharT, _Traits, _Alloc, _Base>&& __rhs)
2194 {
return std::move(__rhs.insert(0, __lhs)); }
2196 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2197 template <
typename,
typename,
typename>
class _Base>
2198 inline __versa_string<_CharT, _Traits, _Alloc, _Base>
2200 __versa_string<_CharT, _Traits, _Alloc, _Base>&& __rhs)
2201 {
return std::move(__rhs.insert(0, 1, __lhs)); }
2203 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2204 template <
typename,
typename,
typename>
class _Base>
2205 inline __versa_string<_CharT, _Traits, _Alloc, _Base>
2206 operator+(__versa_string<_CharT, _Traits, _Alloc, _Base>&& __lhs,
2207 const _CharT* __rhs)
2208 {
return std::move(__lhs.append(__rhs)); }
2210 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2211 template <
typename,
typename,
typename>
class _Base>
2212 inline __versa_string<_CharT, _Traits, _Alloc, _Base>
2213 operator+(__versa_string<_CharT, _Traits, _Alloc, _Base>&& __lhs,
2215 {
return std::move(__lhs.append(1, __rhs)); }
2225 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2226 template <
typename,
typename,
typename>
class _Base>
2230 {
return __lhs.
compare(__rhs) == 0; }
2232 template<
typename _CharT,
2233 template <
typename,
typename,
typename>
class _Base>
2234 inline typename __enable_if<std::__is_char<_CharT>::__value,
bool>::__type
2239 {
return (__lhs.size() == __rhs.size()
2249 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2250 template <
typename,
typename,
typename>
class _Base>
2252 operator==(
const _CharT* __lhs,
2254 {
return __rhs.
compare(__lhs) == 0; }
2262 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2263 template <
typename,
typename,
typename>
class _Base>
2266 const _CharT* __rhs)
2267 {
return __lhs.
compare(__rhs) == 0; }
2276 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2277 template <
typename,
typename,
typename>
class _Base>
2281 {
return !(__lhs == __rhs); }
2289 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2290 template <
typename,
typename,
typename>
class _Base>
2292 operator!=(
const _CharT* __lhs,
2294 {
return !(__lhs == __rhs); }
2302 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2303 template <
typename,
typename,
typename>
class _Base>
2306 const _CharT* __rhs)
2307 {
return !(__lhs == __rhs); }
2316 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2317 template <
typename,
typename,
typename>
class _Base>
2319 operator<(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,
2321 {
return __lhs.
compare(__rhs) < 0; }
2329 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2330 template <
typename,
typename,
typename>
class _Base>
2332 operator<(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,
2333 const _CharT* __rhs)
2334 {
return __lhs.compare(__rhs) < 0; }
2342 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2343 template <
typename,
typename,
typename>
class _Base>
2345 operator<(
const _CharT* __lhs,
2347 {
return __rhs.
compare(__lhs) > 0; }
2356 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2357 template <
typename,
typename,
typename>
class _Base>
2361 {
return __lhs.
compare(__rhs) > 0; }
2369 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2370 template <
typename,
typename,
typename>
class _Base>
2373 const _CharT* __rhs)
2374 {
return __lhs.
compare(__rhs) > 0; }
2382 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2383 template <
typename,
typename,
typename>
class _Base>
2385 operator>(
const _CharT* __lhs,
2387 {
return __rhs.
compare(__lhs) < 0; }
2396 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2397 template <
typename,
typename,
typename>
class _Base>
2399 operator<=(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,
2401 {
return __lhs.
compare(__rhs) <= 0; }
2409 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2410 template <
typename,
typename,
typename>
class _Base>
2412 operator<=(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,
2413 const _CharT* __rhs)
2414 {
return __lhs.compare(__rhs) <= 0; }
2422 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2423 template <
typename,
typename,
typename>
class _Base>
2425 operator<=(
const _CharT* __lhs,
2427 {
return __rhs.
compare(__lhs) >= 0; }
2436 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2437 template <
typename,
typename,
typename>
class _Base>
2441 {
return __lhs.
compare(__rhs) >= 0; }
2449 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2450 template <
typename,
typename,
typename>
class _Base>
2453 const _CharT* __rhs)
2454 {
return __lhs.
compare(__rhs) >= 0; }
2462 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2463 template <
typename,
typename,
typename>
class _Base>
2465 operator>=(
const _CharT* __lhs,
2467 {
return __rhs.
compare(__lhs) <= 0; }
2476 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2477 template <
typename,
typename,
typename>
class _Base>
2481 { __lhs.
swap(__rhs); }
2483 _GLIBCXX_END_NAMESPACE_VERSION
2486 namespace std _GLIBCXX_VISIBILITY(default)
2488 _GLIBCXX_BEGIN_NAMESPACE_VERSION
2502 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2503 template <
typename,
typename,
typename>
class _Base>
2504 basic_istream<_CharT, _Traits>&
2505 operator>>(basic_istream<_CharT, _Traits>& __is,
2507 _Alloc, _Base>& __str);
2518 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2519 template <
typename,
typename,
typename>
class _Base>
2520 inline basic_ostream<_CharT, _Traits>&
2521 operator<<(basic_ostream<_CharT, _Traits>& __os,
2527 return __ostream_insert(__os, __str.data(), __str.size());
2544 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2545 template <
typename,
typename,
typename>
class _Base>
2546 basic_istream<_CharT, _Traits>&
2547 getline(basic_istream<_CharT, _Traits>& __is,
2564 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2565 template <
typename,
typename,
typename>
class _Base>
2566 inline basic_istream<_CharT, _Traits>&
2569 {
return getline(__is, __str, __is.widen(
'\n')); }
2571 _GLIBCXX_END_NAMESPACE_VERSION
2574 #if ((__cplusplus >= 201103L) && defined(_GLIBCXX_USE_C99))
2578 namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
2580 _GLIBCXX_BEGIN_NAMESPACE_VERSION
2584 stoi(
const __vstring& __str, std::size_t* __idx = 0,
int __base = 10)
2585 {
return __gnu_cxx::__stoa<long, int>(&std::strtol,
"stoi", __str.c_str(),
2589 stol(
const __vstring& __str, std::size_t* __idx = 0,
int __base = 10)
2590 {
return __gnu_cxx::__stoa(&std::strtol,
"stol", __str.c_str(),
2593 inline unsigned long
2594 stoul(
const __vstring& __str, std::size_t* __idx = 0,
int __base = 10)
2595 {
return __gnu_cxx::__stoa(&std::strtoul,
"stoul", __str.c_str(),
2599 stoll(
const __vstring& __str, std::size_t* __idx = 0,
int __base = 10)
2600 {
return __gnu_cxx::__stoa(&std::strtoll,
"stoll", __str.c_str(),
2603 inline unsigned long long
2604 stoull(
const __vstring& __str, std::size_t* __idx,
int __base = 10)
2605 {
return __gnu_cxx::__stoa(&std::strtoull,
"stoull", __str.c_str(),
2610 stof(
const __vstring& __str, std::size_t* __idx = 0)
2611 {
return __gnu_cxx::__stoa(&std::strtof,
"stof", __str.c_str(), __idx); }
2614 stod(
const __vstring& __str, std::size_t* __idx = 0)
2615 {
return __gnu_cxx::__stoa(&std::strtod,
"stod", __str.c_str(), __idx); }
2618 stold(
const __vstring& __str, std::size_t* __idx = 0)
2619 {
return __gnu_cxx::__stoa(&std::strtold,
"stold", __str.c_str(), __idx); }
2625 to_string(
int __val)
2626 {
return __gnu_cxx::__to_xstring<__vstring>(&std::vsnprintf, 4 *
sizeof(int),
2630 to_string(
unsigned __val)
2631 {
return __gnu_cxx::__to_xstring<__vstring>(&std::vsnprintf,
2632 4 *
sizeof(unsigned),
2636 to_string(
long __val)
2637 {
return __gnu_cxx::__to_xstring<__vstring>(&std::vsnprintf,
2642 to_string(
unsigned long __val)
2643 {
return __gnu_cxx::__to_xstring<__vstring>(&std::vsnprintf,
2644 4 *
sizeof(
unsigned long),
2649 to_string(
long long __val)
2650 {
return __gnu_cxx::__to_xstring<__vstring>(&std::vsnprintf,
2651 4 *
sizeof(
long long),
2655 to_string(
unsigned long long __val)
2656 {
return __gnu_cxx::__to_xstring<__vstring>(&std::vsnprintf,
2657 4 *
sizeof(
unsigned long long),
2661 to_string(
float __val)
2663 const int __n = __numeric_traits<float>::__max_exponent10 + 20;
2664 return __gnu_cxx::__to_xstring<__vstring>(&std::vsnprintf, __n,
2669 to_string(
double __val)
2671 const int __n = __numeric_traits<double>::__max_exponent10 + 20;
2672 return __gnu_cxx::__to_xstring<__vstring>(&std::vsnprintf, __n,
2677 to_string(
long double __val)
2679 const int __n = __numeric_traits<long double>::__max_exponent10 + 20;
2680 return __gnu_cxx::__to_xstring<__vstring>(&std::vsnprintf, __n,
2684 #ifdef _GLIBCXX_USE_WCHAR_T
2686 stoi(
const __wvstring& __str, std::size_t* __idx = 0,
int __base = 10)
2687 {
return __gnu_cxx::__stoa<long, int>(&std::wcstol,
"stoi", __str.c_str(),
2691 stol(
const __wvstring& __str, std::size_t* __idx = 0,
int __base = 10)
2692 {
return __gnu_cxx::__stoa(&std::wcstol,
"stol", __str.c_str(),
2695 inline unsigned long
2696 stoul(
const __wvstring& __str, std::size_t* __idx = 0,
int __base = 10)
2697 {
return __gnu_cxx::__stoa(&std::wcstoul,
"stoul", __str.c_str(),
2701 stoll(
const __wvstring& __str, std::size_t* __idx = 0,
int __base = 10)
2702 {
return __gnu_cxx::__stoa(&std::wcstoll,
"stoll", __str.c_str(),
2705 inline unsigned long long
2706 stoull(
const __wvstring& __str, std::size_t* __idx = 0,
int __base = 10)
2707 {
return __gnu_cxx::__stoa(&std::wcstoull,
"stoull", __str.c_str(),
2712 stof(
const __wvstring& __str, std::size_t* __idx = 0)
2713 {
return __gnu_cxx::__stoa(&std::wcstof,
"stof", __str.c_str(), __idx); }
2716 stod(
const __wvstring& __str, std::size_t* __idx = 0)
2717 {
return __gnu_cxx::__stoa(&std::wcstod,
"stod", __str.c_str(), __idx); }
2720 stold(
const __wvstring& __str, std::size_t* __idx = 0)
2721 {
return __gnu_cxx::__stoa(&std::wcstold,
"stold", __str.c_str(), __idx); }
2723 #ifndef _GLIBCXX_HAVE_BROKEN_VSWPRINTF
2726 to_wstring(
int __val)
2727 {
return __gnu_cxx::__to_xstring<__wvstring>(&std::vswprintf,
2732 to_wstring(
unsigned __val)
2733 {
return __gnu_cxx::__to_xstring<__wvstring>(&std::vswprintf,
2734 4 *
sizeof(unsigned),
2738 to_wstring(
long __val)
2739 {
return __gnu_cxx::__to_xstring<__wvstring>(&std::vswprintf,
2744 to_wstring(
unsigned long __val)
2745 {
return __gnu_cxx::__to_xstring<__wvstring>(&std::vswprintf,
2746 4 *
sizeof(
unsigned long),
2750 to_wstring(
long long __val)
2751 {
return __gnu_cxx::__to_xstring<__wvstring>(&std::vswprintf,
2752 4 *
sizeof(
long long),
2756 to_wstring(
unsigned long long __val)
2757 {
return __gnu_cxx::__to_xstring<__wvstring>(&std::vswprintf,
2758 4 *
sizeof(
unsigned long long),
2762 to_wstring(
float __val)
2764 const int __n = __numeric_traits<float>::__max_exponent10 + 20;
2765 return __gnu_cxx::__to_xstring<__wvstring>(&std::vswprintf, __n,
2770 to_wstring(
double __val)
2772 const int __n = __numeric_traits<double>::__max_exponent10 + 20;
2773 return __gnu_cxx::__to_xstring<__wvstring>(&std::vswprintf, __n,
2778 to_wstring(
long double __val)
2780 const int __n = __numeric_traits<long double>::__max_exponent10 + 20;
2781 return __gnu_cxx::__to_xstring<__wvstring>(&std::vswprintf, __n,
2787 _GLIBCXX_END_NAMESPACE_VERSION
2792 #if __cplusplus >= 201103L
2796 namespace std _GLIBCXX_VISIBILITY(default)
2798 _GLIBCXX_BEGIN_NAMESPACE_VERSION
2803 :
public __hash_base<size_t, __gnu_cxx::__vstring>
2807 {
return std::_Hash_impl::hash(__s.
data(), __s.
length()); }
2810 #ifdef _GLIBCXX_USE_WCHAR_T
2814 :
public __hash_base<size_t, __gnu_cxx::__wvstring>
2818 {
return std::_Hash_impl::hash(__s.
data(),
2819 __s.
length() *
sizeof(wchar_t)); }
2823 #ifdef _GLIBCXX_USE_C99_STDINT_TR1
2827 :
public __hash_base<size_t, __gnu_cxx::__u16vstring>
2831 {
return std::_Hash_impl::hash(__s.
data(),
2832 __s.
length() *
sizeof(char16_t)); }
2838 :
public __hash_base<size_t, __gnu_cxx::__u32vstring>
2842 {
return std::_Hash_impl::hash(__s.
data(),
2843 __s.
length() *
sizeof(char32_t)); }
2847 _GLIBCXX_END_NAMESPACE_VERSION
2852 #include "vstring.tcc"
__versa_string & replace(iterator __i1, iterator __i2, std::initializer_list< _CharT > __l)
Replace range of characters with initializer_list.
iterator begin() noexcept
__versa_string & operator=(_CharT __c)
Set value to string of length 1.
size_type rfind(const __versa_string &__str, size_type __pos=npos) const noexcept
Find last position of a string.
size_type rfind(const _CharT *__s, size_type __pos=npos) const
Find last position of a C string.
size_type find_last_of(const _CharT *__s, size_type __pos=npos) const
Find last position of a character of C string.
void pop_back()
Remove the last character.
void reserve(size_type __res_arg=0)
Attempt to preallocate enough memory for specified number of characters.
const_iterator end() const noexcept
size_type find(const _CharT *__s, size_type __pos, size_type __n) const
Find position of a C substring.
size_type find_last_not_of(const _CharT *__s, size_type __pos=npos) const
Find last position of a character not in C string.
_Siter_base< _Iterator >::iterator_type __base(_Iterator __it)
Basis for explicit traits specializations.
size_type find(const __versa_string &__str, size_type __pos=0) const noexcept
Find position of a string.
__versa_string & replace(iterator __i1, iterator __i2, const _CharT *__s, size_type __n)
Replace range of characters with C substring.
__versa_string & operator=(const _CharT *__s)
Copy contents of __s into this string.
__versa_string & replace(size_type __pos, size_type __n1, size_type __n2, _CharT __c)
Replace characters with multiple characters.
allocator_type get_allocator() const noexcept
Return copy of allocator used to construct this string.
__versa_string(const __versa_string &__str)
Construct string with copy of value of __str.
__versa_string & append(_InputIterator __first, _InputIterator __last)
Append a range of characters.
__versa_string & operator=(std::initializer_list< _CharT > __l)
Set value to string constructed from initializer list.
void insert(iterator __p, size_type __n, _CharT __c)
Insert multiple characters.
__versa_string & append(size_type __n, _CharT __c)
Append multiple characters.
void push_back(_CharT __c)
Append a single character.
__versa_string & replace(iterator __i1, iterator __i2, const _CharT *__s)
Replace range of characters with C string.
int compare(const __versa_string &__str) const
Compare to a string.
__versa_string & insert(size_type __pos, const _CharT *__s)
Insert a C string.
__versa_string & append(std::initializer_list< _CharT > __l)
Append an initializer_list of characters.
void insert(iterator __p, _InputIterator __beg, _InputIterator __end)
Insert a range of characters.
size_type find_first_of(const _CharT *__s, size_type __pos=0) const
Find position of a character of C string.
const_reverse_iterator rend() const noexcept
__versa_string & assign(const __versa_string &__str)
Set value to contents of another string.
size_type size() const noexcept
Returns the number of characters in the string, not including any null-termination.
__versa_string & insert(size_type __pos, size_type __n, _CharT __c)
Insert multiple characters.
const_reverse_iterator crbegin() const noexcept
One of the comparison functors.
GNU extensions for public use.
__versa_string(std::initializer_list< _CharT > __l, const _Alloc &__a=_Alloc())
Construct string from an initializer list.
void resize(size_type __n)
Resizes the string to the specified number of characters.
constexpr std::remove_reference< _Tp >::type && move(_Tp &&__t) noexcept
Convert a value to an rvalue.
__versa_string & operator+=(std::initializer_list< _CharT > __l)
Append an initializer_list of characters.
__versa_string substr(size_type __pos=0, size_type __n=npos) const
Get a substring.
__versa_string & replace(iterator __i1, iterator __i2, const __versa_string &__str)
Replace range of characters with string.
__versa_string(size_type __n, _CharT __c, const _Alloc &__a=_Alloc())
Construct string as multiple characters.
__versa_string & assign(const __versa_string &__str, size_type __pos, size_type __n)
Set value to a substring of a string.
size_type find_first_of(const __versa_string &__str, size_type __pos=0) const noexcept
Find position of a character of string.
__versa_string & operator=(const __versa_string &__str)
Assign the value of str to this string.
__versa_string & replace(iterator __i1, iterator __i2, size_type __n, _CharT __c)
Replace range of characters with multiple characters.
__versa_string & assign(const _CharT *__s)
Set value to contents of a C string.
const_reverse_iterator rbegin() const noexcept
const_iterator begin() const noexcept
__versa_string(_InputIterator __beg, _InputIterator __end, const _Alloc &__a=_Alloc())
Construct string as copy of a range.
ISO C++ entities toplevel namespace is std.
bool empty() const noexcept
size_type find_last_of(const __versa_string &__str, size_type __pos=npos) const noexcept
Find last position of a character of string.
size_type copy(_CharT *__s, size_type __n, size_type __pos=0) const
Copy substring into C string.
__versa_string()
Default constructor creates an empty string.
void resize(size_type __n, _CharT __c)
Resizes the string to the specified number of characters.
__versa_string & replace(size_type __pos1, size_type __n1, const __versa_string &__str, size_type __pos2, size_type __n2)
Replace characters with value from another string.
basic_istream< _CharT, _Traits > & getline(basic_istream< _CharT, _Traits > &__is, basic_string< _CharT, _Traits, _Alloc > &__str, _CharT __delim)
Read a line from stream into a string.
__versa_string & append(const _CharT *__s)
Append a C string.
size_type capacity() const noexcept
const _CharT * data() const noexcept
Return const pointer to contents.
__versa_string & replace(size_type __pos, size_type __n, const __versa_string &__str)
Replace characters with value from another string.
reverse_iterator rbegin() noexcept
size_type find_last_not_of(const __versa_string &__str, size_type __pos=npos) const noexcept
Find last position of a character not in string.
iterator erase(iterator __position)
Remove one character.
const_reference back() const
__versa_string & replace(size_type __pos, size_type __n1, const _CharT *__s)
Replace characters with value of a C string.
~__versa_string() noexcept
Destroy the string instance.
Template class __versa_string.Data structure managing sequences of characters and character-like obje...
const_iterator cend() const noexcept
__versa_string & append(const _CharT *__s, size_type __n)
Append a C substring.
size_type find_first_not_of(const __versa_string &__str, size_type __pos=0) const noexcept
Find position of a character not in string.
iterator insert(iterator __p, _CharT __c)
Insert one character.
__versa_string & insert(size_type __pos1, const __versa_string &__str, size_type __pos2, size_type __n)
Insert a substring.
__versa_string(const _CharT *__s, const _Alloc &__a=_Alloc())
Construct string as copy of a C string.
reference operator[](size_type __pos)
Subscript access to the data contained in the string.
const _CharT * c_str() const noexcept
Return const pointer to null-terminated contents.
__versa_string(__versa_string &&__str) noexcept
String move constructor.
__versa_string & operator+=(_CharT __c)
Append a character.
__versa_string & assign(size_type __n, _CharT __c)
Set value to multiple characters.
size_type max_size() const noexcept
Returns the size() of the largest possible string.
const_reference at(size_type __n) const
Provides access to the data contained in the string.
size_type find_first_of(_CharT __c, size_type __pos=0) const noexcept
Find position of a character.
basic_string< _CharT, _Traits, _Alloc > operator+(const basic_string< _CharT, _Traits, _Alloc > &__lhs, const basic_string< _CharT, _Traits, _Alloc > &__rhs)
Concatenate two strings.
iterator erase(iterator __first, iterator __last)
Remove a range of characters.
size_type find_first_not_of(const _CharT *__s, size_type __pos=0) const
Find position of a character not in C string.
void swap(__versa_string &__s)
Swap contents with another string.
__versa_string & erase(size_type __pos=0, size_type __n=npos)
Remove characters.
void shrink_to_fit()
A non-binding request to reduce capacity() to size().
__versa_string & insert(size_type __pos1, const __versa_string &__str)
Insert value of a string.
__versa_string & append(const __versa_string &__str, size_type __pos, size_type __n)
Append a substring.
__versa_string(const __versa_string &__str, size_type __pos, size_type __n=npos)
Construct string as copy of a substring.
__versa_string & operator+=(const __versa_string &__str)
Append a string to this string.
__versa_string & replace(iterator __i1, iterator __i2, _InputIterator __k1, _InputIterator __k2)
Replace range of characters with range.
reference at(size_type __n)
Provides access to the data contained in the string.
size_type find(const _CharT *__s, size_type __pos=0) const
Find position of a C string.
__versa_string & operator+=(const _CharT *__s)
Append a C string.
Primary class template hash.
reverse_iterator rend() noexcept
__versa_string & append(const __versa_string &__str)
Append a string to this string.
__versa_string & assign(std::initializer_list< _CharT > __l)
Set value to an initializer_list of characters.
const_reference operator[](size_type __pos) const
Subscript access to the data contained in the string.
The standard allocator, as per [20.4].
void insert(iterator __p, std::initializer_list< _CharT > __l)
Insert an initializer_list of characters.
__versa_string(const _CharT *__s, size_type __n, const _Alloc &__a=_Alloc())
Construct string initialized by a character array.
__versa_string & insert(size_type __pos, const _CharT *__s, size_type __n)
Insert a C substring.
const _Tp & min(const _Tp &, const _Tp &)
This does what you think it does.
__versa_string(const _Alloc &__a)
Construct an empty string using allocator a.
__versa_string & assign(__versa_string &&__str)
Set value to contents of another string.
const_reverse_iterator crend() const noexcept
__versa_string & assign(const _CharT *__s, size_type __n)
Set value to a C substring.
const_iterator cbegin() const noexcept
static const size_type npos
Value returned by various member functions when they fail.
const_reference front() const
basic_istream< _CharT, _Traits > & operator>>(basic_istream< _CharT, _Traits > &__is, basic_string< _CharT, _Traits, _Alloc > &__str)
Read stream into a string.
__versa_string(const __versa_string &__str, size_type __pos, size_type __n, const _Alloc &__a)
Construct string as copy of a substring.
size_type find_last_of(_CharT __c, size_type __pos=npos) const noexcept
Find last position of a character.
__versa_string & replace(size_type __pos, size_type __n1, const _CharT *__s, size_type __n2)
Replace characters with value of a C substring.
__versa_string & operator=(__versa_string &&__str)
String move assignment operator.
size_type length() const noexcept
Returns the number of characters in the string, not including any null-termination.
__versa_string & assign(_InputIterator __first, _InputIterator __last)
Set value to a range of characters.