32 #pragma GCC system_header
34 #include <initializer_list>
47 template<typename _CharT, typename _Traits, typename _Alloc,
48 template <typename, typename, typename> class _Base>
50 : private _Base<_CharT, _Traits, _Alloc>
52 typedef _Base<_CharT, _Traits, _Alloc> __vstring_base;
53 typedef typename __vstring_base::_CharT_alloc_type _CharT_alloc_type;
57 typedef _Traits traits_type;
58 typedef typename _Traits::char_type value_type;
59 typedef _Alloc allocator_type;
60 typedef typename _CharT_alloc_type::size_type size_type;
61 typedef typename _CharT_alloc_type::difference_type difference_type;
62 typedef typename _CharT_alloc_type::reference reference;
63 typedef typename _CharT_alloc_type::const_reference const_reference;
64 typedef typename _CharT_alloc_type::pointer pointer;
65 typedef typename _CharT_alloc_type::const_pointer const_pointer;
66 typedef __gnu_cxx::__normal_iterator<pointer, __versa_string> iterator;
67 typedef __gnu_cxx::__normal_iterator<const_pointer, __versa_string>
74 static const size_type npos =
static_cast<size_type
>(-1);
78 _M_check(size_type __pos,
const char* __s)
const
80 if (__pos > this->size())
81 std::__throw_out_of_range(__N(__s));
86 _M_check_length(size_type __n1, size_type __n2,
const char* __s)
const
88 if (this->max_size() - (this->size() - __n1) < __n2)
89 std::__throw_length_error(__N(__s));
94 _M_limit(size_type __pos, size_type __off)
const
96 const bool __testoff = __off < this->size() - __pos;
97 return __testoff ? __off : this->size() - __pos;
102 _M_disjunct(
const _CharT* __s)
const
106 + this->size(), __s));
113 {
return iterator(this->_M_data()); }
117 {
return iterator(this->_M_data() + this->_M_length()); }
128 : __vstring_base() { }
135 : __vstring_base(__a) { }
143 : __vstring_base(__str) { }
145 #ifdef __GXX_EXPERIMENTAL_CXX0X__
155 : __vstring_base(
std::forward<__vstring_base>(__str)) { }
163 const _Alloc& __a = _Alloc())
164 : __vstring_base(__l.begin(), __l.end(), __a) { }
174 size_type __n = npos)
175 : __vstring_base(__str._M_data()
176 + __str._M_check(__pos,
177 "__versa_string::__versa_string"),
178 __str._M_data() + __str._M_limit(__pos, __n)
179 + __pos, _Alloc()) { }
189 size_type __n,
const _Alloc& __a)
190 : __vstring_base(__str._M_data()
191 + __str._M_check(__pos,
192 "__versa_string::__versa_string"),
193 __str._M_data() + __str._M_limit(__pos, __n)
206 const _Alloc& __a = _Alloc())
207 : __vstring_base(__s, __s + __n, __a) { }
215 : __vstring_base(__s, __s ? __s + traits_type::length(__s) :
225 : __vstring_base(__n, __c, __a) { }
233 template<
class _InputIterator>
235 const _Alloc& __a = _Alloc())
236 : __vstring_base(__beg, __end, __a) { }
249 {
return this->assign(__str); }
251 #ifdef __GXX_EXPERIMENTAL_CXX0X__
274 this->assign(__l.begin(), __l.end());
285 {
return this->assign(__s); }
297 this->assign(1, __c);
310 return iterator(this->_M_data());
319 {
return const_iterator(this->_M_data()); }
329 return iterator(this->_M_data() + this->size());
338 {
return const_iterator(this->_M_data() + this->size()); }
347 {
return reverse_iterator(this->end()); }
354 const_reverse_iterator
356 {
return const_reverse_iterator(this->end()); }
365 {
return reverse_iterator(this->begin()); }
372 const_reverse_iterator
374 {
return const_reverse_iterator(this->begin()); }
376 #ifdef __GXX_EXPERIMENTAL_CXX0X__
383 {
return const_iterator(this->_M_data()); }
391 {
return const_iterator(this->_M_data() + this->size()); }
398 const_reverse_iterator
400 {
return const_reverse_iterator(this->end()); }
407 const_reverse_iterator
409 {
return const_reverse_iterator(this->begin()); }
418 {
return this->_M_length(); }
424 {
return this->_M_length(); }
429 {
return this->_M_max_size(); }
442 resize(size_type __n, _CharT __c);
456 { this->resize(__n, _CharT()); }
464 {
return this->_M_capacity(); }
485 { this->_M_reserve(__res_arg); }
492 { this->_M_clear(); }
499 {
return this->size() == 0; }
513 operator[] (size_type __pos)
const
515 _GLIBCXX_DEBUG_ASSERT(__pos <= this->size());
516 return this->_M_data()[__pos];
533 _GLIBCXX_DEBUG_ASSERT(__pos <= this->size());
535 _GLIBCXX_DEBUG_PEDASSERT(__pos < this->size());
537 return this->_M_data()[__pos];
551 at(size_type __n)
const
553 if (__n >= this->size())
554 std::__throw_out_of_range(__N(
"__versa_string::at"));
555 return this->_M_data()[__n];
572 if (__n >= this->size())
573 std::__throw_out_of_range(__N(
"__versa_string::at"));
575 return this->_M_data()[__n];
578 #ifdef __GXX_EXPERIMENTAL_CXX0X__
601 {
return *(end() - 1); }
609 {
return *(end() - 1); }
620 {
return this->append(__str); }
629 {
return this->append(__s); }
639 this->push_back(__c);
643 #ifdef __GXX_EXPERIMENTAL_CXX0X__
651 {
return this->append(__l.begin(), __l.end()); }
652 #endif // __GXX_EXPERIMENTAL_CXX0X__
661 {
return _M_append(__str._M_data(), __str.
size()); }
678 {
return _M_append(__str._M_data()
679 + __str._M_check(__pos,
"__versa_string::append"),
680 __str._M_limit(__pos, __n)); }
691 __glibcxx_requires_string_len(__s, __n);
692 _M_check_length(size_type(0), __n,
"__versa_string::append");
693 return _M_append(__s, __n);
704 __glibcxx_requires_string(__s);
705 const size_type __n = traits_type::length(__s);
706 _M_check_length(size_type(0), __n,
"__versa_string::append");
707 return _M_append(__s, __n);
720 {
return _M_replace_aux(this->size(), size_type(0), __n, __c); }
722 #ifdef __GXX_EXPERIMENTAL_CXX0X__
729 append(std::initializer_list<_CharT> __l)
730 {
return this->append(__l.begin(), __l.end()); }
731 #endif // __GXX_EXPERIMENTAL_CXX0X__
741 template<
class _InputIterator>
743 append(_InputIterator __first, _InputIterator __last)
744 {
return this->replace(_M_iend(), _M_iend(), __first, __last); }
753 const size_type __size = this->size();
754 if (__size + 1 > this->capacity() || this->_M_is_shared())
755 this->_M_mutate(__size, size_type(0), 0, size_type(1));
756 traits_type::assign(this->_M_data()[__size], __c);
757 this->_M_set_length(__size + 1);
768 this->_M_assign(__str);
787 {
return _M_replace(size_type(0), this->size(), __str._M_data()
788 + __str._M_check(__pos,
"__versa_string::assign"),
789 __str._M_limit(__pos, __n)); }
805 __glibcxx_requires_string_len(__s, __n);
806 return _M_replace(size_type(0), this->size(), __s, __n);
821 __glibcxx_requires_string(__s);
822 return _M_replace(size_type(0), this->size(), __s,
823 traits_type::length(__s));
837 {
return _M_replace_aux(size_type(0), this->size(), __n, __c); }
848 template<
class _InputIterator>
850 assign(_InputIterator __first, _InputIterator __last)
851 {
return this->replace(_M_ibegin(), _M_iend(), __first, __last); }
853 #ifdef __GXX_EXPERIMENTAL_CXX0X__
860 assign(std::initializer_list<_CharT> __l)
861 {
return this->assign(__l.begin(), __l.end()); }
862 #endif // __GXX_EXPERIMENTAL_CXX0X__
878 insert(iterator __p, size_type __n, _CharT __c)
879 { this->replace(__p, __p, __n, __c); }
893 template<
class _InputIterator>
895 insert(iterator __p, _InputIterator __beg, _InputIterator __end)
896 { this->replace(__p, __p, __beg, __end); }
898 #ifdef __GXX_EXPERIMENTAL_CXX0X__
906 insert(iterator __p, std::initializer_list<_CharT> __l)
907 { this->insert(__p, __l.begin(), __l.end()); }
908 #endif // __GXX_EXPERIMENTAL_CXX0X__
924 {
return this->replace(__pos1, size_type(0),
925 __str._M_data(), __str.
size()); }
947 size_type __pos2, size_type __n)
948 {
return this->replace(__pos1, size_type(0), __str._M_data()
949 + __str._M_check(__pos2,
"__versa_string::insert"),
950 __str._M_limit(__pos2, __n)); }
969 insert(size_type __pos,
const _CharT* __s, size_type __n)
970 {
return this->replace(__pos, size_type(0), __s, __n); }
988 insert(size_type __pos,
const _CharT* __s)
990 __glibcxx_requires_string(__s);
991 return this->replace(__pos, size_type(0), __s,
992 traits_type::length(__s));
1012 insert(size_type __pos, size_type __n, _CharT __c)
1013 {
return _M_replace_aux(_M_check(__pos,
"__versa_string::insert"),
1014 size_type(0), __n, __c); }
1032 _GLIBCXX_DEBUG_PEDASSERT(__p >= _M_ibegin() && __p <= _M_iend());
1033 const size_type __pos = __p - _M_ibegin();
1034 _M_replace_aux(__pos, size_type(0), size_type(1), __c);
1035 this->_M_set_leaked();
1036 return iterator(this->_M_data() + __pos);
1055 erase(size_type __pos = 0, size_type __n = npos)
1057 this->_M_erase(_M_check(__pos,
"__versa_string::erase"),
1058 _M_limit(__pos, __n));
1073 _GLIBCXX_DEBUG_PEDASSERT(__position >= _M_ibegin()
1074 && __position < _M_iend());
1075 const size_type __pos = __position - _M_ibegin();
1076 this->_M_erase(__pos, size_type(1));
1077 this->_M_set_leaked();
1078 return iterator(this->_M_data() + __pos);
1092 erase(iterator __first, iterator __last)
1094 _GLIBCXX_DEBUG_PEDASSERT(__first >= _M_ibegin() && __first <= __last
1095 && __last <= _M_iend());
1096 const size_type __pos = __first - _M_ibegin();
1097 this->_M_erase(__pos, __last - __first);
1098 this->_M_set_leaked();
1099 return iterator(this->_M_data() + __pos);
1121 {
return this->replace(__pos, __n, __str._M_data(), __str.
size()); }
1144 size_type __pos2, size_type __n2)
1146 return this->replace(__pos1, __n1, __str._M_data()
1147 + __str._M_check(__pos2,
1148 "__versa_string::replace"),
1149 __str._M_limit(__pos2, __n2));
1171 replace(size_type __pos, size_type __n1,
const _CharT* __s,
1174 __glibcxx_requires_string_len(__s, __n2);
1175 return _M_replace(_M_check(__pos,
"__versa_string::replace"),
1176 _M_limit(__pos, __n1), __s, __n2);
1196 replace(size_type __pos, size_type __n1,
const _CharT* __s)
1198 __glibcxx_requires_string(__s);
1199 return this->replace(__pos, __n1, __s, traits_type::length(__s));
1220 replace(size_type __pos, size_type __n1, size_type __n2, _CharT __c)
1221 {
return _M_replace_aux(_M_check(__pos,
"__versa_string::replace"),
1222 _M_limit(__pos, __n1), __n2, __c); }
1239 {
return this->replace(__i1, __i2, __str._M_data(), __str.
size()); }
1256 replace(iterator __i1, iterator __i2,
const _CharT* __s, size_type __n)
1258 _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
1259 && __i2 <= _M_iend());
1260 return this->replace(__i1 - _M_ibegin(), __i2 - __i1, __s, __n);
1277 replace(iterator __i1, iterator __i2,
const _CharT* __s)
1279 __glibcxx_requires_string(__s);
1280 return this->replace(__i1, __i2, __s, traits_type::length(__s));
1298 replace(iterator __i1, iterator __i2, size_type __n, _CharT __c)
1300 _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
1301 && __i2 <= _M_iend());
1302 return _M_replace_aux(__i1 - _M_ibegin(), __i2 - __i1, __n, __c);
1319 template<
class _InputIterator>
1322 _InputIterator __k1, _InputIterator __k2)
1324 _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
1325 && __i2 <= _M_iend());
1326 __glibcxx_requires_valid_range(__k1, __k2);
1327 typedef typename std::__is_integer<_InputIterator>::__type _Integral;
1328 return _M_replace_dispatch(__i1, __i2, __k1, __k2, _Integral());
1334 replace(iterator __i1, iterator __i2, _CharT* __k1, _CharT* __k2)
1336 _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
1337 && __i2 <= _M_iend());
1338 __glibcxx_requires_valid_range(__k1, __k2);
1339 return this->replace(__i1 - _M_ibegin(), __i2 - __i1,
1344 replace(iterator __i1, iterator __i2,
1345 const _CharT* __k1,
const _CharT* __k2)
1347 _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
1348 && __i2 <= _M_iend());
1349 __glibcxx_requires_valid_range(__k1, __k2);
1350 return this->replace(__i1 - _M_ibegin(), __i2 - __i1,
1355 replace(iterator __i1, iterator __i2, iterator __k1, iterator __k2)
1357 _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
1358 && __i2 <= _M_iend());
1359 __glibcxx_requires_valid_range(__k1, __k2);
1360 return this->replace(__i1 - _M_ibegin(), __i2 - __i1,
1361 __k1.base(), __k2 - __k1);
1365 replace(iterator __i1, iterator __i2,
1366 const_iterator __k1, const_iterator __k2)
1368 _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
1369 && __i2 <= _M_iend());
1370 __glibcxx_requires_valid_range(__k1, __k2);
1371 return this->replace(__i1 - _M_ibegin(), __i2 - __i1,
1372 __k1.base(), __k2 - __k1);
1375 #ifdef __GXX_EXPERIMENTAL_CXX0X__
1390 std::initializer_list<_CharT> __l)
1391 {
return this->replace(__i1, __i2, __l.begin(), __l.end()); }
1392 #endif // __GXX_EXPERIMENTAL_CXX0X__
1395 template<
class _Integer>
1397 _M_replace_dispatch(iterator __i1, iterator __i2, _Integer __n,
1398 _Integer __val, std::__true_type)
1399 {
return _M_replace_aux(__i1 - _M_ibegin(), __i2 - __i1, __n, __val); }
1401 template<
class _InputIterator>
1403 _M_replace_dispatch(iterator __i1, iterator __i2, _InputIterator __k1,
1404 _InputIterator __k2, std::__false_type);
1407 _M_replace_aux(size_type __pos1, size_type __n1, size_type __n2,
1411 _M_replace(size_type __pos, size_type __len1,
const _CharT* __s,
1412 const size_type __len2);
1415 _M_append(
const _CharT* __s, size_type __n);
1432 copy(_CharT* __s, size_type __n, size_type __pos = 0)
const;
1442 #ifdef __GXX_EXPERIMENTAL_CXX0X__
1447 { this->_M_swap(__s); }
1458 {
return this->_M_data(); }
1468 {
return this->_M_data(); }
1475 {
return allocator_type(this->_M_get_allocator()); }
1490 find(
const _CharT* __s, size_type __pos, size_type __n)
const;
1504 {
return this->find(__str.
data(), __pos, __str.
size()); }
1517 find(
const _CharT* __s, size_type __pos = 0)
const
1519 __glibcxx_requires_string(__s);
1520 return this->find(__s, __pos, traits_type::length(__s));
1534 find(_CharT __c, size_type __pos = 0)
const;
1548 {
return this->rfind(__str.
data(), __pos, __str.
size()); }
1563 rfind(
const _CharT* __s, size_type __pos, size_type __n)
const;
1576 rfind(
const _CharT* __s, size_type __pos = npos)
const
1578 __glibcxx_requires_string(__s);
1579 return this->rfind(__s, __pos, traits_type::length(__s));
1593 rfind(_CharT __c, size_type __pos = npos)
const;
1607 {
return this->find_first_of(__str.
data(), __pos, __str.
size()); }
1622 find_first_of(
const _CharT* __s, size_type __pos, size_type __n)
const;
1637 __glibcxx_requires_string(__s);
1638 return this->find_first_of(__s, __pos, traits_type::length(__s));
1655 {
return this->find(__c, __pos); }
1670 {
return this->find_last_of(__str.
data(), __pos, __str.
size()); }
1685 find_last_of(
const _CharT* __s, size_type __pos, size_type __n)
const;
1700 __glibcxx_requires_string(__s);
1701 return this->find_last_of(__s, __pos, traits_type::length(__s));
1718 {
return this->rfind(__c, __pos); }
1732 {
return this->find_first_not_of(__str.
data(), __pos, __str.
size()); }
1747 find_first_not_of(
const _CharT* __s, size_type __pos,
1748 size_type __n)
const;
1763 __glibcxx_requires_string(__s);
1764 return this->find_first_not_of(__s, __pos, traits_type::length(__s));
1778 find_first_not_of(_CharT __c, size_type __pos = 0)
const;
1793 size_type __pos = npos)
const
1794 {
return this->find_last_not_of(__str.
data(), __pos, __str.
size()); }
1809 find_last_not_of(
const _CharT* __s, size_type __pos,
1810 size_type __n)
const;
1825 __glibcxx_requires_string(__s);
1826 return this->find_last_not_of(__s, __pos, traits_type::length(__s));
1840 find_last_not_of(_CharT __c, size_type __pos = npos)
const;
1855 substr(size_type __pos = 0, size_type __n = npos)
const
1857 return __versa_string(*
this, _M_check(__pos,
"__versa_string::substr"),
1878 if (this->_M_compare(__str))
1881 const size_type __size = this->size();
1882 const size_type __osize = __str.
size();
1883 const size_type __len =
std::min(__size, __osize);
1885 int __r = traits_type::compare(this->_M_data(), __str.
data(), __len);
1887 __r = _S_compare(__size, __osize);
1911 compare(size_type __pos, size_type __n,
1938 compare(size_type __pos1, size_type __n1,
const __versa_string& __str,
1939 size_type __pos2, size_type __n2)
const;
1957 compare(
const _CharT* __s)
const;
1981 compare(size_type __pos, size_type __n1,
const _CharT* __s)
const;
2008 compare(size_type __pos, size_type __n1,
const _CharT* __s,
2009 size_type __n2)
const;
2019 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2020 template <
typename,
typename,
typename>
class _Base>
2021 __versa_string<_CharT, _Traits, _Alloc, _Base>
2022 operator+(
const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,
2023 const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs);
2031 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2032 template <
typename,
typename,
typename>
class _Base>
2033 __versa_string<_CharT, _Traits, _Alloc, _Base>
2035 const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs);
2043 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2044 template <
typename,
typename,
typename>
class _Base>
2045 __versa_string<_CharT, _Traits, _Alloc, _Base>
2047 const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs);
2055 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2056 template <
typename,
typename,
typename>
class _Base>
2057 __versa_string<_CharT, _Traits, _Alloc, _Base>
2058 operator+(
const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,
2059 const _CharT* __rhs);
2067 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2068 template <
typename,
typename,
typename>
class _Base>
2069 __versa_string<_CharT, _Traits, _Alloc, _Base>
2070 operator+(
const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,
2080 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2081 template <
typename,
typename,
typename>
class _Base>
2085 {
return __lhs.
compare(__rhs) == 0; }
2087 template<
typename _CharT,
2088 template <
typename,
typename,
typename>
class _Base>
2089 inline typename __enable_if<std::__is_char<_CharT>::__value,
bool>::__type
2094 {
return (__lhs.size() == __rhs.size()
2104 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2105 template <
typename,
typename,
typename>
class _Base>
2109 {
return __rhs.
compare(__lhs) == 0; }
2117 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2118 template <
typename,
typename,
typename>
class _Base>
2121 const _CharT* __rhs)
2122 {
return __lhs.
compare(__rhs) == 0; }
2131 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2132 template <
typename,
typename,
typename>
class _Base>
2136 {
return !(__lhs == __rhs); }
2144 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2145 template <
typename,
typename,
typename>
class _Base>
2149 {
return !(__lhs == __rhs); }
2157 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2158 template <
typename,
typename,
typename>
class _Base>
2161 const _CharT* __rhs)
2162 {
return !(__lhs == __rhs); }
2171 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2172 template <
typename,
typename,
typename>
class _Base>
2174 operator<(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,
2176 {
return __lhs.
compare(__rhs) < 0; }
2184 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2185 template <
typename,
typename,
typename>
class _Base>
2187 operator<(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,
2188 const _CharT* __rhs)
2189 {
return __lhs.compare(__rhs) < 0; }
2197 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2198 template <
typename,
typename,
typename>
class _Base>
2202 {
return __rhs.
compare(__lhs) > 0; }
2211 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2212 template <
typename,
typename,
typename>
class _Base>
2216 {
return __lhs.
compare(__rhs) > 0; }
2224 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2225 template <
typename,
typename,
typename>
class _Base>
2228 const _CharT* __rhs)
2229 {
return __lhs.
compare(__rhs) > 0; }
2237 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2238 template <
typename,
typename,
typename>
class _Base>
2242 {
return __rhs.
compare(__lhs) < 0; }
2251 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2252 template <
typename,
typename,
typename>
class _Base>
2254 operator<=(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,
2256 {
return __lhs.
compare(__rhs) <= 0; }
2264 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2265 template <
typename,
typename,
typename>
class _Base>
2267 operator<=(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,
2268 const _CharT* __rhs)
2269 {
return __lhs.compare(__rhs) <= 0; }
2277 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2278 template <
typename,
typename,
typename>
class _Base>
2282 {
return __rhs.
compare(__lhs) >= 0; }
2291 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2292 template <
typename,
typename,
typename>
class _Base>
2296 {
return __lhs.
compare(__rhs) >= 0; }
2304 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2305 template <
typename,
typename,
typename>
class _Base>
2308 const _CharT* __rhs)
2309 {
return __lhs.
compare(__rhs) >= 0; }
2317 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2318 template <
typename,
typename,
typename>
class _Base>
2322 {
return __rhs.
compare(__lhs) <= 0; }
2331 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2332 template <
typename,
typename,
typename>
class _Base>
2336 { __lhs.
swap(__rhs); }
2338 #ifdef __GXX_EXPERIMENTAL_CXX0X__
2339 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2340 template <
typename,
typename,
typename>
class _Base>
2342 swap(__versa_string<_CharT, _Traits, _Alloc, _Base>&& __lhs,
2343 __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs)
2344 { __lhs.swap(__rhs); }
2346 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2347 template <
typename,
typename,
typename>
class _Base>
2349 swap(__versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,
2350 __versa_string<_CharT, _Traits, _Alloc, _Base>&& __rhs)
2351 { __lhs.swap(__rhs); }
2354 _GLIBCXX_END_NAMESPACE
2356 _GLIBCXX_BEGIN_NAMESPACE(
std)
2370 template<typename _CharT, typename _Traits, typename _Alloc,
2371 template <typename, typename, typename> class _Base>
2372 basic_istream<_CharT, _Traits>&
2373 operator>>(basic_istream<_CharT, _Traits>& __is,
2374 __gnu_cxx::__versa_string<_CharT, _Traits,
2375 _Alloc, _Base>& __str);
2386 template<typename _CharT, typename _Traits, typename _Alloc,
2387 template <typename, typename, typename> class _Base>
2388 inline basic_ostream<_CharT, _Traits>&
2389 operator<<(basic_ostream<_CharT, _Traits>& __os,
2390 const
__gnu_cxx::__versa_string<_CharT, _Traits, _Alloc,
2395 return __ostream_insert(__os, __str.data(), __str.size());
2412 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2413 template <
typename,
typename,
typename>
class _Base>
2414 basic_istream<_CharT, _Traits>&
2415 getline(basic_istream<_CharT, _Traits>& __is,
2432 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2433 template <
typename,
typename,
typename>
class _Base>
2434 inline basic_istream<_CharT, _Traits>&
2437 {
return getline(__is, __str, __is.widen(
'\n')); }
2439 _GLIBCXX_END_NAMESPACE
2441 #if (defined(__GXX_EXPERIMENTAL_CXX0X__) && defined(_GLIBCXX_USE_C99))
2443 #include <ext/string_conversions.h>
2449 stoi(const __vstring& __str,
std::
size_t* __idx = 0,
int __base = 10)
2450 {
return __gnu_cxx::__stoa<long, int>(&std::strtol,
"stoi", __str.c_str(),
2454 stol(
const __vstring& __str, std::size_t* __idx = 0,
int __base = 10)
2455 {
return __gnu_cxx::__stoa(&std::strtol,
"stol", __str.c_str(),
2458 inline unsigned long
2459 stoul(
const __vstring& __str, std::size_t* __idx = 0,
int __base = 10)
2460 {
return __gnu_cxx::__stoa(&std::strtoul,
"stoul", __str.c_str(),
2464 stoll(
const __vstring& __str, std::size_t* __idx = 0,
int __base = 10)
2465 {
return __gnu_cxx::__stoa(&std::strtoll,
"stoll", __str.c_str(),
2468 inline unsigned long long
2469 stoull(
const __vstring& __str, std::size_t* __idx,
int __base = 10)
2470 {
return __gnu_cxx::__stoa(&std::strtoull,
"stoull", __str.c_str(),
2475 stof(
const __vstring& __str, std::size_t* __idx = 0)
2476 {
return __gnu_cxx::__stoa(&std::strtof,
"stof", __str.c_str(), __idx); }
2479 stod(
const __vstring& __str, std::size_t* __idx = 0)
2480 {
return __gnu_cxx::__stoa(&std::strtod,
"stod", __str.c_str(), __idx); }
2483 stold(
const __vstring& __str, std::size_t* __idx = 0)
2484 {
return __gnu_cxx::__stoa(&std::strtold,
"stold", __str.c_str(), __idx); }
2488 to_string(
long long __val)
2489 {
return __gnu_cxx::__to_xstring<__vstring>(&std::vsnprintf,
2490 4 *
sizeof(
long long),
2494 to_string(
unsigned long long __val)
2495 {
return __gnu_cxx::__to_xstring<__vstring>(&std::vsnprintf,
2496 4 *
sizeof(
unsigned long long),
2500 to_string(
long double __val)
2502 const int __n = __numeric_traits<long double>::__max_exponent10 + 20;
2503 return __gnu_cxx::__to_xstring<__vstring>(&std::vsnprintf, __n,
2507 #ifdef _GLIBCXX_USE_WCHAR_T
2509 stoi(
const __wvstring& __str, std::size_t* __idx = 0,
int __base = 10)
2510 {
return __gnu_cxx::__stoa<long, int>(&std::wcstol,
"stoi", __str.c_str(),
2514 stol(
const __wvstring& __str, std::size_t* __idx = 0,
int __base = 10)
2515 {
return __gnu_cxx::__stoa(&std::wcstol,
"stol", __str.c_str(),
2518 inline unsigned long
2519 stoul(
const __wvstring& __str, std::size_t* __idx = 0,
int __base = 10)
2520 {
return __gnu_cxx::__stoa(&std::wcstoul,
"stoul", __str.c_str(),
2524 stoll(
const __wvstring& __str, std::size_t* __idx = 0,
int __base = 10)
2525 {
return __gnu_cxx::__stoa(&std::wcstoll,
"stoll", __str.c_str(),
2528 inline unsigned long long
2529 stoull(
const __wvstring& __str, std::size_t* __idx = 0,
int __base = 10)
2530 {
return __gnu_cxx::__stoa(&std::wcstoull,
"stoull", __str.c_str(),
2535 stof(
const __wvstring& __str, std::size_t* __idx = 0)
2536 {
return __gnu_cxx::__stoa(&std::wcstof,
"stof", __str.c_str(), __idx); }
2539 stod(
const __wvstring& __str, std::size_t* __idx = 0)
2540 {
return __gnu_cxx::__stoa(&std::wcstod,
"stod", __str.c_str(), __idx); }
2543 stold(
const __wvstring& __str, std::size_t* __idx = 0)
2544 {
return __gnu_cxx::__stoa(&std::wcstold,
"stold", __str.c_str(), __idx); }
2547 to_wstring(
long long __val)
2548 {
return __gnu_cxx::__to_xstring<__wvstring>(&std::vswprintf,
2549 4 *
sizeof(
long long),
2553 to_wstring(
unsigned long long __val)
2554 {
return __gnu_cxx::__to_xstring<__wvstring>(&std::vswprintf,
2555 4 *
sizeof(
unsigned long long),
2559 to_wstring(
long double __val)
2561 const int __n = __numeric_traits<long double>::__max_exponent10 + 20;
2562 return __gnu_cxx::__to_xstring<__wvstring>(&std::vswprintf, __n,
2567 _GLIBCXX_END_NAMESPACE
2571 #ifndef _GLIBCXX_EXPORT_TEMPLATE
2572 # include "vstring.tcc"
__versa_string & assign(std::initializer_list< _CharT > __l)
Set value to an initializer_list of characters.
bool operator>=(const _CharT *__lhs, const __versa_string< _CharT, _Traits, _Alloc, _Base > &__rhs)
Test if C string doesn't precede string.
__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.
void insert(iterator __p, std::initializer_list< _CharT > __l)
Insert an initializer_list of characters.
__versa_string(size_type __n, _CharT __c, const _Alloc &__a=_Alloc())
Construct string as multiple characters.
size_type find_first_of(_CharT __c, size_type __pos=0) const
Find position of a character.
const_reference front() const
__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.
void insert(iterator __p, _InputIterator __beg, _InputIterator __end)
Insert a range of characters.
size_type rfind(const __versa_string &__str, size_type __pos=npos) const
Find last position of a string.
size_type size() const
Returns the number of characters in the string, not including any null-termination.
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.
__versa_string & replace(iterator __i1, iterator __i2, std::initializer_list< _CharT > __l)
Replace range of characters with initializer_list.
The "standard" allocator, as per [20.4].Further details: http://gcc.gnu.org/onlinedocs/libstdc++/manu...
bool operator>(const _CharT *__lhs, const __versa_string< _CharT, _Traits, _Alloc, _Base > &__rhs)
Test if C string follows string.
__versa_string substr(size_type __pos=0, size_type __n=npos) const
Get a substring.
void reserve(size_type __res_arg=0)
Attempt to preallocate enough memory for specified number of characters.
__versa_string(const _CharT *__s, size_type __n, const _Alloc &__a=_Alloc())
Construct string initialized by a character array.
const_iterator cbegin() const
__versa_string(const _Alloc &__a)
Construct an empty string using allocator a.
size_type find_first_of(const __versa_string &__str, size_type __pos=0) const
Find position of a character of string.
const_reverse_iterator crend() const
__versa_string & append(_InputIterator __first, _InputIterator __last)
Append a range of characters.
ISO C++ entities toplevel namespace is std.
__versa_string & replace(iterator __i1, iterator __i2, size_type __n, _CharT __c)
Replace range of characters with multiple characters.
const_iterator begin() const
iterator erase(iterator __position)
Remove one character.
const_iterator end() const
bool operator==(const __versa_string< _CharT, _Traits, _Alloc, _Base > &__lhs, const _CharT *__rhs)
Test equivalence of string and C string.
bool operator<(const _CharT *__lhs, const __versa_string< _CharT, _Traits, _Alloc, _Base > &__rhs)
Test if C string precedes string.
One of the comparison functors.
bool operator!=(const __versa_string< _CharT, _Traits, _Alloc, _Base > &__lhs, const _CharT *__rhs)
Test difference of string and C string.
__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.
size_type find_last_of(const __versa_string &__str, size_type __pos=npos) const
Find last position of a character of string.
reference operator[](size_type __pos)
Subscript 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)
Insert a C string.
bool operator<=(const _CharT *__lhs, const __versa_string< _CharT, _Traits, _Alloc, _Base > &__rhs)
Test if C string doesn't follow string.
__versa_string & operator+=(_CharT __c)
Append a character.
__versa_string & append(std::initializer_list< _CharT > __l)
Append an initializer_list of characters.
size_type find_last_of(const _CharT *__s, size_type __pos=npos) const
Find last position of a character of C string.
const_iterator cend() const
const_reverse_iterator rend() const
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.
size_type length() const
Returns the number of characters in the string, not including any null-termination.
void swap(__versa_string &&__s)
Swap contents with another string.
iterator erase(iterator __first, iterator __last)
Remove a range of characters.
__versa_string & replace(size_type __pos, size_type __n, const __versa_string &__str)
Replace characters with value from another string.
__versa_string(std::initializer_list< _CharT > __l, const _Alloc &__a=_Alloc())
Construct string from an initializer list.
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.
__versa_string & replace(iterator __i1, iterator __i2, const _CharT *__s, size_type __n)
Replace range of characters with C substring.
__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.
size_type max_size() const
Returns the size() of the largest possible string.
size_type find_last_not_of(const __versa_string &__str, size_type __pos=npos) const
Find last position of a character not in string.
__versa_string(const __versa_string &__str)
Construct string with copy of value of str.
__versa_string & operator=(std::initializer_list< _CharT > __l)
Set value to string constructed from initializer list.
__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.
void insert(iterator __p, size_type __n, _CharT __c)
Insert multiple characters.
GNU extensions for public use.
~__versa_string()
Destroy the string instance.
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.
__versa_string & operator=(const __versa_string &__str)
Assign the value of str to this string.
__versa_string & assign(_InputIterator __first, _InputIterator __last)
Set value to a range of characters.
size_type find(const _CharT *__s, size_type __pos=0) const
Find position of a C string.
__versa_string & append(const __versa_string &__str)
Append a string to this string.
__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.
__versa_string(__versa_string &&__str)
String move constructor.
__versa_string & assign(const _CharT *__s, size_type __n)
Set value to a C substring.
size_type find_first_not_of(const __versa_string &__str, size_type __pos=0) const
Find position of a character not in string.
const _CharT * c_str() const
Return const pointer to null-terminated contents.
__versa_string & insert(size_type __pos1, const __versa_string &__str)
Insert value of a string.
__versa_string< _CharT, _Traits, _Alloc, _Base > operator+(const __versa_string< _CharT, _Traits, _Alloc, _Base > &__lhs, _CharT __rhs)
Concatenate string and character.
__versa_string & operator+=(std::initializer_list< _CharT > __l)
Append an initializer_list of characters.
__versa_string & replace(iterator __i1, iterator __i2, const __versa_string &__str)
Replace range of characters with string.
Managing sequences of characters and character-like objects.
__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 & assign(const _CharT *__s)
Set value to contents of a C string.
reverse_iterator rbegin()
__versa_string & operator+=(const _CharT *__s)
Append a C string.
Basis for explicit traits specializations.
allocator_type get_allocator() const
Return copy of allocator used to construct this string.
const_reference back() const
const _Tp & min(const _Tp &, const _Tp &)
This does what you think it does.
__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.
const_reverse_iterator crbegin() const
__versa_string()
Default constructor creates an empty string.
__versa_string & assign(size_type __n, _CharT __c)
Set value to multiple characters.
size_type capacity() const
__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.
const_reverse_iterator rbegin() const
size_type find_last_of(_CharT __c, size_type __pos=npos) const
Find last position of a character.
size_type find(const __versa_string &__str, size_type __pos=0) const
Find position of a 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.
__versa_string(const __versa_string &__str, size_type __pos, size_type __n=npos)
Construct string as copy of a substring.
const _CharT * data() const
Return const pointer to contents.
iterator insert(iterator __p, _CharT __c)
Insert one character.
size_type find_last_not_of(const _CharT *__s, size_type __pos=npos) const
Find last position of a character not in C string.
void resize(size_type __n)
Resizes the string to the specified number of characters.
__versa_string & replace(iterator __i1, iterator __i2, _InputIterator __k1, _InputIterator __k2)
Replace range of characters with range.