33 #pragma GCC system_header
35 #ifdef __GXX_EXPERIMENTAL_CXX0X__
43 namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
45 _GLIBCXX_BEGIN_NAMESPACE_VERSION
55 template<
typename _CharT,
typename _Traits,
typename _Alloc,
56 template <
typename,
typename,
typename>
class _Base>
58 :
private _Base<_CharT, _Traits, _Alloc>
60 typedef _Base<_CharT, _Traits, _Alloc> __vstring_base;
61 typedef typename __vstring_base::_CharT_alloc_type _CharT_alloc_type;
65 typedef _Traits traits_type;
66 typedef typename _Traits::char_type value_type;
67 typedef _Alloc allocator_type;
68 typedef typename _CharT_alloc_type::size_type size_type;
69 typedef typename _CharT_alloc_type::difference_type difference_type;
70 typedef value_type& reference;
71 typedef const value_type& const_reference;
72 typedef typename _CharT_alloc_type::pointer pointer;
73 typedef typename _CharT_alloc_type::const_pointer const_pointer;
74 typedef __gnu_cxx::__normal_iterator<pointer, __versa_string> iterator;
75 typedef __gnu_cxx::__normal_iterator<const_pointer, __versa_string>
82 static const size_type
npos =
static_cast<size_type
>(-1);
86 _M_check(size_type __pos,
const char* __s)
const
88 if (__pos > this->
size())
89 std::__throw_out_of_range(__N(__s));
94 _M_check_length(size_type __n1, size_type __n2,
const char* __s)
const
97 std::__throw_length_error(__N(__s));
102 _M_limit(size_type __pos, size_type __off)
const
104 const bool __testoff = __off < this->
size() - __pos;
105 return __testoff ? __off : this->
size() - __pos;
110 _M_disjunct(
const _CharT* __s)
const
114 + this->
size(), __s));
121 {
return iterator(this->_M_data()); }
125 {
return iterator(this->_M_data() + this->_M_length()); }
136 : __vstring_base() { }
143 : __vstring_base(__a) { }
151 : __vstring_base(__str) { }
153 #ifdef __GXX_EXPERIMENTAL_CXX0X__
163 : __vstring_base(std::move(__str)) { }
171 const _Alloc& __a = _Alloc())
172 : __vstring_base(__l.
begin(), __l.
end(), __a) { }
182 size_type __n =
npos)
183 : __vstring_base(__str._M_data()
184 + __str._M_check(__pos,
185 "__versa_string::__versa_string"),
186 __str._M_data() + __str._M_limit(__pos, __n)
187 + __pos, _Alloc()) { }
197 size_type __n,
const _Alloc& __a)
198 : __vstring_base(__str._M_data()
199 + __str._M_check(__pos,
200 "__versa_string::__versa_string"),
201 __str._M_data() + __str._M_limit(__pos, __n)
214 const _Alloc& __a = _Alloc())
215 : __vstring_base(__s, __s + __n, __a) { }
223 : __vstring_base(__s, __s ? __s + traits_type::
length(__s) :
233 : __vstring_base(__n, __c, __a) { }
241 template<
class _InputIterator>
243 const _Alloc& __a = _Alloc())
244 : __vstring_base(__beg, __end, __a) { }
257 {
return this->
assign(__str); }
259 #ifdef __GXX_EXPERIMENTAL_CXX0X__
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()); }
362 const_reverse_iterator
380 const_reverse_iterator
384 #ifdef __GXX_EXPERIMENTAL_CXX0X__
391 {
return const_iterator(this->_M_data()); }
399 {
return const_iterator(this->_M_data() + this->
size()); }
406 const_reverse_iterator
415 const_reverse_iterator
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 #ifdef __GXX_EXPERIMENTAL_CXX0X__
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];
557 _GLIBCXX_DEBUG_ASSERT(__pos <= this->
size());
559 _GLIBCXX_DEBUG_PEDASSERT(__pos < this->
size());
561 return this->_M_data()[__pos];
575 at(size_type __n)
const
577 if (__n >= this->
size())
578 std::__throw_out_of_range(__N(
"__versa_string::at"));
579 return this->_M_data()[__n];
596 if (__n >= this->
size())
597 std::__throw_out_of_range(__N(
"__versa_string::at"));
599 return this->_M_data()[__n];
602 #ifdef __GXX_EXPERIMENTAL_CXX0X__
644 {
return this->
append(__str); }
653 {
return this->
append(__s); }
667 #ifdef __GXX_EXPERIMENTAL_CXX0X__
675 {
return this->
append(__l.begin(), __l.end()); }
676 #endif // __GXX_EXPERIMENTAL_CXX0X__
685 {
return _M_append(__str._M_data(), __str.
size()); }
702 {
return _M_append(__str._M_data()
703 + __str._M_check(__pos,
"__versa_string::append"),
704 __str._M_limit(__pos, __n)); }
715 __glibcxx_requires_string_len(__s, __n);
716 _M_check_length(size_type(0), __n,
"__versa_string::append");
717 return _M_append(__s, __n);
728 __glibcxx_requires_string(__s);
729 const size_type __n = traits_type::length(__s);
730 _M_check_length(size_type(0), __n,
"__versa_string::append");
731 return _M_append(__s, __n);
744 {
return _M_replace_aux(this->
size(), size_type(0), __n, __c); }
746 #ifdef __GXX_EXPERIMENTAL_CXX0X__
754 {
return this->
append(__l.begin(), __l.end()); }
755 #endif // __GXX_EXPERIMENTAL_CXX0X__
765 template<
class _InputIterator>
767 append(_InputIterator __first, _InputIterator __last)
768 {
return this->
replace(_M_iend(), _M_iend(), __first, __last); }
777 const size_type __size = this->
size();
778 if (__size + 1 > this->
capacity() || this->_M_is_shared())
779 this->_M_mutate(__size, size_type(0), 0, size_type(1));
780 traits_type::assign(this->_M_data()[__size], __c);
781 this->_M_set_length(__size + 1);
792 this->_M_assign(__str);
796 #ifdef __GXX_EXPERIMENTAL_CXX0X__
811 #endif // __GXX_EXPERIMENTAL_CXX0X__
828 {
return _M_replace(size_type(0), this->
size(), __str._M_data()
829 + __str._M_check(__pos,
"__versa_string::assign"),
830 __str._M_limit(__pos, __n)); }
846 __glibcxx_requires_string_len(__s, __n);
847 return _M_replace(size_type(0), this->
size(), __s, __n);
862 __glibcxx_requires_string(__s);
863 return _M_replace(size_type(0), this->
size(), __s,
864 traits_type::length(__s));
878 {
return _M_replace_aux(size_type(0), this->
size(), __n, __c); }
889 template<
class _InputIterator>
891 assign(_InputIterator __first, _InputIterator __last)
892 {
return this->
replace(_M_ibegin(), _M_iend(), __first, __last); }
894 #ifdef __GXX_EXPERIMENTAL_CXX0X__
902 {
return this->
assign(__l.begin(), __l.end()); }
903 #endif // __GXX_EXPERIMENTAL_CXX0X__
919 insert(iterator __p, size_type __n, _CharT __c)
920 { this->
replace(__p, __p, __n, __c); }
934 template<
class _InputIterator>
936 insert(iterator __p, _InputIterator __beg, _InputIterator __end)
937 { this->
replace(__p, __p, __beg, __end); }
939 #ifdef __GXX_EXPERIMENTAL_CXX0X__
948 { this->
insert(__p, __l.begin(), __l.end()); }
949 #endif // __GXX_EXPERIMENTAL_CXX0X__
965 {
return this->
replace(__pos1, size_type(0),
966 __str._M_data(), __str.
size()); }
988 size_type __pos2, size_type __n)
989 {
return this->
replace(__pos1, size_type(0), __str._M_data()
990 + __str._M_check(__pos2,
"__versa_string::insert"),
991 __str._M_limit(__pos2, __n)); }
1010 insert(size_type __pos,
const _CharT* __s, size_type __n)
1011 {
return this->
replace(__pos, size_type(0), __s, __n); }
1031 __glibcxx_requires_string(__s);
1032 return this->
replace(__pos, size_type(0), __s,
1033 traits_type::length(__s));
1053 insert(size_type __pos, size_type __n, _CharT __c)
1054 {
return _M_replace_aux(_M_check(__pos,
"__versa_string::insert"),
1055 size_type(0), __n, __c); }
1073 _GLIBCXX_DEBUG_PEDASSERT(__p >= _M_ibegin() && __p <= _M_iend());
1074 const size_type __pos = __p - _M_ibegin();
1075 _M_replace_aux(__pos, size_type(0), size_type(1), __c);
1076 this->_M_set_leaked();
1077 return iterator(this->_M_data() + __pos);
1098 this->_M_erase(_M_check(__pos,
"__versa_string::erase"),
1099 _M_limit(__pos, __n));
1114 _GLIBCXX_DEBUG_PEDASSERT(__position >= _M_ibegin()
1115 && __position < _M_iend());
1116 const size_type __pos = __position - _M_ibegin();
1117 this->_M_erase(__pos, size_type(1));
1118 this->_M_set_leaked();
1119 return iterator(this->_M_data() + __pos);
1133 erase(iterator __first, iterator __last)
1135 _GLIBCXX_DEBUG_PEDASSERT(__first >= _M_ibegin() && __first <= __last
1136 && __last <= _M_iend());
1137 const size_type __pos = __first - _M_ibegin();
1138 this->_M_erase(__pos, __last - __first);
1139 this->_M_set_leaked();
1140 return iterator(this->_M_data() + __pos);
1143 #ifdef __GXX_EXPERIMENTAL_CXX0X__
1151 { this->_M_erase(
size()-1, 1); }
1152 #endif // __GXX_EXPERIMENTAL_CXX0X__
1173 {
return this->
replace(__pos, __n, __str._M_data(), __str.
size()); }
1196 size_type __pos2, size_type __n2)
1198 return this->
replace(__pos1, __n1, __str._M_data()
1199 + __str._M_check(__pos2,
1200 "__versa_string::replace"),
1201 __str._M_limit(__pos2, __n2));
1223 replace(size_type __pos, size_type __n1,
const _CharT* __s,
1226 __glibcxx_requires_string_len(__s, __n2);
1227 return _M_replace(_M_check(__pos,
"__versa_string::replace"),
1228 _M_limit(__pos, __n1), __s, __n2);
1247 replace(size_type __pos, size_type __n1,
const _CharT* __s)
1249 __glibcxx_requires_string(__s);
1250 return this->
replace(__pos, __n1, __s, traits_type::length(__s));
1271 replace(size_type __pos, size_type __n1, size_type __n2, _CharT __c)
1272 {
return _M_replace_aux(_M_check(__pos,
"__versa_string::replace"),
1273 _M_limit(__pos, __n1), __n2, __c); }
1290 {
return this->
replace(__i1, __i2, __str._M_data(), __str.
size()); }
1307 replace(iterator __i1, iterator __i2,
const _CharT* __s, size_type __n)
1309 _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
1310 && __i2 <= _M_iend());
1311 return this->
replace(__i1 - _M_ibegin(), __i2 - __i1, __s, __n);
1328 replace(iterator __i1, iterator __i2,
const _CharT* __s)
1330 __glibcxx_requires_string(__s);
1331 return this->
replace(__i1, __i2, __s, traits_type::length(__s));
1349 replace(iterator __i1, iterator __i2, size_type __n, _CharT __c)
1351 _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
1352 && __i2 <= _M_iend());
1353 return _M_replace_aux(__i1 - _M_ibegin(), __i2 - __i1, __n, __c);
1370 template<
class _InputIterator>
1373 _InputIterator __k1, _InputIterator __k2)
1375 _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
1376 && __i2 <= _M_iend());
1377 __glibcxx_requires_valid_range(__k1, __k2);
1378 typedef typename std::__is_integer<_InputIterator>::__type _Integral;
1379 return this->_M_replace_dispatch(__i1, __i2, __k1, __k2, _Integral());
1387 _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
1388 && __i2 <= _M_iend());
1389 __glibcxx_requires_valid_range(__k1, __k2);
1390 return this->
replace(__i1 - _M_ibegin(), __i2 - __i1,
1395 replace(iterator __i1, iterator __i2,
1396 const _CharT* __k1,
const _CharT* __k2)
1398 _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
1399 && __i2 <= _M_iend());
1400 __glibcxx_requires_valid_range(__k1, __k2);
1401 return this->
replace(__i1 - _M_ibegin(), __i2 - __i1,
1406 replace(iterator __i1, iterator __i2, iterator __k1, iterator __k2)
1408 _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
1409 && __i2 <= _M_iend());
1410 __glibcxx_requires_valid_range(__k1, __k2);
1411 return this->
replace(__i1 - _M_ibegin(), __i2 - __i1,
1412 __k1.base(), __k2 - __k1);
1416 replace(iterator __i1, iterator __i2,
1417 const_iterator __k1, const_iterator __k2)
1419 _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
1420 && __i2 <= _M_iend());
1421 __glibcxx_requires_valid_range(__k1, __k2);
1422 return this->
replace(__i1 - _M_ibegin(), __i2 - __i1,
1423 __k1.base(), __k2 - __k1);
1426 #ifdef __GXX_EXPERIMENTAL_CXX0X__
1442 {
return this->
replace(__i1, __i2, __l.begin(), __l.end()); }
1443 #endif // __GXX_EXPERIMENTAL_CXX0X__
1446 template<
class _Integer>
1449 _Integer __val, std::__true_type)
1450 {
return _M_replace_aux(__i1 - _M_ibegin(), __i2 - __i1, __n, __val); }
1452 template<
class _InputIterator>
1454 _M_replace_dispatch(iterator __i1, iterator __i2, _InputIterator __k1,
1455 _InputIterator __k2, std::__false_type);
1458 _M_replace_aux(size_type __pos1, size_type __n1, size_type __n2,
1462 _M_replace(size_type __pos, size_type __len1,
const _CharT* __s,
1463 const size_type __len2);
1466 _M_append(
const _CharT* __s, size_type __n);
1483 copy(_CharT* __s, size_type __n, size_type __pos = 0)
const;
1494 { this->_M_swap(__s); }
1505 {
return this->_M_data(); }
1515 {
return this->_M_data(); }
1522 {
return allocator_type(this->_M_get_allocator()); }
1537 find(
const _CharT* __s, size_type __pos, size_type __n)
const;
1552 {
return this->
find(__str.
data(), __pos, __str.
size()); }
1565 find(
const _CharT* __s, size_type __pos = 0)
const
1567 __glibcxx_requires_string(__s);
1568 return this->
find(__s, __pos, traits_type::length(__s));
1582 find(_CharT __c, size_type __pos = 0) const _GLIBCXX_NOEXCEPT;
1597 {
return this->
rfind(__str.data(), __pos, __str.size()); }
1612 rfind(
const _CharT* __s, size_type __pos, size_type __n)
const;
1627 __glibcxx_requires_string(__s);
1628 return this->
rfind(__s, __pos, traits_type::length(__s));
1642 rfind(_CharT __c, size_type __pos =
npos) const _GLIBCXX_NOEXCEPT;
1657 {
return this->
find_first_of(__str.data(), __pos, __str.size()); }
1672 find_first_of(
const _CharT* __s, size_type __pos, size_type __n)
const;
1687 __glibcxx_requires_string(__s);
1688 return this->
find_first_of(__s, __pos, traits_type::length(__s));
1705 {
return this->
find(__c, __pos); }
1736 find_last_of(
const _CharT* __s, size_type __pos, size_type __n)
const;
1751 __glibcxx_requires_string(__s);
1752 return this->
find_last_of(__s, __pos, traits_type::length(__s));
1769 {
return this->
rfind(__c, __pos); }
1800 size_type __n)
const;
1815 __glibcxx_requires_string(__s);
1846 size_type __pos =
npos) const _GLIBCXX_NOEXCEPT
1863 size_type __n)
const;
1878 __glibcxx_requires_string(__s);
1911 return __versa_string(*
this, _M_check(__pos,
"__versa_string::substr"),
1932 if (this->_M_compare(__str))
1935 const size_type __size = this->
size();
1936 const size_type __osize = __str.
size();
1937 const size_type __len =
std::min(__size, __osize);
1939 int __r = traits_type::compare(this->_M_data(), __str.
data(), __len);
1941 __r = this->_S_compare(__size, __osize);
1965 compare(size_type __pos, size_type __n,
1993 size_type __pos2, size_type __n2)
const;
2011 compare(
const _CharT* __s)
const;
2035 compare(size_type __pos, size_type __n1,
const _CharT* __s)
const;
2062 compare(size_type __pos, size_type __n1,
const _CharT* __s,
2063 size_type __n2)
const;
2073 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2074 template <
typename,
typename,
typename>
class _Base>
2075 __versa_string<_CharT, _Traits, _Alloc, _Base>
2076 operator+(
const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,
2077 const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs);
2085 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2086 template <
typename,
typename,
typename>
class _Base>
2087 __versa_string<_CharT, _Traits, _Alloc, _Base>
2088 operator+(
const _CharT* __lhs,
2089 const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs);
2097 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2098 template <
typename,
typename,
typename>
class _Base>
2099 __versa_string<_CharT, _Traits, _Alloc, _Base>
2100 operator+(_CharT __lhs,
2101 const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs);
2109 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2110 template <
typename,
typename,
typename>
class _Base>
2111 __versa_string<_CharT, _Traits, _Alloc, _Base>
2112 operator+(
const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,
2113 const _CharT* __rhs);
2121 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2122 template <
typename,
typename,
typename>
class _Base>
2123 __versa_string<_CharT, _Traits, _Alloc, _Base>
2124 operator+(
const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,
2127 #ifdef __GXX_EXPERIMENTAL_CXX0X__
2128 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2129 template <
typename,
typename,
typename>
class _Base>
2130 inline __versa_string<_CharT, _Traits, _Alloc, _Base>
2131 operator+(__versa_string<_CharT, _Traits, _Alloc, _Base>&& __lhs,
2132 const __versa_string<_CharT, _Traits, _Alloc, _Base>& __rhs)
2133 {
return std::move(__lhs.append(__rhs)); }
2135 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2136 template <
typename,
typename,
typename>
class _Base>
2137 inline __versa_string<_CharT, _Traits, _Alloc, _Base>
2138 operator+(
const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,
2139 __versa_string<_CharT, _Traits, _Alloc, _Base>&& __rhs)
2140 {
return std::move(__rhs.insert(0, __lhs)); }
2142 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2143 template <
typename,
typename,
typename>
class _Base>
2144 inline __versa_string<_CharT, _Traits, _Alloc, _Base>
2145 operator+(__versa_string<_CharT, _Traits, _Alloc, _Base>&& __lhs,
2146 __versa_string<_CharT, _Traits, _Alloc, _Base>&& __rhs)
2148 const auto __size = __lhs.size() + __rhs.size();
2149 const bool __cond = (__size > __lhs.capacity()
2150 && __size <= __rhs.capacity());
2151 return __cond ? std::move(__rhs.insert(0, __lhs))
2152 : std::move(__lhs.append(__rhs));
2155 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2156 template <
typename,
typename,
typename>
class _Base>
2157 inline __versa_string<_CharT, _Traits, _Alloc, _Base>
2158 operator+(
const _CharT* __lhs,
2159 __versa_string<_CharT, _Traits, _Alloc, _Base>&& __rhs)
2160 {
return std::move(__rhs.insert(0, __lhs)); }
2162 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2163 template <
typename,
typename,
typename>
class _Base>
2164 inline __versa_string<_CharT, _Traits, _Alloc, _Base>
2165 operator+(_CharT __lhs,
2166 __versa_string<_CharT, _Traits, _Alloc, _Base>&& __rhs)
2167 {
return std::move(__rhs.insert(0, 1, __lhs)); }
2169 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2170 template <
typename,
typename,
typename>
class _Base>
2171 inline __versa_string<_CharT, _Traits, _Alloc, _Base>
2172 operator+(__versa_string<_CharT, _Traits, _Alloc, _Base>&& __lhs,
2173 const _CharT* __rhs)
2174 {
return std::move(__lhs.append(__rhs)); }
2176 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2177 template <
typename,
typename,
typename>
class _Base>
2178 inline __versa_string<_CharT, _Traits, _Alloc, _Base>
2179 operator+(__versa_string<_CharT, _Traits, _Alloc, _Base>&& __lhs,
2181 {
return std::move(__lhs.append(1, __rhs)); }
2191 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2192 template <
typename,
typename,
typename>
class _Base>
2196 {
return __lhs.
compare(__rhs) == 0; }
2198 template<
typename _CharT,
2199 template <
typename,
typename,
typename>
class _Base>
2200 inline typename __enable_if<std::__is_char<_CharT>::__value,
bool>::__type
2205 {
return (__lhs.size() == __rhs.size()
2215 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2216 template <
typename,
typename,
typename>
class _Base>
2218 operator==(
const _CharT* __lhs,
2220 {
return __rhs.
compare(__lhs) == 0; }
2228 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2229 template <
typename,
typename,
typename>
class _Base>
2232 const _CharT* __rhs)
2233 {
return __lhs.
compare(__rhs) == 0; }
2242 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2243 template <
typename,
typename,
typename>
class _Base>
2247 {
return !(__lhs == __rhs); }
2255 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2256 template <
typename,
typename,
typename>
class _Base>
2258 operator!=(
const _CharT* __lhs,
2260 {
return !(__lhs == __rhs); }
2268 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2269 template <
typename,
typename,
typename>
class _Base>
2272 const _CharT* __rhs)
2273 {
return !(__lhs == __rhs); }
2282 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2283 template <
typename,
typename,
typename>
class _Base>
2285 operator<(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,
2287 {
return __lhs.
compare(__rhs) < 0; }
2295 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2296 template <
typename,
typename,
typename>
class _Base>
2298 operator<(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,
2299 const _CharT* __rhs)
2300 {
return __lhs.compare(__rhs) < 0; }
2308 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2309 template <
typename,
typename,
typename>
class _Base>
2311 operator<(
const _CharT* __lhs,
2313 {
return __rhs.
compare(__lhs) > 0; }
2322 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2323 template <
typename,
typename,
typename>
class _Base>
2327 {
return __lhs.
compare(__rhs) > 0; }
2335 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2336 template <
typename,
typename,
typename>
class _Base>
2339 const _CharT* __rhs)
2340 {
return __lhs.
compare(__rhs) > 0; }
2348 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2349 template <
typename,
typename,
typename>
class _Base>
2351 operator>(
const _CharT* __lhs,
2353 {
return __rhs.
compare(__lhs) < 0; }
2362 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2363 template <
typename,
typename,
typename>
class _Base>
2365 operator<=(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,
2367 {
return __lhs.
compare(__rhs) <= 0; }
2375 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2376 template <
typename,
typename,
typename>
class _Base>
2378 operator<=(const __versa_string<_CharT, _Traits, _Alloc, _Base>& __lhs,
2379 const _CharT* __rhs)
2380 {
return __lhs.compare(__rhs) <= 0; }
2388 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2389 template <
typename,
typename,
typename>
class _Base>
2391 operator<=(
const _CharT* __lhs,
2393 {
return __rhs.
compare(__lhs) >= 0; }
2402 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2403 template <
typename,
typename,
typename>
class _Base>
2407 {
return __lhs.
compare(__rhs) >= 0; }
2415 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2416 template <
typename,
typename,
typename>
class _Base>
2419 const _CharT* __rhs)
2420 {
return __lhs.
compare(__rhs) >= 0; }
2428 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2429 template <
typename,
typename,
typename>
class _Base>
2431 operator>=(
const _CharT* __lhs,
2433 {
return __rhs.
compare(__lhs) <= 0; }
2442 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2443 template <
typename,
typename,
typename>
class _Base>
2447 { __lhs.
swap(__rhs); }
2449 _GLIBCXX_END_NAMESPACE_VERSION
2452 namespace std _GLIBCXX_VISIBILITY(default)
2454 _GLIBCXX_BEGIN_NAMESPACE_VERSION
2468 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2469 template <
typename,
typename,
typename>
class _Base>
2470 basic_istream<_CharT, _Traits>&
2471 operator>>(basic_istream<_CharT, _Traits>& __is,
2473 _Alloc, _Base>& __str);
2484 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2485 template <
typename,
typename,
typename>
class _Base>
2486 inline basic_ostream<_CharT, _Traits>&
2487 operator<<(basic_ostream<_CharT, _Traits>& __os,
2493 return __ostream_insert(__os, __str.data(), __str.size());
2510 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2511 template <
typename,
typename,
typename>
class _Base>
2512 basic_istream<_CharT, _Traits>&
2513 getline(basic_istream<_CharT, _Traits>& __is,
2530 template<
typename _CharT,
typename _Traits,
typename _Alloc,
2531 template <
typename,
typename,
typename>
class _Base>
2532 inline basic_istream<_CharT, _Traits>&
2537 _GLIBCXX_END_NAMESPACE_VERSION
2540 #if (defined(__GXX_EXPERIMENTAL_CXX0X__) && defined(_GLIBCXX_USE_C99))
2544 namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
2546 _GLIBCXX_BEGIN_NAMESPACE_VERSION
2550 stoi(
const __vstring& __str, std::size_t* __idx = 0,
int __base = 10)
2551 {
return __gnu_cxx::__stoa<long, int>(&std::strtol,
"stoi", __str.c_str(),
2555 stol(
const __vstring& __str, std::size_t* __idx = 0,
int __base = 10)
2556 {
return __gnu_cxx::__stoa(&std::strtol,
"stol", __str.c_str(),
2559 inline unsigned long
2560 stoul(
const __vstring& __str, std::size_t* __idx = 0,
int __base = 10)
2561 {
return __gnu_cxx::__stoa(&std::strtoul,
"stoul", __str.c_str(),
2565 stoll(
const __vstring& __str, std::size_t* __idx = 0,
int __base = 10)
2566 {
return __gnu_cxx::__stoa(&std::strtoll,
"stoll", __str.c_str(),
2569 inline unsigned long long
2570 stoull(
const __vstring& __str, std::size_t* __idx,
int __base = 10)
2571 {
return __gnu_cxx::__stoa(&std::strtoull,
"stoull", __str.c_str(),
2576 stof(
const __vstring& __str, std::size_t* __idx = 0)
2577 {
return __gnu_cxx::__stoa(&std::strtof,
"stof", __str.c_str(), __idx); }
2580 stod(
const __vstring& __str, std::size_t* __idx = 0)
2581 {
return __gnu_cxx::__stoa(&std::strtod,
"stod", __str.c_str(), __idx); }
2584 stold(
const __vstring& __str, std::size_t* __idx = 0)
2585 {
return __gnu_cxx::__stoa(&std::strtold,
"stold", __str.c_str(), __idx); }
2592 {
return __gnu_cxx::__to_xstring<__vstring>(&std::vsnprintf, 4 *
sizeof(int),
2597 {
return __gnu_cxx::__to_xstring<__vstring>(&std::vsnprintf,
2598 4 *
sizeof(unsigned),
2603 {
return __gnu_cxx::__to_xstring<__vstring>(&std::vsnprintf,
2609 {
return __gnu_cxx::__to_xstring<__vstring>(&std::vsnprintf,
2610 4 *
sizeof(
unsigned long),
2616 {
return __gnu_cxx::__to_xstring<__vstring>(&std::vsnprintf,
2617 4 *
sizeof(
long long),
2622 {
return __gnu_cxx::__to_xstring<__vstring>(&std::vsnprintf,
2623 4 *
sizeof(
unsigned long long),
2629 const int __n = __numeric_traits<float>::__max_exponent10 + 20;
2630 return __gnu_cxx::__to_xstring<__vstring>(&std::vsnprintf, __n,
2637 const int __n = __numeric_traits<double>::__max_exponent10 + 20;
2638 return __gnu_cxx::__to_xstring<__vstring>(&std::vsnprintf, __n,
2645 const int __n = __numeric_traits<long double>::__max_exponent10 + 20;
2646 return __gnu_cxx::__to_xstring<__vstring>(&std::vsnprintf, __n,
2650 #ifdef _GLIBCXX_USE_WCHAR_T
2652 stoi(
const __wvstring& __str, std::size_t* __idx = 0,
int __base = 10)
2653 {
return __gnu_cxx::__stoa<long, int>(&std::wcstol,
"stoi", __str.c_str(),
2657 stol(
const __wvstring& __str, std::size_t* __idx = 0,
int __base = 10)
2658 {
return __gnu_cxx::__stoa(&std::wcstol,
"stol", __str.c_str(),
2661 inline unsigned long
2662 stoul(
const __wvstring& __str, std::size_t* __idx = 0,
int __base = 10)
2663 {
return __gnu_cxx::__stoa(&std::wcstoul,
"stoul", __str.c_str(),
2667 stoll(
const __wvstring& __str, std::size_t* __idx = 0,
int __base = 10)
2668 {
return __gnu_cxx::__stoa(&std::wcstoll,
"stoll", __str.c_str(),
2671 inline unsigned long long
2672 stoull(
const __wvstring& __str, std::size_t* __idx = 0,
int __base = 10)
2673 {
return __gnu_cxx::__stoa(&std::wcstoull,
"stoull", __str.c_str(),
2678 stof(
const __wvstring& __str, std::size_t* __idx = 0)
2679 {
return __gnu_cxx::__stoa(&std::wcstof,
"stof", __str.c_str(), __idx); }
2682 stod(
const __wvstring& __str, std::size_t* __idx = 0)
2683 {
return __gnu_cxx::__stoa(&std::wcstod,
"stod", __str.c_str(), __idx); }
2686 stold(
const __wvstring& __str, std::size_t* __idx = 0)
2687 {
return __gnu_cxx::__stoa(&std::wcstold,
"stold", __str.c_str(), __idx); }
2689 #ifndef _GLIBCXX_HAVE_BROKEN_VSWPRINTF
2692 to_wstring(
int __val)
2693 {
return __gnu_cxx::__to_xstring<__wvstring>(&std::vswprintf,
2698 to_wstring(
unsigned __val)
2699 {
return __gnu_cxx::__to_xstring<__wvstring>(&std::vswprintf,
2700 4 *
sizeof(unsigned),
2704 to_wstring(
long __val)
2705 {
return __gnu_cxx::__to_xstring<__wvstring>(&std::vswprintf,
2710 to_wstring(
unsigned long __val)
2711 {
return __gnu_cxx::__to_xstring<__wvstring>(&std::vswprintf,
2712 4 *
sizeof(
unsigned long),
2716 to_wstring(
long long __val)
2717 {
return __gnu_cxx::__to_xstring<__wvstring>(&std::vswprintf,
2718 4 *
sizeof(
long long),
2722 to_wstring(
unsigned long long __val)
2723 {
return __gnu_cxx::__to_xstring<__wvstring>(&std::vswprintf,
2724 4 *
sizeof(
unsigned long long),
2728 to_wstring(
float __val)
2730 const int __n = __numeric_traits<float>::__max_exponent10 + 20;
2731 return __gnu_cxx::__to_xstring<__wvstring>(&std::vswprintf, __n,
2736 to_wstring(
double __val)
2738 const int __n = __numeric_traits<double>::__max_exponent10 + 20;
2739 return __gnu_cxx::__to_xstring<__wvstring>(&std::vswprintf, __n,
2744 to_wstring(
long double __val)
2746 const int __n = __numeric_traits<long double>::__max_exponent10 + 20;
2747 return __gnu_cxx::__to_xstring<__wvstring>(&std::vswprintf, __n,
2753 _GLIBCXX_END_NAMESPACE_VERSION
2758 #ifdef __GXX_EXPERIMENTAL_CXX0X__
2762 namespace std _GLIBCXX_VISIBILITY(default)
2764 _GLIBCXX_BEGIN_NAMESPACE_VERSION
2769 :
public __hash_base<size_t, __gnu_cxx::__vstring>
2773 {
return std::_Hash_impl::hash(__s.
data(), __s.
length()); }
2776 #ifdef _GLIBCXX_USE_WCHAR_T
2780 :
public __hash_base<size_t, __gnu_cxx::__wvstring>
2784 {
return std::_Hash_impl::hash(__s.
data(),
2785 __s.
length() *
sizeof(wchar_t)); }
2789 #ifdef _GLIBCXX_USE_C99_STDINT_TR1
2792 struct hash<__gnu_cxx::__u16vstring>
2793 :
public __hash_base<size_t, __gnu_cxx::__u16vstring>
2797 {
return std::_Hash_impl::hash(__s.
data(),
2798 __s.
length() *
sizeof(char16_t)); }
2803 struct hash<__gnu_cxx::__u32vstring>
2804 :
public __hash_base<size_t, __gnu_cxx::__u32vstring>
2808 {
return std::_Hash_impl::hash(__s.
data(),
2809 __s.
length() *
sizeof(char32_t)); }
2813 _GLIBCXX_END_NAMESPACE_VERSION
size_type find_first_of(const _CharT *__s, size_type __pos=0) const
Find position of a character of C string.
const_reference front() const
_Siter_base< _Iterator >::iterator_type __base(_Iterator __it)
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 max_size() const _GLIBCXX_NOEXCEPT
Returns the size() of the largest possible string.
__versa_string(std::initializer_list< _CharT > __l, const _Alloc &__a=_Alloc())
Construct string from an initializer list.
__versa_string & replace(iterator __i1, iterator __i2, _InputIterator __k1, _InputIterator __k2)
Replace range of characters with range.
__versa_string & operator=(const _CharT *__s)
Copy contents of __s into this string.
void reserve(size_type __res_arg=0)
Attempt to preallocate enough memory for specified number of characters.
__versa_string & replace(size_type __pos, size_type __n1, size_type __n2, _CharT __c)
Replace characters with multiple characters.
The standard allocator, as per [20.4].
__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.
size_type find_last_of(const __versa_string &__str, size_type __pos=npos) const _GLIBCXX_NOEXCEPT
Find last position of a character of string.
__versa_string(size_type __n, _CharT __c, const _Alloc &__a=_Alloc())
Construct string as multiple characters.
__versa_string(const _CharT *__s, size_type __n, const _Alloc &__a=_Alloc())
Construct string initialized by a character array.
void insert(iterator __p, size_type __n, _CharT __c)
Insert multiple characters.
__versa_string & operator=(const __versa_string &__str)
Assign the value of str to this string.
~__versa_string() _GLIBCXX_NOEXCEPT
Destroy the string instance.
const_iterator cbegin() const noexcept
allocator_type get_allocator() const _GLIBCXX_NOEXCEPT
Return copy of allocator used to construct this string.
__versa_string & assign(const __versa_string &__str)
Set value to contents of another string.
const_reverse_iterator crbegin() const noexcept
void insert(iterator __p, _InputIterator __beg, _InputIterator __end)
Insert a range of characters.
char_type widen(char __c) const
Widens characters.
void push_back(_CharT __c)
Append a single character.
Template class __versa_string.Data structure managing sequences of characters and character-like obje...
__versa_string & insert(size_type __pos, const _CharT *__s)
Insert a C string.
size_type rfind(const _CharT *__s, size_type __pos=npos) const
Find last position of a C string.
__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.
__versa_string & operator+=(std::initializer_list< _CharT > __l)
Append an initializer_list of characters.
size_type rfind(const __versa_string &__str, size_type __pos=npos) const _GLIBCXX_NOEXCEPT
Find last position of a string.
__versa_string & append(_InputIterator __first, _InputIterator __last)
Append a range of characters.
void clear() _GLIBCXX_NOEXCEPT
__versa_string & assign(const _CharT *__s)
Set value to contents of a C string.
const_reverse_iterator rend() const _GLIBCXX_NOEXCEPT
void resize(size_type __n)
Resizes the string to the specified number of characters.
One of the comparison functors.
const_reference back() const
__versa_string & replace(iterator __i1, iterator __i2, const _CharT *__s, size_type __n)
Replace range of characters with C substring.
iterator begin() _GLIBCXX_NOEXCEPT
const _CharT * data() const _GLIBCXX_NOEXCEPT
Return const pointer to contents.
size_type find_first_of(const __versa_string &__str, size_type __pos=0) const _GLIBCXX_NOEXCEPT
Find position of a character of string.
std::basic_string< _CharT, _Traits, _Alloc > to_string() const
Returns a character interpretation of the bitset.
__versa_string & assign(const __versa_string &__str, size_type __pos, size_type __n)
Set value to a substring of a string.
__versa_string(const _CharT *__s, const _Alloc &__a=_Alloc())
Construct string as copy of a C string.
__versa_string()
Default constructor creates an empty string.
bool empty() const _GLIBCXX_NOEXCEPT
reference operator[](size_type __pos)
Subscript access to the data contained in the string.
__versa_string & operator+=(_CharT __c)
Append a character.
size_type find(const _CharT *__s, size_type __pos, size_type __n) const
Find position of a C substring.
const_reference at(size_type __n) const
Provides access to the data contained in the string.
__versa_string & insert(size_type __pos, size_type __n, _CharT __c)
Insert multiple characters.
__versa_string & replace(size_type __pos, size_type __n, const __versa_string &__str)
Replace characters with value from another string.
size_type find_first_not_of(const _CharT *__s, size_type __pos=0) const
Find position of a character not in C string.
size_type capacity() const _GLIBCXX_NOEXCEPT
void resize(size_type __n, _CharT __c)
Resizes the string to the specified number of characters.
const_iterator cend() const noexcept
__versa_string & append(const _CharT *__s, size_type __n)
Append a C substring.
__versa_string substr(size_type __pos=0, size_type __n=npos) const
Get a substring.
size_type find_last_of(_CharT __c, size_type __pos=npos) const _GLIBCXX_NOEXCEPT
Find last position of a character.
__versa_string & replace(iterator __i1, iterator __i2, const __versa_string &__str)
Replace range of characters with string.
__versa_string & append(const _CharT *__s)
Append a C string.
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.
const _Tp & min(const _Tp &, const _Tp &)
This does what you think it does.
__versa_string & replace(iterator __i1, iterator __i2, size_type __n, _CharT __c)
Replace range of characters with multiple characters.
__versa_string(__versa_string &&__str) noexcept
String move constructor.
size_type length() const _GLIBCXX_NOEXCEPT
Returns the number of characters in the string, not including any null-termination.
Template class basic_istream.This is the base class for all input streams. It provides text formattin...
iterator erase(iterator __position)
Remove one character.
basic_istream< _CharT, _Traits > & getline(basic_istream< _CharT, _Traits > &__is, basic_string< _CharT, _Traits, _Alloc > &__str, _CharT __delim)
Read a line from stream into a string.
__versa_string & assign(std::initializer_list< _CharT > __l)
Set value to an initializer_list of characters.
const_reference operator[](size_type __pos) const
Subscript access to the data contained in the string.
const_reverse_iterator rbegin() const _GLIBCXX_NOEXCEPT
size_type find_first_not_of(const __versa_string &__str, size_type __pos=0) const _GLIBCXX_NOEXCEPT
Find position of a character not in string.
iterator end() _GLIBCXX_NOEXCEPT
reverse_iterator rend() _GLIBCXX_NOEXCEPT
const_iterator end() const _GLIBCXX_NOEXCEPT
Basis for explicit traits specializations.
__versa_string & assign(size_type __n, _CharT __c)
Set value to multiple characters.
__versa_string & replace(size_type __pos1, size_type __n1, const __versa_string &__str, size_type __pos2, size_type __n2)
Replace characters with value from another string.
__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, const _CharT *__s, size_type __n2)
Replace characters with value of a C substring.
__versa_string & operator=(__versa_string &&__str)
String move assignment operator.
reverse_iterator rbegin() _GLIBCXX_NOEXCEPT
iterator erase(iterator __first, iterator __last)
Remove a range of characters.
size_type copy(_CharT *__s, size_type __n, size_type __pos=0) const
Copy substring into C string.
__versa_string & replace(iterator __i1, iterator __i2, std::initializer_list< _CharT > __l)
Replace range of characters with initializer_list.
bitset< _Nb > operator>>(size_t __position) const _GLIBCXX_NOEXCEPT
Self-explanatory.
size_type size() const _GLIBCXX_NOEXCEPT
Returns the number of characters in the string, not including any null-termination.
__versa_string & operator+=(const _CharT *__s)
Append a C string.
void swap(__versa_string &__s)
Swap contents with another string.
__versa_string & erase(size_type __pos=0, size_type __n=npos)
Remove characters.
void shrink_to_fit()
A non-binding request to reduce capacity() to size().
__versa_string & append(const __versa_string &__str, size_type __pos, size_type __n)
Append a substring.
__versa_string & replace(size_type __pos, size_type __n1, const _CharT *__s)
Replace characters with value of a C string.
const_iterator begin() const _GLIBCXX_NOEXCEPT
__versa_string(const __versa_string &__str, size_type __pos, size_type __n=npos)
Construct string as copy of a substring.
size_type find(const __versa_string &__str, size_type __pos=0) const _GLIBCXX_NOEXCEPT
Find position of a string.
__versa_string & operator+=(const __versa_string &__str)
Append a string to this string.
iterator insert(iterator __p, _CharT __c)
Insert one character.
__versa_string & insert(size_type __pos, const _CharT *__s, size_type __n)
Insert a C substring.
__versa_string(const _Alloc &__a)
Construct an empty string using allocator a.
__versa_string & assign(_InputIterator __first, _InputIterator __last)
Set value to a range of characters.
static const size_type npos
Value returned by various member functions when they fail.
size_type find(const _CharT *__s, size_type __pos=0) const
Find position of a C string.
Primary class template hash.
__versa_string & assign(__versa_string &&__str)
Set value to contents of another string.
__versa_string & append(const __versa_string &__str)
Append a string to this string.
void insert(iterator __p, std::initializer_list< _CharT > __l)
Insert an initializer_list of characters.
const _CharT * c_str() const _GLIBCXX_NOEXCEPT
Return const pointer to null-terminated contents.
__versa_string & append(size_type __n, _CharT __c)
Append multiple characters.
__versa_string & replace(iterator __i1, iterator __i2, const _CharT *__s)
Replace range of characters with C string.
size_type find_first_of(_CharT __c, size_type __pos=0) const _GLIBCXX_NOEXCEPT
Find position of a character.
int compare(const __versa_string &__str) const
Compare to a string.
__versa_string(_InputIterator __beg, _InputIterator __end, const _Alloc &__a=_Alloc())
Construct string as copy of a range.
__versa_string & operator=(_CharT __c)
Set value to string of length 1.
const_reverse_iterator crend() const noexcept
__versa_string & assign(const _CharT *__s, size_type __n)
Set value to a C substring.
size_type find_last_not_of(const __versa_string &__str, size_type __pos=npos) const _GLIBCXX_NOEXCEPT
Find last position of a character not in string.
void pop_back()
Remove the last character.
__versa_string & insert(size_type __pos1, const __versa_string &__str)
Insert value of a string.