33#pragma GCC system_header
38#if __cplusplus >= 201103L
47namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
49_GLIBCXX_BEGIN_NAMESPACE_VERSION
59 template<
typename _CharT,
typename _Traits,
typename _Alloc,
60 template <
typename,
typename,
typename>
class _Base>
62 :
private _Base<_CharT, _Traits, _Alloc>
64 typedef _Base<_CharT, _Traits, _Alloc> __vstring_base;
65 typedef typename __vstring_base::_CharT_alloc_type _CharT_alloc_type;
70 typedef _Traits traits_type;
71 typedef typename _Traits::char_type value_type;
72 typedef _Alloc allocator_type;
73 typedef typename _CharT_alloc_type::size_type size_type;
74 typedef typename _CharT_alloc_type::difference_type difference_type;
75 typedef value_type& reference;
76 typedef const value_type& const_reference;
77 typedef typename _CharT_alloc_traits::pointer pointer;
78 typedef typename _CharT_alloc_traits::const_pointer const_pointer;
79 typedef __gnu_cxx::__normal_iterator<pointer, __versa_string> iterator;
80 typedef __gnu_cxx::__normal_iterator<const_pointer, __versa_string>
87 static const size_type
npos =
static_cast<size_type
>(-1);
91 _M_check(size_type __pos,
const char* __s)
const
93 if (__pos > this->
size())
94 std::__throw_out_of_range_fmt(__N(
"%s: __pos (which is %zu) > "
95 "this->size() (which is %zu)"),
96 __s, __pos, this->
size());
101 _M_check_length(size_type __n1, size_type __n2,
const char* __s)
const
104 std::__throw_length_error(__N(__s));
109 _M_limit(size_type __pos, size_type __off)
const _GLIBCXX_NOEXCEPT
111 const bool __testoff = __off < this->
size() - __pos;
112 return __testoff ? __off : this->
size() - __pos;
117 _M_disjunct(
const _CharT* __s)
const _GLIBCXX_NOEXCEPT
119 return (std::less<const _CharT*>()(__s, this->_M_data())
120 || std::less<const _CharT*>()(this->_M_data()
121 + this->
size(), __s));
127 _M_ibegin() const _GLIBCXX_NOEXCEPT
128 {
return iterator(this->_M_data()); }
131 _M_iend() const _GLIBCXX_NOEXCEPT
132 {
return iterator(this->_M_data() + this->_M_length()); }
144 : __vstring_base(__a) { }
152 : __vstring_base(__str) { }
154#if __cplusplus >= 201103L
172 const _Alloc& __a = _Alloc())
173 : __vstring_base(__l.
begin(), __l.
end(), __a) { }
183 size_type __n =
npos)
184 : __vstring_base(__str._M_data()
185 + __str._M_check(__pos,
186 "__versa_string::__versa_string"),
187 __str._M_data() + __str._M_limit(__pos, __n)
188 + __pos, _Alloc()) { }
198 size_type __n,
const _Alloc& __a)
199 : __vstring_base(__str._M_data()
200 + __str._M_check(__pos,
201 "__versa_string::__versa_string"),
202 __str._M_data() + __str._M_limit(__pos, __n)
215 const _Alloc& __a = _Alloc())
216 : __vstring_base(__s, __s + __n, __a) { }
224 : __vstring_base(__s, __s ? __s + traits_type::
length(__s) :
234 : __vstring_base(__n, __c, __a) { }
242#if __cplusplus >= 201103L
243 template<
class _InputIterator,
244 typename = std::_RequireInputIter<_InputIterator>>
246 template<
class _InputIterator>
249 const _Alloc& __a = _Alloc())
250 : __vstring_base(__beg, __end, __a) { }
263 {
return this->
assign(__str); }
265#if __cplusplus >= 201103L
288 this->
assign(__l.begin(), __l.end());
299 {
return this->
assign(__s); }
324 return iterator(this->_M_data());
333 {
return const_iterator(this->_M_data()); }
343 return iterator(this->_M_data() + this->
size());
351 end() const _GLIBCXX_NOEXCEPT
352 {
return const_iterator(this->_M_data() + this->
size()); }
361 {
return reverse_iterator(this->
end()); }
368 const_reverse_iterator
370 {
return const_reverse_iterator(this->
end()); }
379 {
return reverse_iterator(this->
begin()); }
386 const_reverse_iterator
388 {
return const_reverse_iterator(this->
begin()); }
390#if __cplusplus >= 201103L
397 {
return const_iterator(this->_M_data()); }
405 {
return const_iterator(this->_M_data() + this->
size()); }
412 const_reverse_iterator
414 {
return const_reverse_iterator(this->
end()); }
421 const_reverse_iterator
423 {
return const_reverse_iterator(this->
begin()); }
432 {
return this->_M_length(); }
438 {
return this->_M_length(); }
443 {
return this->_M_max_size(); }
470 { this->
resize(__n, _CharT()); }
472#if __cplusplus >= 201103L
493 {
return this->_M_capacity(); }
514 { this->_M_reserve(__res_arg); }
521 { this->_M_clear(); }
527 _GLIBCXX_NODISCARD
bool
529 {
return this->
size() == 0; }
545 __glibcxx_assert(__pos <= this->
size());
546 return this->_M_data()[__pos];
564 __glibcxx_assert(__pos <= this->
size());
566 _GLIBCXX_DEBUG_PEDASSERT(__cplusplus >= 201103L
567 || __pos < this->
size());
569 return this->_M_data()[__pos];
583 at(size_type __n)
const
585 if (__n >= this->
size())
586 std::__throw_out_of_range_fmt(__N(
"__versa_string::at: __n "
587 "(which is %zu) >= this->size() "
590 return this->_M_data()[__n];
607 if (__n >= this->
size())
608 std::__throw_out_of_range_fmt(__N(
"__versa_string::at: __n "
609 "(which is %zu) >= this->size() "
613 return this->_M_data()[__n];
616#if __cplusplus >= 201103L
658 {
return this->
append(__str); }
667 {
return this->
append(__s); }
681#if __cplusplus >= 201103L
689 {
return this->
append(__l.begin(), __l.end()); }
699 {
return _M_append(__str._M_data(), __str.
size()); }
716 {
return _M_append(__str._M_data()
717 + __str._M_check(__pos,
"__versa_string::append"),
718 __str._M_limit(__pos, __n)); }
729 __glibcxx_requires_string_len(__s, __n);
730 _M_check_length(size_type(0), __n,
"__versa_string::append");
731 return _M_append(__s, __n);
742 __glibcxx_requires_string(__s);
743 const size_type __n = traits_type::length(__s);
744 _M_check_length(size_type(0), __n,
"__versa_string::append");
745 return _M_append(__s, __n);
758 {
return _M_replace_aux(this->
size(), size_type(0), __n, __c); }
760#if __cplusplus >= 201103L
768 {
return this->
append(__l.begin(), __l.end()); }
779#if __cplusplus >= 201103L
780 template<
class _InputIterator,
781 typename = std::_RequireInputIter<_InputIterator>>
783 template<
class _InputIterator>
786 append(_InputIterator __first, _InputIterator __last)
787 {
return this->
replace(_M_iend(), _M_iend(), __first, __last); }
796 const size_type __size = this->
size();
797 if (__size + 1 > this->
capacity() || this->_M_is_shared())
798 this->_M_mutate(__size, size_type(0), 0, size_type(1));
799 traits_type::assign(this->_M_data()[__size], __c);
800 this->_M_set_length(__size + 1);
811 this->_M_assign(__str);
815#if __cplusplus >= 201103L
847 {
return _M_replace(size_type(0), this->
size(), __str._M_data()
848 + __str._M_check(__pos,
"__versa_string::assign"),
849 __str._M_limit(__pos, __n)); }
865 __glibcxx_requires_string_len(__s, __n);
866 return _M_replace(size_type(0), this->
size(), __s, __n);
881 __glibcxx_requires_string(__s);
882 return _M_replace(size_type(0), this->
size(), __s,
883 traits_type::length(__s));
897 {
return _M_replace_aux(size_type(0), this->
size(), __n, __c); }
908#if __cplusplus >= 201103L
909 template<
class _InputIterator,
910 typename = std::_RequireInputIter<_InputIterator>>
912 template<
class _InputIterator>
915 assign(_InputIterator __first, _InputIterator __last)
916 {
return this->
replace(_M_ibegin(), _M_iend(), __first, __last); }
918#if __cplusplus >= 201103L
926 {
return this->
assign(__l.begin(), __l.end()); }
929#if __cplusplus >= 201103L
946 insert(const_iterator __p, size_type __n, _CharT __c)
948 _GLIBCXX_DEBUG_PEDASSERT(__p >= _M_ibegin() && __p <= _M_iend());
949 const size_type __pos = __p - _M_ibegin();
950 this->
replace(__p, __p, __n, __c);
951 return iterator(this->_M_data() + __pos);
968 insert(iterator __p, size_type __n, _CharT __c)
969 { this->
replace(__p, __p, __n, __c); }
972#if __cplusplus >= 201103L
987 template<
class _InputIterator,
988 typename = std::_RequireInputIter<_InputIterator>>
990 insert(const_iterator __p, _InputIterator __beg, _InputIterator __end)
992 _GLIBCXX_DEBUG_PEDASSERT(__p >= _M_ibegin() && __p <= _M_iend());
993 const size_type __pos = __p - _M_ibegin();
994 this->
replace(__p, __p, __beg, __end);
995 return iterator(this->_M_data() + __pos);
1010 template<
class _InputIterator>
1012 insert(iterator __p, _InputIterator __beg, _InputIterator __end)
1013 { this->
replace(__p, __p, __beg, __end); }
1016#if __cplusplus >= 201103L
1027 {
return this->
insert(__p, __l.begin(), __l.end()); }
1044 {
return this->
replace(__pos1, size_type(0),
1045 __str._M_data(), __str.
size()); }
1067 size_type __pos2, size_type __n)
1068 {
return this->
replace(__pos1, size_type(0), __str._M_data()
1069 + __str._M_check(__pos2,
"__versa_string::insert"),
1070 __str._M_limit(__pos2, __n)); }
1089 insert(size_type __pos,
const _CharT* __s, size_type __n)
1090 {
return this->
replace(__pos, size_type(0), __s, __n); }
1110 __glibcxx_requires_string(__s);
1111 return this->
replace(__pos, size_type(0), __s,
1112 traits_type::length(__s));
1132 insert(size_type __pos, size_type __n, _CharT __c)
1133 {
return _M_replace_aux(_M_check(__pos,
"__versa_string::insert"),
1134 size_type(0), __n, __c); }
1150#if __cplusplus >= 201103L
1153 insert(iterator __p, _CharT __c)
1156 _GLIBCXX_DEBUG_PEDASSERT(__p >= _M_ibegin() && __p <= _M_iend());
1157 const size_type __pos = __p - _M_ibegin();
1158 _M_replace_aux(__pos, size_type(0), size_type(1), __c);
1159 this->_M_set_leaked();
1160 return iterator(this->_M_data() + __pos);
1181 this->_M_erase(_M_check(__pos,
"__versa_string::erase"),
1182 _M_limit(__pos, __n));
1195#if __cplusplus >= 201103L
1198 erase(iterator __position)
1201 _GLIBCXX_DEBUG_PEDASSERT(__position >= _M_ibegin()
1202 && __position < _M_iend());
1203 const size_type __pos = __position - _M_ibegin();
1204 this->_M_erase(__pos, size_type(1));
1205 this->_M_set_leaked();
1206 return iterator(this->_M_data() + __pos);
1220#if __cplusplus >= 201103L
1221 erase(const_iterator __first, const_iterator __last)
1223 erase(iterator __first, iterator __last)
1226 _GLIBCXX_DEBUG_PEDASSERT(__first >= _M_ibegin() && __first <= __last
1227 && __last <= _M_iend());
1228 const size_type __pos = __first - _M_ibegin();
1229 this->_M_erase(__pos, __last - __first);
1230 this->_M_set_leaked();
1231 return iterator(this->_M_data() + __pos);
1234#if __cplusplus >= 201103L
1242 { this->_M_erase(
size()-1, 1); }
1264 {
return this->
replace(__pos, __n, __str._M_data(), __str.
size()); }
1287 size_type __pos2, size_type __n2)
1289 return this->
replace(__pos1, __n1, __str._M_data()
1290 + __str._M_check(__pos2,
1291 "__versa_string::replace"),
1292 __str._M_limit(__pos2, __n2));
1314 replace(size_type __pos, size_type __n1,
const _CharT* __s,
1317 __glibcxx_requires_string_len(__s, __n2);
1318 return _M_replace(_M_check(__pos,
"__versa_string::replace"),
1319 _M_limit(__pos, __n1), __s, __n2);
1338 replace(size_type __pos, size_type __n1,
const _CharT* __s)
1340 __glibcxx_requires_string(__s);
1341 return this->
replace(__pos, __n1, __s, traits_type::length(__s));
1362 replace(size_type __pos, size_type __n1, size_type __n2, _CharT __c)
1363 {
return _M_replace_aux(_M_check(__pos,
"__versa_string::replace"),
1364 _M_limit(__pos, __n1), __n2, __c); }
1380#if __cplusplus >= 201103L
1386 {
return this->
replace(__i1, __i2, __str._M_data(), __str.
size()); }
1403#if __cplusplus >= 201103L
1405 const _CharT* __s, size_type __n)
1407 replace(iterator __i1, iterator __i2,
const _CharT* __s, size_type __n)
1410 _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
1411 && __i2 <= _M_iend());
1412 return this->
replace(__i1 - _M_ibegin(), __i2 - __i1, __s, __n);
1429#if __cplusplus >= 201103L
1430 replace(const_iterator __i1, const_iterator __i2,
const _CharT* __s)
1432 replace(iterator __i1, iterator __i2,
const _CharT* __s)
1435 __glibcxx_requires_string(__s);
1436 return this->
replace(__i1, __i2, __s, traits_type::length(__s));
1454#if __cplusplus >= 201103L
1455 replace(const_iterator __i1, const_iterator __i2, size_type __n,
1458 replace(iterator __i1, iterator __i2, size_type __n, _CharT __c)
1461 _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
1462 && __i2 <= _M_iend());
1463 return _M_replace_aux(__i1 - _M_ibegin(), __i2 - __i1, __n, __c);
1480#if __cplusplus >= 201103L
1481 template<
class _InputIterator,
1482 typename = std::_RequireInputIter<_InputIterator>>
1485 _InputIterator __k1, _InputIterator __k2)
1487 _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
1488 && __i2 <= _M_iend());
1489 __glibcxx_requires_valid_range(__k1, __k2);
1490 return this->_M_replace_dispatch(__i1, __i2, __k1, __k2,
1491 std::__false_type());
1494 template<
class _InputIterator>
1496 replace(iterator __i1, iterator __i2,
1497 _InputIterator __k1, _InputIterator __k2)
1499 _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
1500 && __i2 <= _M_iend());
1501 __glibcxx_requires_valid_range(__k1, __k2);
1502 typedef typename std::__is_integer<_InputIterator>::__type _Integral;
1503 return this->_M_replace_dispatch(__i1, __i2, __k1, __k2, _Integral());
1510#if __cplusplus >= 201103L
1511 replace(const_iterator __i1, const_iterator __i2,
1512 _CharT* __k1, _CharT* __k2)
1514 replace(iterator __i1, iterator __i2,
1515 _CharT* __k1, _CharT* __k2)
1518 _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
1519 && __i2 <= _M_iend());
1520 __glibcxx_requires_valid_range(__k1, __k2);
1521 return this->
replace(__i1 - _M_ibegin(), __i2 - __i1,
1526#if __cplusplus >= 201103L
1527 replace(const_iterator __i1, const_iterator __i2,
1528 const _CharT* __k1,
const _CharT* __k2)
1530 replace(iterator __i1, iterator __i2,
1531 const _CharT* __k1,
const _CharT* __k2)
1534 _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
1535 && __i2 <= _M_iend());
1536 __glibcxx_requires_valid_range(__k1, __k2);
1537 return this->
replace(__i1 - _M_ibegin(), __i2 - __i1,
1542#if __cplusplus >= 201103L
1543 replace(const_iterator __i1, const_iterator __i2,
1544 iterator __k1, iterator __k2)
1546 replace(iterator __i1, iterator __i2,
1547 iterator __k1, iterator __k2)
1550 _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
1551 && __i2 <= _M_iend());
1552 __glibcxx_requires_valid_range(__k1, __k2);
1553 return this->
replace(__i1 - _M_ibegin(), __i2 - __i1,
1554 __k1.base(), __k2 - __k1);
1558#if __cplusplus >= 201103L
1559 replace(const_iterator __i1, const_iterator __i2,
1560 const_iterator __k1, const_iterator __k2)
1562 replace(iterator __i1, iterator __i2,
1563 const_iterator __k1, const_iterator __k2)
1566 _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
1567 && __i2 <= _M_iend());
1568 __glibcxx_requires_valid_range(__k1, __k2);
1569 return this->
replace(__i1 - _M_ibegin(), __i2 - __i1,
1570 __k1.base(), __k2 - __k1);
1573#if __cplusplus >= 201103L
1590 {
return this->
replace(__i1, __i2, __l.begin(), __l.end()); }
1594 template<
class _Integer>
1596 _M_replace_dispatch(const_iterator __i1, const_iterator __i2,
1597 _Integer __n, _Integer __val, std::__true_type)
1598 {
return _M_replace_aux(__i1 - _M_ibegin(), __i2 - __i1, __n, __val); }
1600 template<
class _InputIterator>
1602 _M_replace_dispatch(const_iterator __i1, const_iterator __i2,
1603 _InputIterator __k1, _InputIterator __k2,
1607 _M_replace_aux(size_type __pos1, size_type __n1, size_type __n2,
1611 _M_replace(size_type __pos, size_type __len1,
const _CharT* __s,
1612 const size_type __len2);
1615 _M_append(
const _CharT* __s, size_type __n);
1632 copy(_CharT* __s, size_type __n, size_type __pos = 0)
const;
1643 { this->_M_swap(__s); }
1654 {
return this->_M_data(); }
1664 {
return this->_M_data(); }
1671 {
return allocator_type(this->_M_get_allocator()); }
1686 find(
const _CharT* __s, size_type __pos, size_type __n)
const;
1701 {
return this->
find(__str.
data(), __pos, __str.
size()); }
1714 find(
const _CharT* __s, size_type __pos = 0)
const
1716 __glibcxx_requires_string(__s);
1717 return this->
find(__s, __pos, traits_type::length(__s));
1731 find(_CharT __c, size_type __pos = 0) const _GLIBCXX_NOEXCEPT;
1746 {
return this->
rfind(__str.data(), __pos, __str.size()); }
1761 rfind(
const _CharT* __s, size_type __pos, size_type __n)
const;
1776 __glibcxx_requires_string(__s);
1777 return this->
rfind(__s, __pos, traits_type::length(__s));
1791 rfind(_CharT __c, size_type __pos =
npos)
const _GLIBCXX_NOEXCEPT;
1836 __glibcxx_requires_string(__s);
1837 return this->
find_first_of(__s, __pos, traits_type::length(__s));
1854 {
return this->
find(__c, __pos); }
1900 __glibcxx_requires_string(__s);
1901 return this->
find_last_of(__s, __pos, traits_type::length(__s));
1918 {
return this->
rfind(__c, __pos); }
1949 size_type __n)
const;
1964 __glibcxx_requires_string(__s);
1995 size_type __pos =
npos) const _GLIBCXX_NOEXCEPT
2012 size_type __n)
const;
2027 __glibcxx_requires_string(__s);
2060 return __versa_string(*
this, _M_check(__pos,
"__versa_string::substr"),
2081 if (this->_M_compare(__str))
2084 const size_type __size = this->
size();
2085 const size_type __osize = __str.
size();
2086 const size_type __len =
std::min(__size, __osize);
2088 int __r = traits_type::compare(this->_M_data(), __str.
data(), __len);
2090 __r = this->_S_compare(__size, __osize);
2142 size_type __pos2, size_type __n2)
const;
2184 compare(size_type __pos, size_type __n1,
const _CharT* __s)
const;
2211 compare(size_type __pos, size_type __n1,
const _CharT* __s,
2212 size_type __n2)
const;
2222 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2223 template <
typename,
typename,
typename>
class _Base>
2234 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2235 template <
typename,
typename,
typename>
class _Base>
2237 operator+(
const _CharT* __lhs,
2246 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2247 template <
typename,
typename,
typename>
class _Base>
2249 operator+(_CharT __lhs,
2258 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2259 template <
typename,
typename,
typename>
class _Base>
2262 const _CharT* __rhs);
2270 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2271 template <
typename,
typename,
typename>
class _Base>
2276#if __cplusplus >= 201103L
2277 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2278 template <
typename,
typename,
typename>
class _Base>
2282 {
return std::move(__lhs.append(__rhs)); }
2284 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2285 template <
typename,
typename,
typename>
class _Base>
2286 inline __versa_string<_CharT, _Traits, _Alloc, _Base>
2287 operator+(
const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,
2288 __versa_string<_CharT, _Traits, _Alloc, _Base>&& __rhs)
2289 {
return std::move(__rhs.insert(0, __lhs)); }
2291 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2292 template <
typename,
typename,
typename>
class _Base>
2297 const auto __size = __lhs.
size() + __rhs.size();
2298 const bool __cond = (__size > __lhs.capacity()
2299 && __size <= __rhs.capacity());
2300 return __cond ?
std::move(__rhs.insert(0, __lhs))
2301 : std::
move(__lhs.append(__rhs));
2304 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2305 template <
typename,
typename,
typename>
class _Base>
2307 operator+(
const _CharT* __lhs,
2309 {
return std::move(__rhs.insert(0, __lhs)); }
2311 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2312 template <
typename,
typename,
typename>
class _Base>
2314 operator+(_CharT __lhs,
2316 {
return std::move(__rhs.insert(0, 1, __lhs)); }
2318 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2319 template <
typename,
typename,
typename>
class _Base>
2322 const _CharT* __rhs)
2323 {
return std::move(__lhs.append(__rhs)); }
2325 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2326 template <
typename,
typename,
typename>
class _Base>
2330 {
return std::move(__lhs.append(1, __rhs)); }
2340 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2341 template <
typename,
typename,
typename>
class _Base>
2346 return __lhs.
size() == __rhs.
size()
2347 && !_Traits::compare(__lhs.
data(), __rhs.
data(), __lhs.
size());
2356 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2357 template <
typename,
typename,
typename>
class _Base>
2360 const _CharT* __rhs)
2362 return __lhs.
size() == _Traits::length(__rhs)
2363 && !_Traits::compare(__lhs.
data(), __rhs, __lhs.
size());
2372 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2373 template <
typename,
typename,
typename>
class _Base>
2375 operator==(
const _CharT* __lhs,
2377 {
return __rhs == __lhs; }
2386 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2387 template <
typename,
typename,
typename>
class _Base>
2391 {
return !(__lhs == __rhs); }
2399 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2400 template <
typename,
typename,
typename>
class _Base>
2402 operator!=(
const _CharT* __lhs,
2404 {
return !(__rhs == __lhs); }
2412 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2413 template <
typename,
typename,
typename>
class _Base>
2416 const _CharT* __rhs)
2417 {
return !(__lhs == __rhs); }
2426 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2427 template <
typename,
typename,
typename>
class _Base>
2431 {
return __lhs.
compare(__rhs) < 0; }
2439 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2440 template <
typename,
typename,
typename>
class _Base>
2443 const _CharT* __rhs)
2444 {
return __lhs.
compare(__rhs) < 0; }
2452 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2453 template <
typename,
typename,
typename>
class _Base>
2455 operator<(
const _CharT* __lhs,
2457 {
return __rhs.
compare(__lhs) > 0; }
2466 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2467 template <
typename,
typename,
typename>
class _Base>
2471 {
return __lhs.
compare(__rhs) > 0; }
2479 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2480 template <
typename,
typename,
typename>
class _Base>
2483 const _CharT* __rhs)
2484 {
return __lhs.
compare(__rhs) > 0; }
2492 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2493 template <
typename,
typename,
typename>
class _Base>
2495 operator>(
const _CharT* __lhs,
2497 {
return __rhs.
compare(__lhs) < 0; }
2506 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2507 template <
typename,
typename,
typename>
class _Base>
2511 {
return __lhs.
compare(__rhs) <= 0; }
2519 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2520 template <
typename,
typename,
typename>
class _Base>
2523 const _CharT* __rhs)
2524 {
return __lhs.
compare(__rhs) <= 0; }
2532 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2533 template <
typename,
typename,
typename>
class _Base>
2535 operator<=(
const _CharT* __lhs,
2537 {
return __rhs.
compare(__lhs) >= 0; }
2546 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2547 template <
typename,
typename,
typename>
class _Base>
2551 {
return __lhs.
compare(__rhs) >= 0; }
2559 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2560 template <
typename,
typename,
typename>
class _Base>
2563 const _CharT* __rhs)
2564 {
return __lhs.
compare(__rhs) >= 0; }
2572 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2573 template <
typename,
typename,
typename>
class _Base>
2575 operator>=(
const _CharT* __lhs,
2577 {
return __rhs.
compare(__lhs) <= 0; }
2586 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2587 template <
typename,
typename,
typename>
class _Base>
2591 { __lhs.
swap(__rhs); }
2593_GLIBCXX_END_NAMESPACE_VERSION
2596namespace std _GLIBCXX_VISIBILITY(default)
2598_GLIBCXX_BEGIN_NAMESPACE_VERSION
2612 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2613 template <
typename,
typename,
typename>
class _Base>
2617 _Alloc, _Base>& __str);
2628 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2629 template <
typename,
typename,
typename>
class _Base>
2637 return __ostream_insert(__os, __str.
data(), __str.
size());
2654 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2655 template <
typename,
typename,
typename>
class _Base>
2656 basic_istream<_CharT, _Traits>&
2657 getline(basic_istream<_CharT, _Traits>& __is,
2674 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2675 template <
typename,
typename,
typename>
class _Base>
2676 inline basic_istream<_CharT, _Traits>&
2681_GLIBCXX_END_NAMESPACE_VERSION
2684#if __cplusplus >= 201103L
2688namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
2690_GLIBCXX_BEGIN_NAMESPACE_VERSION
2692#if _GLIBCXX_USE_C99_STDLIB
2695 stoi(
const __vstring& __str, std::size_t* __idx = 0,
int __base = 10)
2696 {
return __gnu_cxx::__stoa<long, int>(&std::strtol,
"stoi", __str.c_str(),
2700 stol(
const __vstring& __str, std::size_t* __idx = 0,
int __base = 10)
2701 {
return __gnu_cxx::__stoa(&std::strtol,
"stol", __str.c_str(),
2704 inline unsigned long
2705 stoul(
const __vstring& __str, std::size_t* __idx = 0,
int __base = 10)
2706 {
return __gnu_cxx::__stoa(&std::strtoul,
"stoul", __str.c_str(),
2710 stoll(
const __vstring& __str, std::size_t* __idx = 0,
int __base = 10)
2711 {
return __gnu_cxx::__stoa(&std::strtoll,
"stoll", __str.c_str(),
2714 inline unsigned long long
2715 stoull(
const __vstring& __str, std::size_t* __idx,
int __base = 10)
2716 {
return __gnu_cxx::__stoa(&std::strtoull,
"stoull", __str.c_str(),
2721 stof(
const __vstring& __str, std::size_t* __idx = 0)
2722 {
return __gnu_cxx::__stoa(&std::strtof,
"stof", __str.c_str(), __idx); }
2725 stod(
const __vstring& __str, std::size_t* __idx = 0)
2726 {
return __gnu_cxx::__stoa(&std::strtod,
"stod", __str.c_str(), __idx); }
2729 stold(
const __vstring& __str, std::size_t* __idx = 0)
2730 {
return __gnu_cxx::__stoa(&std::strtold,
"stold", __str.c_str(), __idx); }
2733#if _GLIBCXX_USE_C99_STDIO
2738 to_string(
int __val)
2739 {
return __gnu_cxx::__to_xstring<__vstring>(&std::vsnprintf, 4 *
sizeof(
int),
2743 to_string(
unsigned __val)
2744 {
return __gnu_cxx::__to_xstring<__vstring>(&std::vsnprintf,
2745 4 *
sizeof(
unsigned),
2749 to_string(
long __val)
2750 {
return __gnu_cxx::__to_xstring<__vstring>(&std::vsnprintf,
2755 to_string(
unsigned long __val)
2756 {
return __gnu_cxx::__to_xstring<__vstring>(&std::vsnprintf,
2757 4 *
sizeof(
unsigned long),
2762 to_string(
long long __val)
2763 {
return __gnu_cxx::__to_xstring<__vstring>(&std::vsnprintf,
2764 4 *
sizeof(
long long),
2768 to_string(
unsigned long long __val)
2769 {
return __gnu_cxx::__to_xstring<__vstring>(&std::vsnprintf,
2770 4 *
sizeof(
unsigned long long),
2774 to_string(
float __val)
2776 const int __n = __numeric_traits<float>::__max_exponent10 + 20;
2777 return __gnu_cxx::__to_xstring<__vstring>(&std::vsnprintf, __n,
2782 to_string(
double __val)
2784 const int __n = __numeric_traits<double>::__max_exponent10 + 20;
2785 return __gnu_cxx::__to_xstring<__vstring>(&std::vsnprintf, __n,
2790 to_string(
long double __val)
2792 const int __n = __numeric_traits<long double>::__max_exponent10 + 20;
2793 return __gnu_cxx::__to_xstring<__vstring>(&std::vsnprintf, __n,
2798#if defined(_GLIBCXX_USE_WCHAR_T) && _GLIBCXX_USE_C99_WCHAR
2800 stoi(
const __wvstring& __str, std::size_t* __idx = 0,
int __base = 10)
2801 {
return __gnu_cxx::__stoa<long, int>(&std::wcstol,
"stoi", __str.c_str(),
2805 stol(
const __wvstring& __str, std::size_t* __idx = 0,
int __base = 10)
2806 {
return __gnu_cxx::__stoa(&std::wcstol,
"stol", __str.c_str(),
2809 inline unsigned long
2810 stoul(
const __wvstring& __str, std::size_t* __idx = 0,
int __base = 10)
2811 {
return __gnu_cxx::__stoa(&std::wcstoul,
"stoul", __str.c_str(),
2815 stoll(
const __wvstring& __str, std::size_t* __idx = 0,
int __base = 10)
2816 {
return __gnu_cxx::__stoa(&std::wcstoll,
"stoll", __str.c_str(),
2819 inline unsigned long long
2820 stoull(
const __wvstring& __str, std::size_t* __idx = 0,
int __base = 10)
2821 {
return __gnu_cxx::__stoa(&std::wcstoull,
"stoull", __str.c_str(),
2826 stof(
const __wvstring& __str, std::size_t* __idx = 0)
2827 {
return __gnu_cxx::__stoa(&std::wcstof,
"stof", __str.c_str(), __idx); }
2830 stod(
const __wvstring& __str, std::size_t* __idx = 0)
2831 {
return __gnu_cxx::__stoa(&std::wcstod,
"stod", __str.c_str(), __idx); }
2834 stold(
const __wvstring& __str, std::size_t* __idx = 0)
2835 {
return __gnu_cxx::__stoa(&std::wcstold,
"stold", __str.c_str(), __idx); }
2837#ifndef _GLIBCXX_HAVE_BROKEN_VSWPRINTF
2840 to_wstring(
int __val)
2841 {
return __gnu_cxx::__to_xstring<__wvstring>(&std::vswprintf,
2846 to_wstring(
unsigned __val)
2847 {
return __gnu_cxx::__to_xstring<__wvstring>(&std::vswprintf,
2848 4 *
sizeof(
unsigned),
2852 to_wstring(
long __val)
2853 {
return __gnu_cxx::__to_xstring<__wvstring>(&std::vswprintf,
2858 to_wstring(
unsigned long __val)
2859 {
return __gnu_cxx::__to_xstring<__wvstring>(&std::vswprintf,
2860 4 *
sizeof(
unsigned long),
2864 to_wstring(
long long __val)
2865 {
return __gnu_cxx::__to_xstring<__wvstring>(&std::vswprintf,
2866 4 *
sizeof(
long long),
2870 to_wstring(
unsigned long long __val)
2871 {
return __gnu_cxx::__to_xstring<__wvstring>(&std::vswprintf,
2872 4 *
sizeof(
unsigned long long),
2876 to_wstring(
float __val)
2878 const int __n = __numeric_traits<float>::__max_exponent10 + 20;
2879 return __gnu_cxx::__to_xstring<__wvstring>(&std::vswprintf, __n,
2884 to_wstring(
double __val)
2886 const int __n = __numeric_traits<double>::__max_exponent10 + 20;
2887 return __gnu_cxx::__to_xstring<__wvstring>(&std::vswprintf, __n,
2892 to_wstring(
long double __val)
2894 const int __n = __numeric_traits<long double>::__max_exponent10 + 20;
2895 return __gnu_cxx::__to_xstring<__wvstring>(&std::vswprintf, __n,
2901_GLIBCXX_END_NAMESPACE_VERSION
2906#if __cplusplus >= 201103L
2910namespace std _GLIBCXX_VISIBILITY(default)
2912_GLIBCXX_BEGIN_NAMESPACE_VERSION
2917 :
public __hash_base<size_t, __gnu_cxx::__vstring>
2920 operator()(
const __gnu_cxx::__vstring& __s)
const noexcept
2921 {
return std::_Hash_impl::hash(__s.
data(), __s.
length()); }
2927 :
public __hash_base<size_t, __gnu_cxx::__wvstring>
2930 operator()(
const __gnu_cxx::__wvstring& __s)
const noexcept
2931 {
return std::_Hash_impl::hash(__s.
data(),
2932 __s.
length() *
sizeof(
wchar_t)); }
2938 :
public __hash_base<size_t, __gnu_cxx::__u16vstring>
2941 operator()(
const __gnu_cxx::__u16vstring& __s)
const noexcept
2942 {
return std::_Hash_impl::hash(__s.
data(),
2943 __s.
length() *
sizeof(
char16_t)); }
2949 :
public __hash_base<size_t, __gnu_cxx::__u32vstring>
2952 operator()(
const __gnu_cxx::__u32vstring& __s)
const noexcept
2953 {
return std::_Hash_impl::hash(__s.
data(),
2954 __s.
length() *
sizeof(
char32_t)); }
2957_GLIBCXX_END_NAMESPACE_VERSION
constexpr std::remove_reference< _Tp >::type && move(_Tp &&__t) noexcept
Convert a value to an rvalue.
constexpr const _Tp & min(const _Tp &, const _Tp &)
This does what you think it does.
ISO C++ entities toplevel namespace is std.
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.
std::basic_istream< _CharT, _Traits > & operator>>(std::basic_istream< _CharT, _Traits > &__is, bitset< _Nb > &__x)
Global I/O operators for bitsets.
std::basic_ostream< _CharT, _Traits > & operator<<(std::basic_ostream< _CharT, _Traits > &__os, const bitset< _Nb > &__x)
Global I/O operators for bitsets.
GNU extensions for public use.
char_type widen(char __c) const
Widens characters.
Template class basic_istream.
Template class basic_ostream.
Primary class template hash.
Uniform interface to C++98 and C++11 allocators.
Template class __versa_string.
__versa_string & assign(const _CharT *__s)
Set value to contents of a C string.
int compare(size_type __pos, size_type __n1, const _CharT *__s) const
Compare substring to a C string.
void swap(__versa_string &__s) noexcept
Swap contents with another string.
reverse_iterator rend() noexcept
iterator begin() noexcept
__versa_string & replace(size_type __pos, size_type __n1, const _CharT *__s)
Replace characters with value of a C string.
iterator insert(const_iterator __p, _CharT __c)
Insert one character.
size_type find_last_of(const _CharT *__s, size_type __pos=npos) const
Find last position of a character of C string.
__versa_string & insert(size_type __pos1, const __versa_string &__str)
Insert value of a string.
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 & replace(size_type __pos, size_type __n1, const _CharT *__s, size_type __n2)
Replace characters with value of 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.
size_type find(const _CharT *__s, size_type __pos, size_type __n) const
Find position of a C substring.
__versa_string & insert(size_type __pos, size_type __n, _CharT __c)
Insert multiple characters.
const_reference at(size_type __n) const
Provides access to the data contained in the string.
__versa_string & replace(const_iterator __i1, const_iterator __i2, const _CharT *__s)
Replace range of characters with C string.
static const size_type npos
__versa_string & operator=(_CharT __c)
Set value to string of length 1.
size_type find_first_of(_CharT __c, size_type __pos=0) const noexcept
Find position of a character.
size_type find_first_not_of(const _CharT *__s, size_type __pos, size_type __n) const
Find position of a character not in C substring.
const_reference front() const noexcept
size_type find_last_not_of(_CharT __c, size_type __pos=npos) const noexcept
Find last position of a different character.
__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.
__versa_string & operator+=(const _CharT *__s)
Append a C string.
__versa_string & append(std::initializer_list< _CharT > __l)
Append an initializer_list of characters.
int compare(const _CharT *__s) const
Compare to a C string.
__versa_string & append(_InputIterator __first, _InputIterator __last)
Append a range of characters.
__versa_string & operator=(const __versa_string &__str)
Assign the value of str to this string.
size_type find_last_not_of(const __versa_string &__str, size_type __pos=npos) const noexcept
const_iterator cend() const noexcept
__versa_string & operator+=(const __versa_string &__str)
Append a string to this string.
__versa_string & insert(size_type __pos, const _CharT *__s, size_type __n)
Insert a C substring.
size_type find_first_of(const __versa_string &__str, size_type __pos=0) const noexcept
Find position of a character of string.
__versa_string(_InputIterator __beg, _InputIterator __end, const _Alloc &__a=_Alloc())
Construct string as copy of a range.
__versa_string & replace(const_iterator __i1, const_iterator __i2, size_type __n, _CharT __c)
Replace range of characters with multiple characters.
__versa_string & append(const _CharT *__s, size_type __n)
Append a C substring.
__versa_string & append(const __versa_string &__str, size_type __pos, size_type __n)
Append a substring.
__versa_string(const _Alloc &__a=_Alloc()) noexcept
Construct an empty string using allocator a.
__versa_string & append(const __versa_string &__str)
Append a string to this string.
size_type find(const __versa_string &__str, size_type __pos=0) const noexcept
Find position of a string.
size_type find(_CharT __c, size_type __pos=0) const noexcept
Find position of a character.
const_reverse_iterator rbegin() 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 rfind(_CharT __c, size_type __pos=npos) const noexcept
Find last position of a character.
__versa_string(std::initializer_list< _CharT > __l, const _Alloc &__a=_Alloc())
Construct string from an initializer list.
__versa_string & operator+=(_CharT __c)
Append a character.
void resize(size_type __n, _CharT __c)
Resizes the string to the specified number of characters.
__versa_string & assign(const __versa_string &__str)
Set value to contents of another string.
__versa_string & operator=(const _CharT *__s)
Copy contents of __s into this string.
allocator_type get_allocator() const noexcept
Return copy of allocator used to construct this string.
int compare(size_type __pos1, size_type __n1, const __versa_string &__str, size_type __pos2, size_type __n2) const
Compare substring to a substring.
__versa_string & assign(__versa_string &&__str) noexcept
Set value to contents of another string.
iterator erase(const_iterator __position)
Remove one character.
size_type capacity() const noexcept
__versa_string & assign(const __versa_string &__str, size_type __pos, size_type __n)
Set value to a substring of a string.
int compare(size_type __pos, size_type __n1, const _CharT *__s, size_type __n2) const
Compare substring against a character array.
__versa_string & operator=(std::initializer_list< _CharT > __l)
Set value to string constructed from initializer list.
iterator insert(const_iterator __p, std::initializer_list< _CharT > __l)
Insert an initializer_list of characters.
size_type find_last_not_of(const _CharT *__s, size_type __pos, size_type __n) const
Find last position of a character not in C substring.
__versa_string & replace(const_iterator __i1, const_iterator __i2, const _CharT *__s, size_type __n)
Replace range of characters with C substring.
~__versa_string() noexcept
Destroy the string instance.
reference back() noexcept
size_type rfind(const _CharT *__s, size_type __pos, size_type __n) const
Find last position of a C substring.
size_type find_first_not_of(const _CharT *__s, size_type __pos=0) const
Find position of a character not in C string.
reference at(size_type __n)
Provides access to the data contained in the string.
iterator erase(const_iterator __first, const_iterator __last)
Remove a range of characters.
__versa_string(__versa_string &&__str) noexcept
String move constructor.
size_type length() const noexcept
size_type size() const noexcept
Returns the number of characters in the string, not including any null-termination.
const _CharT * c_str() const noexcept
Return const pointer to null-terminated contents.
const _CharT * data() const noexcept
Return const pointer to contents.
int compare(const __versa_string &__str) const
Compare to a string.
void shrink_to_fit() noexcept
A non-binding request to reduce capacity() to size().
__versa_string(size_type __n, _CharT __c, const _Alloc &__a=_Alloc())
Construct string as multiple characters.
bool empty() const noexcept
reference operator[](size_type __pos) noexcept
Subscript access to the data contained in the string.
__versa_string(const _CharT *__s, size_type __n, const _Alloc &__a=_Alloc())
Construct string initialized by a character array.
iterator insert(const_iterator __p, _InputIterator __beg, _InputIterator __end)
Insert a range of characters.
__versa_string & insert(size_type __pos1, const __versa_string &__str, size_type __pos2, size_type __n)
Insert a substring.
size_type find_first_not_of(_CharT __c, size_type __pos=0) const noexcept
Find position of a different character.
const_reference back() const noexcept
__versa_string & insert(size_type __pos, const _CharT *__s)
Insert a C string.
void resize(size_type __n)
Resizes the string to the specified number of characters.
const_reverse_iterator crbegin() const noexcept
const_iterator begin() const noexcept
const_reverse_iterator rend() const noexcept
const_reference operator[](size_type __pos) const noexcept
Subscript access to the data contained in the string.
__versa_string substr(size_type __pos=0, size_type __n=npos) const
Get a substring.
__versa_string(const _CharT *__s, const _Alloc &__a=_Alloc())
Construct string as copy of a C string.
__versa_string & assign(size_type __n, _CharT __c)
Set value to multiple characters.
__versa_string(const __versa_string &__str, size_type __pos, size_type __n=npos)
Construct string as copy of a substring.
__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.
__versa_string & erase(size_type __pos=0, size_type __n=npos)
Remove characters.
__versa_string & append(size_type __n, _CharT __c)
Append multiple characters.
int compare(size_type __pos, size_type __n, const __versa_string &__str) const
Compare substring to a string.
__versa_string & append(const _CharT *__s)
Append a C string.
size_type max_size() const noexcept
Returns the size() of the largest possible string.
size_type find_first_of(const _CharT *__s, size_type __pos, size_type __n) const
Find position of a character of C substring.
const_iterator end() const noexcept
__versa_string & assign(_InputIterator __first, _InputIterator __last)
Set value to a range of characters.
const_iterator cbegin() const noexcept
__versa_string & assign(std::initializer_list< _CharT > __l)
Set value to an initializer_list of characters.
__versa_string & replace(const_iterator __i1, const_iterator __i2, const __versa_string &__str)
Replace range of characters with string.
__versa_string & replace(const_iterator __i1, const_iterator __i2, std::initializer_list< _CharT > __l)
Replace range of characters with initializer_list.
size_type rfind(const _CharT *__s, size_type __pos=npos) const
Find last position of a C string.
size_type copy(_CharT *__s, size_type __n, size_type __pos=0) const
Copy substring into C string.
__versa_string & operator=(__versa_string &&__str) noexcept
String move assignment operator.
size_type find_first_of(const _CharT *__s, size_type __pos=0) const
Find position of a character of C string.
size_type find_last_of(const _CharT *__s, size_type __pos, size_type __n) const
Find last position of a character of C substring.
iterator insert(const_iterator __p, size_type __n, _CharT __c)
Insert multiple characters.
void push_back(_CharT __c)
Append a single character.
__versa_string & operator+=(std::initializer_list< _CharT > __l)
Append an initializer_list of characters.
size_type find_last_of(_CharT __c, size_type __pos=npos) const noexcept
Find last position of a character.
reference front() noexcept
__versa_string & replace(size_type __pos, size_type __n, const __versa_string &__str)
Replace characters with value from another string.
__versa_string(const __versa_string &__str)
Construct string with copy of value of __str.
void reserve(size_type __res_arg=0)
Attempt to preallocate enough memory for specified number of characters.
__versa_string & assign(const _CharT *__s, size_type __n)
Set value to a C substring.
size_type rfind(const __versa_string &__str, size_type __pos=npos) const noexcept
const_reverse_iterator crend() const noexcept
void pop_back()
Remove the last character.
__versa_string & replace(const_iterator __i1, const_iterator __i2, _InputIterator __k1, _InputIterator __k2)
Replace range of characters with range.
reverse_iterator rbegin() noexcept
size_type find(const _CharT *__s, size_type __pos=0) const
Find position of a C string.