32 #pragma GCC system_header 34 #if __cplusplus >= 201103L 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_fmt(__N(
"%s: __pos (which is %zu) > " 89 "this->size() (which is %zu)"),
90 __s, __pos, this->
size());
95 _M_check_length(size_type __n1, size_type __n2,
const char* __s)
const 98 std::__throw_length_error(__N(__s));
103 _M_limit(size_type __pos, size_type __off)
const _GLIBCXX_NOEXCEPT
105 const bool __testoff = __off < this->
size() - __pos;
106 return __testoff ? __off : this->
size() - __pos;
111 _M_disjunct(
const _CharT* __s)
const _GLIBCXX_NOEXCEPT
115 + this->
size(), __s));
121 _M_ibegin()
const _GLIBCXX_NOEXCEPT
122 {
return iterator(this->_M_data()); }
125 _M_iend()
const _GLIBCXX_NOEXCEPT
126 {
return iterator(this->_M_data() + this->_M_length()); }
138 : __vstring_base(__a) { }
146 : __vstring_base(__str) { }
148 #if __cplusplus >= 201103L 158 : __vstring_base(
std::move(__str)) { }
166 const _Alloc& __a = _Alloc())
167 : __vstring_base(__l.
begin(), __l.
end(), __a) { }
177 size_type __n = npos)
178 : __vstring_base(__str._M_data()
179 + __str._M_check(__pos,
180 "__versa_string::__versa_string"),
181 __str._M_data() + __str._M_limit(__pos, __n)
182 + __pos, _Alloc()) { }
192 size_type __n,
const _Alloc& __a)
193 : __vstring_base(__str._M_data()
194 + __str._M_check(__pos,
195 "__versa_string::__versa_string"),
196 __str._M_data() + __str._M_limit(__pos, __n)
209 const _Alloc& __a = _Alloc())
210 : __vstring_base(__s, __s + __n, __a) { }
218 : __vstring_base(__s, __s ? __s + traits_type::
length(__s) :
228 : __vstring_base(__n, __c, __a) { }
236 #if __cplusplus >= 201103L 237 template<
class _InputIterator,
238 typename = std::_RequireInputIter<_InputIterator>>
240 template<
class _InputIterator>
243 const _Alloc& __a = _Alloc())
244 : __vstring_base(__beg, __end, __a) { }
257 {
return this->
assign(__str); }
259 #if __cplusplus >= 201103L 282 this->
assign(__l.begin(), __l.end());
293 {
return this->
assign(__s); }
318 return iterator(this->_M_data());
327 {
return const_iterator(this->_M_data()); }
337 return iterator(this->_M_data() + this->
size());
345 end() const _GLIBCXX_NOEXCEPT
346 {
return const_iterator(this->_M_data() + this->
size()); }
355 {
return reverse_iterator(this->
end()); }
362 const_reverse_iterator
364 {
return const_reverse_iterator(this->
end()); }
373 {
return reverse_iterator(this->
begin()); }
380 const_reverse_iterator
382 {
return const_reverse_iterator(this->
begin()); }
384 #if __cplusplus >= 201103L 391 {
return const_iterator(this->_M_data()); }
399 {
return const_iterator(this->_M_data() + this->
size()); }
406 const_reverse_iterator
408 {
return const_reverse_iterator(this->
end()); }
415 const_reverse_iterator
417 {
return const_reverse_iterator(this->
begin()); }
426 {
return this->_M_length(); }
432 {
return this->_M_length(); }
437 {
return this->_M_max_size(); }
450 resize(size_type __n, _CharT __c);
464 { this->
resize(__n, _CharT()); }
466 #if __cplusplus >= 201103L 487 {
return this->_M_capacity(); }
508 { this->_M_reserve(__res_arg); }
515 { this->_M_clear(); }
523 {
return this->
size() == 0; }
539 _GLIBCXX_DEBUG_ASSERT(__pos <= this->
size());
540 return this->_M_data()[__pos];
558 _GLIBCXX_DEBUG_ASSERT(__pos <= this->
size());
560 _GLIBCXX_DEBUG_PEDASSERT(__cplusplus >= 201103L
561 || __pos < this->
size());
563 return this->_M_data()[__pos];
577 at(size_type __n)
const 579 if (__n >= this->
size())
580 std::__throw_out_of_range_fmt(__N(
"__versa_string::at: __n " 581 "(which is %zu) >= this->size() " 584 return this->_M_data()[__n];
601 if (__n >= this->
size())
602 std::__throw_out_of_range_fmt(__N(
"__versa_string::at: __n " 603 "(which is %zu) >= this->size() " 607 return this->_M_data()[__n];
610 #if __cplusplus >= 201103L 652 {
return this->
append(__str); }
661 {
return this->
append(__s); }
675 #if __cplusplus >= 201103L 683 {
return this->
append(__l.begin(), __l.end()); }
693 {
return _M_append(__str._M_data(), __str.
size()); }
710 {
return _M_append(__str._M_data()
711 + __str._M_check(__pos,
"__versa_string::append"),
712 __str._M_limit(__pos, __n)); }
723 __glibcxx_requires_string_len(__s, __n);
724 _M_check_length(size_type(0), __n,
"__versa_string::append");
725 return _M_append(__s, __n);
736 __glibcxx_requires_string(__s);
737 const size_type __n = traits_type::length(__s);
738 _M_check_length(size_type(0), __n,
"__versa_string::append");
739 return _M_append(__s, __n);
752 {
return _M_replace_aux(this->
size(), size_type(0), __n, __c); }
754 #if __cplusplus >= 201103L 762 {
return this->
append(__l.begin(), __l.end()); }
773 #if __cplusplus >= 201103L 774 template<
class _InputIterator,
775 typename = std::_RequireInputIter<_InputIterator>>
777 template<
class _InputIterator>
780 append(_InputIterator __first, _InputIterator __last)
781 {
return this->
replace(_M_iend(), _M_iend(), __first, __last); }
790 const size_type __size = this->
size();
791 if (__size + 1 > this->
capacity() || this->_M_is_shared())
792 this->_M_mutate(__size, size_type(0), 0, size_type(1));
793 traits_type::assign(this->_M_data()[__size], __c);
794 this->_M_set_length(__size + 1);
805 this->_M_assign(__str);
809 #if __cplusplus >= 201103L 841 {
return _M_replace(size_type(0), this->
size(), __str._M_data()
842 + __str._M_check(__pos,
"__versa_string::assign"),
843 __str._M_limit(__pos, __n)); }
859 __glibcxx_requires_string_len(__s, __n);
860 return _M_replace(size_type(0), this->
size(), __s, __n);
875 __glibcxx_requires_string(__s);
876 return _M_replace(size_type(0), this->
size(), __s,
877 traits_type::length(__s));
891 {
return _M_replace_aux(size_type(0), this->
size(), __n, __c); }
902 #if __cplusplus >= 201103L 903 template<
class _InputIterator,
904 typename = std::_RequireInputIter<_InputIterator>>
906 template<
class _InputIterator>
909 assign(_InputIterator __first, _InputIterator __last)
910 {
return this->
replace(_M_ibegin(), _M_iend(), __first, __last); }
912 #if __cplusplus >= 201103L 920 {
return this->
assign(__l.begin(), __l.end()); }
923 #if __cplusplus >= 201103L 940 insert(const_iterator __p, size_type __n, _CharT __c)
942 _GLIBCXX_DEBUG_PEDASSERT(__p >= _M_ibegin() && __p <= _M_iend());
943 const size_type __pos = __p - _M_ibegin();
944 this->
replace(__p, __p, __n, __c);
945 return iterator(this->_M_data() + __pos);
962 insert(iterator __p, size_type __n, _CharT __c)
963 { this->
replace(__p, __p, __n, __c); }
966 #if __cplusplus >= 201103L 981 template<
class _InputIterator,
982 typename = std::_RequireInputIter<_InputIterator>>
984 insert(const_iterator __p, _InputIterator __beg, _InputIterator __end)
986 _GLIBCXX_DEBUG_PEDASSERT(__p >= _M_ibegin() && __p <= _M_iend());
987 const size_type __pos = __p - _M_ibegin();
988 this->
replace(__p, __p, __beg, __end);
989 return iterator(this->_M_data() + __pos);
1004 template<
class _InputIterator>
1006 insert(iterator __p, _InputIterator __beg, _InputIterator __end)
1007 { this->
replace(__p, __p, __beg, __end); }
1010 #if __cplusplus >= 201103L 1021 {
return this->
insert(__p, __l.begin(), __l.end()); }
1038 {
return this->
replace(__pos1, size_type(0),
1039 __str._M_data(), __str.
size()); }
1061 size_type __pos2, size_type __n)
1062 {
return this->
replace(__pos1, size_type(0), __str._M_data()
1063 + __str._M_check(__pos2,
"__versa_string::insert"),
1064 __str._M_limit(__pos2, __n)); }
1083 insert(size_type __pos,
const _CharT* __s, size_type __n)
1084 {
return this->
replace(__pos, size_type(0), __s, __n); }
1104 __glibcxx_requires_string(__s);
1105 return this->
replace(__pos, size_type(0), __s,
1106 traits_type::length(__s));
1126 insert(size_type __pos, size_type __n, _CharT __c)
1127 {
return _M_replace_aux(_M_check(__pos,
"__versa_string::insert"),
1128 size_type(0), __n, __c); }
1144 #if __cplusplus >= 201103L 1147 insert(iterator __p, _CharT __c)
1150 _GLIBCXX_DEBUG_PEDASSERT(__p >= _M_ibegin() && __p <= _M_iend());
1151 const size_type __pos = __p - _M_ibegin();
1152 _M_replace_aux(__pos, size_type(0), size_type(1), __c);
1153 this->_M_set_leaked();
1154 return iterator(this->_M_data() + __pos);
1173 erase(size_type __pos = 0, size_type __n = npos)
1175 this->_M_erase(_M_check(__pos,
"__versa_string::erase"),
1176 _M_limit(__pos, __n));
1189 #if __cplusplus >= 201103L 1192 erase(iterator __position)
1195 _GLIBCXX_DEBUG_PEDASSERT(__position >= _M_ibegin()
1196 && __position < _M_iend());
1197 const size_type __pos = __position - _M_ibegin();
1198 this->_M_erase(__pos, size_type(1));
1199 this->_M_set_leaked();
1200 return iterator(this->_M_data() + __pos);
1214 #if __cplusplus >= 201103L 1215 erase(const_iterator __first, const_iterator __last)
1217 erase(iterator __first, iterator __last)
1220 _GLIBCXX_DEBUG_PEDASSERT(__first >= _M_ibegin() && __first <= __last
1221 && __last <= _M_iend());
1222 const size_type __pos = __first - _M_ibegin();
1223 this->_M_erase(__pos, __last - __first);
1224 this->_M_set_leaked();
1225 return iterator(this->_M_data() + __pos);
1228 #if __cplusplus >= 201103L 1236 { this->_M_erase(
size()-1, 1); }
1258 {
return this->
replace(__pos, __n, __str._M_data(), __str.
size()); }
1281 size_type __pos2, size_type __n2)
1283 return this->
replace(__pos1, __n1, __str._M_data()
1284 + __str._M_check(__pos2,
1285 "__versa_string::replace"),
1286 __str._M_limit(__pos2, __n2));
1308 replace(size_type __pos, size_type __n1,
const _CharT* __s,
1311 __glibcxx_requires_string_len(__s, __n2);
1312 return _M_replace(_M_check(__pos,
"__versa_string::replace"),
1313 _M_limit(__pos, __n1), __s, __n2);
1332 replace(size_type __pos, size_type __n1,
const _CharT* __s)
1334 __glibcxx_requires_string(__s);
1335 return this->
replace(__pos, __n1, __s, traits_type::length(__s));
1356 replace(size_type __pos, size_type __n1, size_type __n2, _CharT __c)
1357 {
return _M_replace_aux(_M_check(__pos,
"__versa_string::replace"),
1358 _M_limit(__pos, __n1), __n2, __c); }
1374 #if __cplusplus >= 201103L 1380 {
return this->
replace(__i1, __i2, __str._M_data(), __str.
size()); }
1397 #if __cplusplus >= 201103L 1399 const _CharT* __s, size_type __n)
1401 replace(iterator __i1, iterator __i2,
const _CharT* __s, size_type __n)
1404 _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
1405 && __i2 <= _M_iend());
1406 return this->
replace(__i1 - _M_ibegin(), __i2 - __i1, __s, __n);
1423 #if __cplusplus >= 201103L 1424 replace(const_iterator __i1, const_iterator __i2,
const _CharT* __s)
1426 replace(iterator __i1, iterator __i2,
const _CharT* __s)
1429 __glibcxx_requires_string(__s);
1430 return this->
replace(__i1, __i2, __s, traits_type::length(__s));
1448 #if __cplusplus >= 201103L 1449 replace(const_iterator __i1, const_iterator __i2, size_type __n,
1452 replace(iterator __i1, iterator __i2, size_type __n, _CharT __c)
1455 _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
1456 && __i2 <= _M_iend());
1457 return _M_replace_aux(__i1 - _M_ibegin(), __i2 - __i1, __n, __c);
1474 #if __cplusplus >= 201103L 1475 template<
class _InputIterator,
1476 typename = std::_RequireInputIter<_InputIterator>>
1479 _InputIterator __k1, _InputIterator __k2)
1481 _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
1482 && __i2 <= _M_iend());
1483 __glibcxx_requires_valid_range(__k1, __k2);
1484 return this->_M_replace_dispatch(__i1, __i2, __k1, __k2,
1485 std::__false_type());
1488 template<
class _InputIterator>
1490 replace(iterator __i1, iterator __i2,
1491 _InputIterator __k1, _InputIterator __k2)
1493 _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
1494 && __i2 <= _M_iend());
1495 __glibcxx_requires_valid_range(__k1, __k2);
1496 typedef typename std::__is_integer<_InputIterator>::__type _Integral;
1497 return this->_M_replace_dispatch(__i1, __i2, __k1, __k2, _Integral());
1504 #if __cplusplus >= 201103L 1505 replace(const_iterator __i1, const_iterator __i2,
1506 _CharT* __k1, _CharT* __k2)
1508 replace(iterator __i1, iterator __i2,
1509 _CharT* __k1, _CharT* __k2)
1512 _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
1513 && __i2 <= _M_iend());
1514 __glibcxx_requires_valid_range(__k1, __k2);
1515 return this->
replace(__i1 - _M_ibegin(), __i2 - __i1,
1520 #if __cplusplus >= 201103L 1521 replace(const_iterator __i1, const_iterator __i2,
1522 const _CharT* __k1,
const _CharT* __k2)
1524 replace(iterator __i1, iterator __i2,
1525 const _CharT* __k1,
const _CharT* __k2)
1528 _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
1529 && __i2 <= _M_iend());
1530 __glibcxx_requires_valid_range(__k1, __k2);
1531 return this->
replace(__i1 - _M_ibegin(), __i2 - __i1,
1536 #if __cplusplus >= 201103L 1537 replace(const_iterator __i1, const_iterator __i2,
1538 iterator __k1, iterator __k2)
1540 replace(iterator __i1, iterator __i2,
1541 iterator __k1, iterator __k2)
1544 _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
1545 && __i2 <= _M_iend());
1546 __glibcxx_requires_valid_range(__k1, __k2);
1547 return this->
replace(__i1 - _M_ibegin(), __i2 - __i1,
1548 __k1.base(), __k2 - __k1);
1552 #if __cplusplus >= 201103L 1553 replace(const_iterator __i1, const_iterator __i2,
1554 const_iterator __k1, const_iterator __k2)
1556 replace(iterator __i1, iterator __i2,
1557 const_iterator __k1, const_iterator __k2)
1560 _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
1561 && __i2 <= _M_iend());
1562 __glibcxx_requires_valid_range(__k1, __k2);
1563 return this->
replace(__i1 - _M_ibegin(), __i2 - __i1,
1564 __k1.base(), __k2 - __k1);
1567 #if __cplusplus >= 201103L 1584 {
return this->
replace(__i1, __i2, __l.begin(), __l.end()); }
1588 template<
class _Integer>
1590 _M_replace_dispatch(const_iterator __i1, const_iterator __i2,
1591 _Integer __n, _Integer __val, std::__true_type)
1592 {
return _M_replace_aux(__i1 - _M_ibegin(), __i2 - __i1, __n, __val); }
1594 template<
class _InputIterator>
1596 _M_replace_dispatch(const_iterator __i1, const_iterator __i2,
1597 _InputIterator __k1, _InputIterator __k2,
1601 _M_replace_aux(size_type __pos1, size_type __n1, size_type __n2,
1605 _M_replace(size_type __pos, size_type __len1,
const _CharT* __s,
1606 const size_type __len2);
1609 _M_append(
const _CharT* __s, size_type __n);
1626 copy(_CharT* __s, size_type __n, size_type __pos = 0)
const;
1637 { this->_M_swap(__s); }
1648 {
return this->_M_data(); }
1658 {
return this->_M_data(); }
1665 {
return allocator_type(this->_M_get_allocator()); }
1680 find(
const _CharT* __s, size_type __pos, size_type __n)
const;
1695 {
return this->
find(__str.
data(), __pos, __str.
size()); }
1708 find(
const _CharT* __s, size_type __pos = 0)
const 1710 __glibcxx_requires_string(__s);
1711 return this->
find(__s, __pos, traits_type::length(__s));
1725 find(_CharT __c, size_type __pos = 0)
const _GLIBCXX_NOEXCEPT;
1755 rfind(
const _CharT* __s, size_type __pos, size_type __n)
const;
1768 rfind(
const _CharT* __s, size_type __pos = npos)
const 1770 __glibcxx_requires_string(__s);
1771 return this->
rfind(__s, __pos, traits_type::length(__s));
1785 rfind(_CharT __c, size_type __pos = npos)
const _GLIBCXX_NOEXCEPT;
1815 find_first_of(
const _CharT* __s, size_type __pos, size_type __n)
const;
1830 __glibcxx_requires_string(__s);
1831 return this->
find_first_of(__s, __pos, traits_type::length(__s));
1848 {
return this->
find(__c, __pos); }
1879 find_last_of(
const _CharT* __s, size_type __pos, size_type __n)
const;
1894 __glibcxx_requires_string(__s);
1895 return this->
find_last_of(__s, __pos, traits_type::length(__s));
1912 {
return this->
rfind(__c, __pos); }
1943 size_type __n)
const;
1958 __glibcxx_requires_string(__s);
1989 size_type __pos = npos) const _GLIBCXX_NOEXCEPT
2006 size_type __n)
const;
2021 __glibcxx_requires_string(__s);
2052 substr(size_type __pos = 0, size_type __n = npos)
const 2054 return __versa_string(*
this, _M_check(__pos,
"__versa_string::substr"),
2075 if (this->_M_compare(__str))
2078 const size_type __size = this->
size();
2079 const size_type __osize = __str.
size();
2080 const size_type __len =
std::min(__size, __osize);
2082 int __r = traits_type::compare(this->_M_data(), __str.
data(), __len);
2084 __r = this->_S_compare(__size, __osize);
2108 compare(size_type __pos, size_type __n,
2136 size_type __pos2, size_type __n2)
const;
2154 compare(
const _CharT* __s)
const;
2178 compare(size_type __pos, size_type __n1,
const _CharT* __s)
const;
2205 compare(size_type __pos, size_type __n1,
const _CharT* __s,
2206 size_type __n2)
const;
2216 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2217 template <
typename,
typename,
typename>
class _Base>
2228 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2229 template <
typename,
typename,
typename>
class _Base>
2231 operator+(
const _CharT* __lhs,
2240 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2241 template <
typename,
typename,
typename>
class _Base>
2243 operator+(_CharT __lhs,
2252 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2253 template <
typename,
typename,
typename>
class _Base>
2256 const _CharT* __rhs);
2264 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2265 template <
typename,
typename,
typename>
class _Base>
2270 #if __cplusplus >= 201103L 2271 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2272 template <
typename,
typename,
typename>
class _Base>
2276 {
return std::move(__lhs.
append(__rhs)); }
2278 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2279 template <
typename,
typename,
typename>
class _Base>
2283 {
return std::move(__rhs.
insert(0, __lhs)); }
2285 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2286 template <
typename,
typename,
typename>
class _Base>
2291 const auto __size = __lhs.
size() + __rhs.
size();
2292 const bool __cond = (__size > __lhs.
capacity()
2294 return __cond ? std::move(__rhs.
insert(0, __lhs))
2295 : std::move(__lhs.
append(__rhs));
2298 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2299 template <
typename,
typename,
typename>
class _Base>
2301 operator+(
const _CharT* __lhs,
2303 {
return std::move(__rhs.
insert(0, __lhs)); }
2305 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2306 template <
typename,
typename,
typename>
class _Base>
2308 operator+(_CharT __lhs,
2310 {
return std::move(__rhs.
insert(0, 1, __lhs)); }
2312 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2313 template <
typename,
typename,
typename>
class _Base>
2316 const _CharT* __rhs)
2317 {
return std::move(__lhs.append(__rhs)); }
2319 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2320 template <
typename,
typename,
typename>
class _Base>
2324 {
return std::move(__lhs.append(1, __rhs)); }
2334 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2335 template <
typename,
typename,
typename>
class _Base>
2339 {
return __lhs.
compare(__rhs) == 0; }
2341 template<
typename _CharT,
2342 template <
typename,
typename,
typename>
class _Base>
2343 inline typename __enable_if<std::__is_char<_CharT>::__value,
bool>::__type
2348 {
return (__lhs.size() == __rhs.size()
2358 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2359 template <
typename,
typename,
typename>
class _Base>
2361 operator==(
const _CharT* __lhs,
2363 {
return __rhs.
compare(__lhs) == 0; }
2371 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2372 template <
typename,
typename,
typename>
class _Base>
2375 const _CharT* __rhs)
2376 {
return __lhs.
compare(__rhs) == 0; }
2385 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2386 template <
typename,
typename,
typename>
class _Base>
2390 {
return !(__lhs == __rhs); }
2398 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2399 template <
typename,
typename,
typename>
class _Base>
2401 operator!=(
const _CharT* __lhs,
2403 {
return !(__lhs == __rhs); }
2411 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2412 template <
typename,
typename,
typename>
class _Base>
2415 const _CharT* __rhs)
2416 {
return !(__lhs == __rhs); }
2425 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2426 template <
typename,
typename,
typename>
class _Base>
2428 operator<(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,
2430 {
return __lhs.
compare(__rhs) < 0; }
2438 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2439 template <
typename,
typename,
typename>
class _Base>
2441 operator<(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,
2442 const _CharT* __rhs)
2443 {
return __lhs.compare(__rhs) < 0; }
2451 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2452 template <
typename,
typename,
typename>
class _Base>
2454 operator<(
const _CharT* __lhs,
2456 {
return __rhs.
compare(__lhs) > 0; }
2465 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2466 template <
typename,
typename,
typename>
class _Base>
2470 {
return __lhs.
compare(__rhs) > 0; }
2478 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2479 template <
typename,
typename,
typename>
class _Base>
2482 const _CharT* __rhs)
2483 {
return __lhs.
compare(__rhs) > 0; }
2491 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2492 template <
typename,
typename,
typename>
class _Base>
2494 operator>(
const _CharT* __lhs,
2496 {
return __rhs.
compare(__lhs) < 0; }
2505 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2506 template <
typename,
typename,
typename>
class _Base>
2508 operator<=(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,
2510 {
return __lhs.
compare(__rhs) <= 0; }
2518 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2519 template <
typename,
typename,
typename>
class _Base>
2521 operator<=(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,
2522 const _CharT* __rhs)
2523 {
return __lhs.compare(__rhs) <= 0; }
2531 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2532 template <
typename,
typename,
typename>
class _Base>
2534 operator<=(
const _CharT* __lhs,
2536 {
return __rhs.
compare(__lhs) >= 0; }
2545 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2546 template <
typename,
typename,
typename>
class _Base>
2550 {
return __lhs.
compare(__rhs) >= 0; }
2558 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2559 template <
typename,
typename,
typename>
class _Base>
2562 const _CharT* __rhs)
2563 {
return __lhs.
compare(__rhs) >= 0; }
2571 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2572 template <
typename,
typename,
typename>
class _Base>
2574 operator>=(
const _CharT* __lhs,
2576 {
return __rhs.
compare(__lhs) <= 0; }
2585 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2586 template <
typename,
typename,
typename>
class _Base>
2590 { __lhs.
swap(__rhs); }
2592 _GLIBCXX_END_NAMESPACE_VERSION
2595 namespace std _GLIBCXX_VISIBILITY(default)
2597 _GLIBCXX_BEGIN_NAMESPACE_VERSION
2611 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2612 template <
typename,
typename,
typename>
class _Base>
2613 basic_istream<_CharT, _Traits>&
2614 operator>>(basic_istream<_CharT, _Traits>& __is,
2616 _Alloc, _Base>& __str);
2627 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2628 template <
typename,
typename,
typename>
class _Base>
2630 operator<<(basic_ostream<_CharT, _Traits>& __os,
2636 return __ostream_insert(__os, __str.
data(), __str.
size());
2653 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2654 template <
typename,
typename,
typename>
class _Base>
2673 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2674 template <
typename,
typename,
typename>
class _Base>
2680 _GLIBCXX_END_NAMESPACE_VERSION
2683 #if ((__cplusplus >= 201103L) && defined(_GLIBCXX_USE_C99)) 2687 namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
2689 _GLIBCXX_BEGIN_NAMESPACE_VERSION
2693 stoi(
const __vstring& __str, std::size_t* __idx = 0,
int __base = 10)
2694 {
return __gnu_cxx::__stoa<long, int>(&std::strtol,
"stoi", __str.c_str(),
2698 stol(
const __vstring& __str, std::size_t* __idx = 0,
int __base = 10)
2699 {
return __gnu_cxx::__stoa(&std::strtol,
"stol", __str.c_str(),
2702 inline unsigned long 2703 stoul(
const __vstring& __str, std::size_t* __idx = 0,
int __base = 10)
2704 {
return __gnu_cxx::__stoa(&std::strtoul,
"stoul", __str.c_str(),
2708 stoll(
const __vstring& __str, std::size_t* __idx = 0,
int __base = 10)
2709 {
return __gnu_cxx::__stoa(&std::strtoll,
"stoll", __str.c_str(),
2712 inline unsigned long long 2713 stoull(
const __vstring& __str, std::size_t* __idx,
int __base = 10)
2714 {
return __gnu_cxx::__stoa(&std::strtoull,
"stoull", __str.c_str(),
2719 stof(
const __vstring& __str, std::size_t* __idx = 0)
2720 {
return __gnu_cxx::__stoa(&std::strtof,
"stof", __str.c_str(), __idx); }
2723 stod(
const __vstring& __str, std::size_t* __idx = 0)
2724 {
return __gnu_cxx::__stoa(&std::strtod,
"stod", __str.c_str(), __idx); }
2727 stold(
const __vstring& __str, std::size_t* __idx = 0)
2728 {
return __gnu_cxx::__stoa(&std::strtold,
"stold", __str.c_str(), __idx); }
2734 to_string(
int __val)
2735 {
return __gnu_cxx::__to_xstring<__vstring>(&std::vsnprintf, 4 *
sizeof(int),
2739 to_string(
unsigned __val)
2740 {
return __gnu_cxx::__to_xstring<__vstring>(&std::vsnprintf,
2741 4 *
sizeof(unsigned),
2745 to_string(
long __val)
2746 {
return __gnu_cxx::__to_xstring<__vstring>(&std::vsnprintf,
2751 to_string(
unsigned long __val)
2752 {
return __gnu_cxx::__to_xstring<__vstring>(&std::vsnprintf,
2753 4 *
sizeof(
unsigned long),
2758 to_string(
long long __val)
2759 {
return __gnu_cxx::__to_xstring<__vstring>(&std::vsnprintf,
2760 4 *
sizeof(
long long),
2764 to_string(
unsigned long long __val)
2765 {
return __gnu_cxx::__to_xstring<__vstring>(&std::vsnprintf,
2766 4 *
sizeof(
unsigned long long),
2770 to_string(
float __val)
2772 const int __n = __numeric_traits<float>::__max_exponent10 + 20;
2773 return __gnu_cxx::__to_xstring<__vstring>(&std::vsnprintf, __n,
2778 to_string(
double __val)
2780 const int __n = __numeric_traits<double>::__max_exponent10 + 20;
2781 return __gnu_cxx::__to_xstring<__vstring>(&std::vsnprintf, __n,
2786 to_string(
long double __val)
2788 const int __n = __numeric_traits<long double>::__max_exponent10 + 20;
2789 return __gnu_cxx::__to_xstring<__vstring>(&std::vsnprintf, __n,
2793 #ifdef _GLIBCXX_USE_WCHAR_T 2795 stoi(
const __wvstring& __str, std::size_t* __idx = 0,
int __base = 10)
2796 {
return __gnu_cxx::__stoa<long, int>(&std::wcstol,
"stoi", __str.c_str(),
2800 stol(
const __wvstring& __str, std::size_t* __idx = 0,
int __base = 10)
2801 {
return __gnu_cxx::__stoa(&std::wcstol,
"stol", __str.c_str(),
2804 inline unsigned long 2805 stoul(
const __wvstring& __str, std::size_t* __idx = 0,
int __base = 10)
2806 {
return __gnu_cxx::__stoa(&std::wcstoul,
"stoul", __str.c_str(),
2810 stoll(
const __wvstring& __str, std::size_t* __idx = 0,
int __base = 10)
2811 {
return __gnu_cxx::__stoa(&std::wcstoll,
"stoll", __str.c_str(),
2814 inline unsigned long long 2815 stoull(
const __wvstring& __str, std::size_t* __idx = 0,
int __base = 10)
2816 {
return __gnu_cxx::__stoa(&std::wcstoull,
"stoull", __str.c_str(),
2821 stof(
const __wvstring& __str, std::size_t* __idx = 0)
2822 {
return __gnu_cxx::__stoa(&std::wcstof,
"stof", __str.c_str(), __idx); }
2825 stod(
const __wvstring& __str, std::size_t* __idx = 0)
2826 {
return __gnu_cxx::__stoa(&std::wcstod,
"stod", __str.c_str(), __idx); }
2829 stold(
const __wvstring& __str, std::size_t* __idx = 0)
2830 {
return __gnu_cxx::__stoa(&std::wcstold,
"stold", __str.c_str(), __idx); }
2832 #ifndef _GLIBCXX_HAVE_BROKEN_VSWPRINTF 2835 to_wstring(
int __val)
2836 {
return __gnu_cxx::__to_xstring<__wvstring>(&std::vswprintf,
2841 to_wstring(
unsigned __val)
2842 {
return __gnu_cxx::__to_xstring<__wvstring>(&std::vswprintf,
2843 4 *
sizeof(unsigned),
2847 to_wstring(
long __val)
2848 {
return __gnu_cxx::__to_xstring<__wvstring>(&std::vswprintf,
2853 to_wstring(
unsigned long __val)
2854 {
return __gnu_cxx::__to_xstring<__wvstring>(&std::vswprintf,
2855 4 *
sizeof(
unsigned long),
2859 to_wstring(
long long __val)
2860 {
return __gnu_cxx::__to_xstring<__wvstring>(&std::vswprintf,
2861 4 *
sizeof(
long long),
2865 to_wstring(
unsigned long long __val)
2866 {
return __gnu_cxx::__to_xstring<__wvstring>(&std::vswprintf,
2867 4 *
sizeof(
unsigned long long),
2871 to_wstring(
float __val)
2873 const int __n = __numeric_traits<float>::__max_exponent10 + 20;
2874 return __gnu_cxx::__to_xstring<__wvstring>(&std::vswprintf, __n,
2879 to_wstring(
double __val)
2881 const int __n = __numeric_traits<double>::__max_exponent10 + 20;
2882 return __gnu_cxx::__to_xstring<__wvstring>(&std::vswprintf, __n,
2887 to_wstring(
long double __val)
2889 const int __n = __numeric_traits<long double>::__max_exponent10 + 20;
2890 return __gnu_cxx::__to_xstring<__wvstring>(&std::vswprintf, __n,
2896 _GLIBCXX_END_NAMESPACE_VERSION
2901 #if __cplusplus >= 201103L 2905 namespace std _GLIBCXX_VISIBILITY(default)
2907 _GLIBCXX_BEGIN_NAMESPACE_VERSION
2912 :
public __hash_base<size_t, __gnu_cxx::__vstring>
2916 {
return std::_Hash_impl::hash(__s.
data(), __s.
length()); }
2919 #ifdef _GLIBCXX_USE_WCHAR_T 2923 :
public __hash_base<size_t, __gnu_cxx::__wvstring>
2927 {
return std::_Hash_impl::hash(__s.
data(),
2928 __s.
length() *
sizeof(wchar_t)); }
2932 #ifdef _GLIBCXX_USE_C99_STDINT_TR1 2936 :
public __hash_base<size_t, __gnu_cxx::__u16vstring>
2940 {
return std::_Hash_impl::hash(__s.
data(),
2941 __s.
length() *
sizeof(char16_t)); }
2947 :
public __hash_base<size_t, __gnu_cxx::__u32vstring>
2951 {
return std::_Hash_impl::hash(__s.
data(),
2952 __s.
length() *
sizeof(char32_t)); }
2956 _GLIBCXX_END_NAMESPACE_VERSION
const_reference operator[](size_type __pos) const noexcept
Subscript access to the data contained in the string.
bool empty() const noexcept
__versa_string & append(_InputIterator __first, _InputIterator __last)
Append a range of characters.
__versa_string & assign(__versa_string &&__str) noexcept
Set value to contents of another string.
int compare(const __versa_string &__str) const
Compare to a string.
__versa_string & operator=(_CharT __c)
Set value to string of length 1.
size_type rfind(const _CharT *__s, size_type __pos=npos) const
Find last position of a C string.
__versa_string & replace(size_type __pos, size_type __n1, const _CharT *__s)
Replace characters with value of a C 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() noexcept
Destroy the string instance.
__versa_string(const __versa_string &__str, size_type __pos, size_type __n=npos)
Construct string as copy of a substring.
Basis for explicit traits specializations.
const_reverse_iterator rend() const noexcept
__versa_string & replace(const_iterator __i1, const_iterator __i2, _InputIterator __k1, _InputIterator __k2)
Replace range of characters with range.
__versa_string & assign(_InputIterator __first, _InputIterator __last)
Set value to a range of characters.
const_iterator cbegin() const noexcept
iterator insert(const_iterator __p, size_type __n, _CharT __c)
Insert multiple characters.
const_reverse_iterator rbegin() const noexcept
size_type size() const noexcept
Returns the number of characters in the string, not including any null-termination.
reference back() noexcept
void resize(size_type __n)
Resizes the string to the specified number of characters.
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.
iterator insert(const_iterator __p, _CharT __c)
Insert one character.
GNU extensions for public use.
Template class __versa_string.Data structure managing sequences of characters and character-like obje...
const_reference back() const noexcept
size_type find_first_not_of(const _CharT *__s, size_type __pos=0) const
Find position of a character not in C string.
__versa_string & erase(size_type __pos=0, size_type __n=npos)
Remove characters.
const_reference front() const noexcept
const_iterator end() const noexcept
__versa_string & operator=(__versa_string &&__str) noexcept
String move assignment operator.
__versa_string & append(const __versa_string &__str, size_type __pos, size_type __n)
Append a substring.
__versa_string & append(const _CharT *__s, size_type __n)
Append a C substring.
__versa_string(const __versa_string &__str)
Construct string with copy of value of __str.
__versa_string & replace(size_type __pos, size_type __n1, const _CharT *__s, size_type __n2)
Replace characters with value of a C substring.
The standard allocator, as per [20.4].
__versa_string & operator=(const __versa_string &__str)
Assign the value of str to this string.
iterator begin() noexcept
size_type rfind(const __versa_string &__str, size_type __pos=npos) const noexcept
Find last position of a string.
__versa_string & replace(const_iterator __i1, const_iterator __i2, const __versa_string &__str)
Replace range of characters with string.
reverse_iterator rend() noexcept
__versa_string & append(const __versa_string &__str)
Append a string to this string.
const_reverse_iterator crend() const noexcept
__versa_string substr(size_type __pos=0, size_type __n=npos) const
Get a substring.
iterator insert(const_iterator __p, _InputIterator __beg, _InputIterator __end)
Insert a range of characters.
void reserve(size_type __res_arg=0)
Attempt to preallocate enough memory for specified number of characters.
__versa_string & assign(const __versa_string &__str)
Set value to contents of another string.
__versa_string & insert(size_type __pos, size_type __n, _CharT __c)
Insert multiple characters.
size_type capacity() const noexcept
__versa_string(const _CharT *__s, size_type __n, const _Alloc &__a=_Alloc())
Construct string initialized by a character array.
__versa_string & replace(const_iterator __i1, const_iterator __i2, std::initializer_list< _CharT > __l)
Replace range of characters with initializer_list.
static const size_type npos
Value returned by various member functions when they fail.
Template class basic_ostream.
void resize(size_type __n, _CharT __c)
Resizes the string to the specified number of characters.
const_iterator begin() const noexcept
_GLIBCXX14_CONSTEXPR const _Tp & min(const _Tp &, const _Tp &)
This does what you think it does.
__versa_string & append(size_type __n, _CharT __c)
Append multiple characters.
void push_back(_CharT __c)
Append a single character.
__versa_string & insert(size_type __pos, const _CharT *__s)
Insert a C string.
__versa_string & operator+=(_CharT __c)
Append a character.
__versa_string & append(std::initializer_list< _CharT > __l)
Append an initializer_list of characters.
iterator insert(const_iterator __p, std::initializer_list< _CharT > __l)
Insert an initializer_list of characters.
void shrink_to_fit() noexcept
A non-binding request to reduce capacity() to size().
size_type find(const _CharT *__s, size_type __pos, size_type __n) const
Find position of a C substring.
void swap(__versa_string &__s) noexcept
Swap contents with another string.
One of the comparison functors.
Primary class template hash.
basic_istream< _CharT, _Traits > & getline(basic_istream< _CharT, _Traits > &__is, __gnu_cxx::__versa_string< _CharT, _Traits, _Alloc, _Base > &__str)
Read a line from stream into a string.
size_type find_first_of(const _CharT *__s, size_type __pos=0) const
Find position of a character of C string.
const_reference at(size_type __n) const
Provides access to the data contained in the string.
__versa_string(_InputIterator __beg, _InputIterator __end, const _Alloc &__a=_Alloc())
Construct string as copy of a range.
__versa_string & insert(size_type __pos, const _CharT *__s, size_type __n)
Insert a C substring.
__versa_string(const _CharT *__s, const _Alloc &__a=_Alloc())
Construct string as copy of a C string.
size_type find_first_of(_CharT __c, size_type __pos=0) const noexcept
Find position of a character.
__versa_string & replace(size_type __pos, size_type __n, const __versa_string &__str)
Replace characters with value from another string.
size_type copy(_CharT *__s, size_type __n, size_type __pos=0) const
Copy substring into C string.
__versa_string(std::initializer_list< _CharT > __l, const _Alloc &__a=_Alloc())
Construct string from an initializer list.
char_type widen(char __c) const
Widens characters.
__versa_string & assign(size_type __n, _CharT __c)
Set value to multiple characters.
__versa_string & replace(const_iterator __i1, const_iterator __i2, size_type __n, _CharT __c)
Replace range of characters with multiple characters.
size_type find_last_of(_CharT __c, size_type __pos=npos) const noexcept
Find last position of a character.
__versa_string & operator=(std::initializer_list< _CharT > __l)
Set value to string constructed from initializer list.
__versa_string(const _Alloc &__a=_Alloc()) noexcept
Construct an empty string using allocator a.
size_type find_first_not_of(const __versa_string &__str, size_type __pos=0) const noexcept
Find position of a character not in string.
__versa_string & operator+=(const __versa_string &__str)
Append a string to this string.
__versa_string & assign(const __versa_string &__str, size_type __pos, size_type __n)
Set value to a substring of a string.
iterator erase(const_iterator __position)
Remove one character.
reference at(size_type __n)
Provides access to the data contained in the string.
__versa_string & insert(size_type __pos1, const __versa_string &__str, size_type __pos2, size_type __n)
Insert a substring.
size_type find(const _CharT *__s, size_type __pos=0) const
Find position of a C string.
reverse_iterator rbegin() noexcept
const_iterator cend() const noexcept
__versa_string(__versa_string &&__str) noexcept
String move constructor.
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.
__versa_string & replace(const_iterator __i1, const_iterator __i2, const _CharT *__s, size_type __n)
Replace range of characters with C substring.
const_reverse_iterator crbegin() const noexcept
size_type find_last_not_of(const _CharT *__s, size_type __pos=npos) const
Find last position of a character not in C string.
size_type find(const __versa_string &__str, size_type __pos=0) const noexcept
Find position of a string.
_Siter_base< _Iterator >::iterator_type __base(_Iterator __it)
Template class basic_istream.
__versa_string & assign(const _CharT *__s, size_type __n)
Set value to a C substring.
reference front() noexcept
__versa_string & insert(size_type __pos1, const __versa_string &__str)
Insert value of a string.
__versa_string & replace(const_iterator __i1, const_iterator __i2, const _CharT *__s)
Replace range of characters with C string.
__versa_string & operator+=(std::initializer_list< _CharT > __l)
Append an initializer_list of characters.
size_type length() const noexcept
Returns the number of characters in the string, not including any null-termination.
size_type find_last_of(const __versa_string &__str, size_type __pos=npos) const noexcept
Find last position of a character of string.
__versa_string & assign(std::initializer_list< _CharT > __l)
Set value to an initializer_list of characters.
reference operator[](size_type __pos) noexcept
Subscript access to the data contained in the string.
__versa_string & operator=(const _CharT *__s)
Copy contents of __s into this string.
__versa_string & append(const _CharT *__s)
Append a C string.
__versa_string(const __versa_string &__str, size_type __pos, size_type __n, const _Alloc &__a)
Construct string as copy of a substring.
__versa_string & replace(size_type __pos, size_type __n1, size_type __n2, _CharT __c)
Replace characters with multiple characters.
size_type max_size() const noexcept
Returns the size() of the largest possible string.
__versa_string(size_type __n, _CharT __c, const _Alloc &__a=_Alloc())
Construct string as multiple characters.
allocator_type get_allocator() const noexcept
Return copy of allocator used to construct this string.
__versa_string & assign(const _CharT *__s)
Set value to contents of a C string.
__versa_string & operator+=(const _CharT *__s)
Append a C string.
iterator erase(const_iterator __first, const_iterator __last)
Remove a range of characters.
ISO C++ entities toplevel namespace is std.
const _CharT * data() const noexcept
Return const pointer to contents.
const _CharT * c_str() const noexcept
Return const pointer to null-terminated contents.
__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.