34 #ifndef _BASIC_STRING_H
35 #define _BASIC_STRING_H 1
37 #pragma GCC system_header
41 #if __cplusplus >= 201103L
42 #include <initializer_list>
45 namespace std _GLIBCXX_VISIBILITY(default)
47 _GLIBCXX_BEGIN_NAMESPACE_VERSION
111 template<
typename _CharT,
typename _Traits,
typename _Alloc>
114 typedef typename _Alloc::template rebind<_CharT>::other _CharT_alloc_type;
118 typedef _Traits traits_type;
119 typedef typename _Traits::char_type value_type;
120 typedef _Alloc allocator_type;
121 typedef typename _CharT_alloc_type::size_type size_type;
122 typedef typename _CharT_alloc_type::difference_type difference_type;
123 typedef typename _CharT_alloc_type::reference reference;
124 typedef typename _CharT_alloc_type::const_reference const_reference;
125 typedef typename _CharT_alloc_type::pointer pointer;
126 typedef typename _CharT_alloc_type::const_pointer const_pointer;
127 typedef __gnu_cxx::__normal_iterator<pointer, basic_string> iterator;
128 typedef __gnu_cxx::__normal_iterator<const_pointer, basic_string>
151 size_type _M_capacity;
152 _Atomic_word _M_refcount;
155 struct _Rep : _Rep_base
158 typedef typename _Alloc::template rebind<char>::other _Raw_bytes_alloc;
173 static const size_type _S_max_size;
174 static const _CharT _S_terminal;
178 static size_type _S_empty_rep_storage[];
181 _S_empty_rep() _GLIBCXX_NOEXCEPT
186 void* __p =
reinterpret_cast<void*
>(&_S_empty_rep_storage);
187 return *
reinterpret_cast<_Rep*
>(__p);
191 _M_is_leaked()
const _GLIBCXX_NOEXCEPT
192 {
return this->_M_refcount < 0; }
195 _M_is_shared()
const _GLIBCXX_NOEXCEPT
196 {
return this->_M_refcount > 0; }
199 _M_set_leaked() _GLIBCXX_NOEXCEPT
200 { this->_M_refcount = -1; }
203 _M_set_sharable() _GLIBCXX_NOEXCEPT
204 { this->_M_refcount = 0; }
207 _M_set_length_and_sharable(size_type __n) _GLIBCXX_NOEXCEPT
209 #if _GLIBCXX_FULLY_DYNAMIC_STRING == 0
210 if (__builtin_expect(
this != &_S_empty_rep(),
false))
213 this->_M_set_sharable();
214 this->_M_length = __n;
215 traits_type::assign(this->_M_refdata()[__n], _S_terminal);
223 {
return reinterpret_cast<_CharT*
>(
this + 1); }
226 _M_grab(
const _Alloc& __alloc1,
const _Alloc& __alloc2)
228 return (!_M_is_leaked() && __alloc1 == __alloc2)
229 ? _M_refcopy() : _M_clone(__alloc1);
234 _S_create(size_type, size_type,
const _Alloc&);
237 _M_dispose(
const _Alloc& __a) _GLIBCXX_NOEXCEPT
239 #if _GLIBCXX_FULLY_DYNAMIC_STRING == 0
240 if (__builtin_expect(
this != &_S_empty_rep(),
false))
244 _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&this->_M_refcount);
245 if (__gnu_cxx::__exchange_and_add_dispatch(&this->_M_refcount,
248 _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&this->_M_refcount);
255 _M_destroy(
const _Alloc&)
throw();
260 #if _GLIBCXX_FULLY_DYNAMIC_STRING == 0
261 if (__builtin_expect(
this != &_S_empty_rep(),
false))
263 __gnu_cxx::__atomic_add_dispatch(&this->_M_refcount, 1);
268 _M_clone(
const _Alloc&, size_type __res = 0);
272 struct _Alloc_hider : _Alloc
274 _Alloc_hider(_CharT* __dat,
const _Alloc& __a) _GLIBCXX_NOEXCEPT
275 : _Alloc(__a), _M_p(__dat) { }
285 static const size_type
npos =
static_cast<size_type
>(-1);
289 mutable _Alloc_hider _M_dataplus;
292 _M_data() const _GLIBCXX_NOEXCEPT
293 {
return _M_dataplus._M_p; }
296 _M_data(_CharT* __p) _GLIBCXX_NOEXCEPT
297 {
return (_M_dataplus._M_p = __p); }
300 _M_rep() const _GLIBCXX_NOEXCEPT
301 {
return &((
reinterpret_cast<_Rep*
> (_M_data()))[-1]); }
306 _M_ibegin() const _GLIBCXX_NOEXCEPT
307 {
return iterator(_M_data()); }
310 _M_iend() const _GLIBCXX_NOEXCEPT
311 {
return iterator(_M_data() + this->
size()); }
316 if (!_M_rep()->_M_is_leaked())
321 _M_check(size_type __pos,
const char* __s)
const
323 if (__pos > this->
size())
324 __throw_out_of_range_fmt(__N(
"%s: __pos (which is %zu) > "
325 "this->size() (which is %zu)"),
326 __s, __pos, this->
size());
331 _M_check_length(size_type __n1, size_type __n2,
const char* __s)
const
334 __throw_length_error(__N(__s));
339 _M_limit(size_type __pos, size_type __off)
const _GLIBCXX_NOEXCEPT
341 const bool __testoff = __off < this->
size() - __pos;
342 return __testoff ? __off : this->
size() - __pos;
347 _M_disjunct(
const _CharT* __s)
const _GLIBCXX_NOEXCEPT
349 return (less<const _CharT*>()(__s, _M_data())
350 || less<const _CharT*>()(_M_data() + this->
size(), __s));
356 _M_copy(_CharT* __d,
const _CharT* __s, size_type __n) _GLIBCXX_NOEXCEPT
359 traits_type::assign(*__d, *__s);
361 traits_type::copy(__d, __s, __n);
365 _M_move(_CharT* __d,
const _CharT* __s, size_type __n) _GLIBCXX_NOEXCEPT
368 traits_type::assign(*__d, *__s);
374 _M_assign(_CharT* __d, size_type __n, _CharT __c) _GLIBCXX_NOEXCEPT
377 traits_type::assign(*__d, __c);
379 traits_type::assign(__d, __n, __c);
384 template<
class _Iterator>
386 _S_copy_chars(_CharT* __p, _Iterator __k1, _Iterator __k2)
389 for (; __k1 != __k2; ++__k1, ++__p)
390 traits_type::assign(*__p, *__k1);
394 _S_copy_chars(_CharT* __p, iterator __k1, iterator __k2) _GLIBCXX_NOEXCEPT
395 { _S_copy_chars(__p, __k1.base(), __k2.base()); }
398 _S_copy_chars(_CharT* __p, const_iterator __k1, const_iterator __k2)
400 { _S_copy_chars(__p, __k1.base(), __k2.base()); }
403 _S_copy_chars(_CharT* __p, _CharT* __k1, _CharT* __k2) _GLIBCXX_NOEXCEPT
404 { _M_copy(__p, __k1, __k2 - __k1); }
407 _S_copy_chars(_CharT* __p,
const _CharT* __k1,
const _CharT* __k2)
409 { _M_copy(__p, __k1, __k2 - __k1); }
412 _S_compare(size_type __n1, size_type __n2) _GLIBCXX_NOEXCEPT
414 const difference_type __d = difference_type(__n1 - __n2);
416 if (__d > __gnu_cxx::__numeric_traits<int>::__max)
417 return __gnu_cxx::__numeric_traits<int>::__max;
418 else if (__d < __gnu_cxx::__numeric_traits<int>::__min)
419 return __gnu_cxx::__numeric_traits<int>::__min;
425 _M_mutate(size_type __pos, size_type __len1, size_type __len2);
431 _S_empty_rep() _GLIBCXX_NOEXCEPT
432 {
return _Rep::_S_empty_rep(); }
443 #if _GLIBCXX_FULLY_DYNAMIC_STRING == 0
444 : _M_dataplus(_S_empty_rep()._M_refdata(), _Alloc()) { }
446 : _M_dataplus(_S_construct(size_type(), _CharT(), _Alloc()), _Alloc()){ }
468 size_type __n = npos);
477 size_type __n,
const _Alloc& __a);
489 const _Alloc& __a = _Alloc());
495 basic_string(
const _CharT* __s,
const _Alloc& __a = _Alloc());
502 basic_string(size_type __n, _CharT __c,
const _Alloc& __a = _Alloc());
504 #if __cplusplus >= 201103L
513 #if _GLIBCXX_FULLY_DYNAMIC_STRING == 0
516 : _M_dataplus(__str._M_dataplus)
518 #if _GLIBCXX_FULLY_DYNAMIC_STRING == 0
519 __str._M_data(_S_empty_rep()._M_refdata());
521 __str._M_data(_S_construct(size_type(), _CharT(),
get_allocator()));
530 basic_string(initializer_list<_CharT> __l,
const _Alloc& __a = _Alloc());
539 template<
class _InputIterator>
540 basic_string(_InputIterator __beg, _InputIterator __end,
541 const _Alloc& __a = _Alloc());
555 {
return this->
assign(__str); }
563 {
return this->
assign(__s); }
579 #if __cplusplus >= 201103L
603 this->
assign(__l.begin(), __l.size());
617 return iterator(_M_data());
626 {
return const_iterator(_M_data()); }
636 return iterator(_M_data() + this->
size());
644 end() const _GLIBCXX_NOEXCEPT
645 {
return const_iterator(_M_data() + this->
size()); }
654 {
return reverse_iterator(this->
end()); }
661 const_reverse_iterator
663 {
return const_reverse_iterator(this->
end()); }
672 {
return reverse_iterator(this->
begin()); }
679 const_reverse_iterator
681 {
return const_reverse_iterator(this->
begin()); }
683 #if __cplusplus >= 201103L
690 {
return const_iterator(this->_M_data()); }
698 {
return const_iterator(this->_M_data() + this->
size()); }
705 const_reverse_iterator
707 {
return const_reverse_iterator(this->
end()); }
714 const_reverse_iterator
716 {
return const_reverse_iterator(this->
begin()); }
725 {
return _M_rep()->_M_length; }
731 {
return _M_rep()->_M_length; }
736 {
return _Rep::_S_max_size; }
749 resize(size_type __n, _CharT __c);
763 { this->
resize(__n, _CharT()); }
765 #if __cplusplus >= 201103L
786 {
return _M_rep()->_M_capacity; }
806 reserve(size_type __res_arg = 0);
814 { _M_mutate(0, this->
size(), 0); }
822 {
return this->
size() == 0; }
838 _GLIBCXX_DEBUG_ASSERT(__pos <=
size());
839 return _M_data()[__pos];
857 _GLIBCXX_DEBUG_ASSERT(__pos <=
size());
859 _GLIBCXX_DEBUG_PEDASSERT(__cplusplus >= 201103L || __pos <
size());
861 return _M_data()[__pos];
875 at(size_type __n)
const
877 if (__n >= this->
size())
878 __throw_out_of_range_fmt(__N(
"basic_string::at: __n "
879 "(which is %zu) >= this->size() "
882 return _M_data()[__n];
900 __throw_out_of_range_fmt(__N(
"basic_string::at: __n "
901 "(which is %zu) >= this->size() "
905 return _M_data()[__n];
908 #if __cplusplus >= 201103L
950 {
return this->
append(__str); }
959 {
return this->
append(__s); }
973 #if __cplusplus >= 201103L
981 {
return this->
append(__l.begin(), __l.size()); }
1015 append(
const _CharT* __s, size_type __n);
1025 __glibcxx_requires_string(__s);
1026 return this->
append(__s, traits_type::length(__s));
1038 append(size_type __n, _CharT __c);
1040 #if __cplusplus >= 201103L
1048 {
return this->
append(__l.begin(), __l.size()); }
1059 template<
class _InputIterator>
1061 append(_InputIterator __first, _InputIterator __last)
1062 {
return this->
replace(_M_iend(), _M_iend(), __first, __last); }
1071 const size_type __len = 1 + this->
size();
1072 if (__len > this->
capacity() || _M_rep()->_M_is_shared())
1074 traits_type::assign(_M_data()[this->
size()], __c);
1075 _M_rep()->_M_set_length_and_sharable(__len);
1086 #if __cplusplus >= 201103L
1119 {
return this->
assign(__str._M_data()
1120 + __str._M_check(__pos,
"basic_string::assign"),
1121 __str._M_limit(__pos, __n)); }
1134 assign(
const _CharT* __s, size_type __n);
1148 __glibcxx_requires_string(__s);
1149 return this->
assign(__s, traits_type::length(__s));
1163 {
return _M_replace_aux(size_type(0), this->
size(), __n, __c); }
1173 template<
class _InputIterator>
1175 assign(_InputIterator __first, _InputIterator __last)
1176 {
return this->
replace(_M_ibegin(), _M_iend(), __first, __last); }
1178 #if __cplusplus >= 201103L
1186 {
return this->
assign(__l.begin(), __l.size()); }
1203 insert(iterator __p, size_type __n, _CharT __c)
1204 { this->
replace(__p, __p, __n, __c); }
1218 template<
class _InputIterator>
1220 insert(iterator __p, _InputIterator __beg, _InputIterator __end)
1221 { this->
replace(__p, __p, __beg, __end); }
1223 #if __cplusplus >= 201103L
1231 insert(iterator __p, initializer_list<_CharT> __l)
1233 _GLIBCXX_DEBUG_PEDASSERT(__p >= _M_ibegin() && __p <= _M_iend());
1234 this->
insert(__p - _M_ibegin(), __l.begin(), __l.size());
1252 {
return this->
insert(__pos1, __str, size_type(0), __str.
size()); }
1274 size_type __pos2, size_type __n)
1275 {
return this->
insert(__pos1, __str._M_data()
1276 + __str._M_check(__pos2,
"basic_string::insert"),
1277 __str._M_limit(__pos2, __n)); }
1296 insert(size_type __pos,
const _CharT* __s, size_type __n);
1316 __glibcxx_requires_string(__s);
1317 return this->
insert(__pos, __s, traits_type::length(__s));
1337 insert(size_type __pos, size_type __n, _CharT __c)
1338 {
return _M_replace_aux(_M_check(__pos,
"basic_string::insert"),
1339 size_type(0), __n, __c); }
1357 _GLIBCXX_DEBUG_PEDASSERT(__p >= _M_ibegin() && __p <= _M_iend());
1358 const size_type __pos = __p - _M_ibegin();
1359 _M_replace_aux(__pos, size_type(0), size_type(1), __c);
1360 _M_rep()->_M_set_leaked();
1361 return iterator(_M_data() + __pos);
1380 erase(size_type __pos = 0, size_type __n = npos)
1382 _M_mutate(_M_check(__pos,
"basic_string::erase"),
1383 _M_limit(__pos, __n), size_type(0));
1398 _GLIBCXX_DEBUG_PEDASSERT(__position >= _M_ibegin()
1399 && __position < _M_iend());
1400 const size_type __pos = __position - _M_ibegin();
1401 _M_mutate(__pos, size_type(1), size_type(0));
1402 _M_rep()->_M_set_leaked();
1403 return iterator(_M_data() + __pos);
1416 erase(iterator __first, iterator __last);
1418 #if __cplusplus >= 201103L
1448 {
return this->
replace(__pos, __n, __str._M_data(), __str.
size()); }
1470 size_type __pos2, size_type __n2)
1471 {
return this->
replace(__pos1, __n1, __str._M_data()
1472 + __str._M_check(__pos2,
"basic_string::replace"),
1473 __str._M_limit(__pos2, __n2)); }
1494 replace(size_type __pos, size_type __n1,
const _CharT* __s,
1514 replace(size_type __pos, size_type __n1,
const _CharT* __s)
1516 __glibcxx_requires_string(__s);
1517 return this->
replace(__pos, __n1, __s, traits_type::length(__s));
1538 replace(size_type __pos, size_type __n1, size_type __n2, _CharT __c)
1539 {
return _M_replace_aux(_M_check(__pos,
"basic_string::replace"),
1540 _M_limit(__pos, __n1), __n2, __c); }
1557 {
return this->
replace(__i1, __i2, __str._M_data(), __str.
size()); }
1575 replace(iterator __i1, iterator __i2,
const _CharT* __s, size_type __n)
1577 _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
1578 && __i2 <= _M_iend());
1579 return this->
replace(__i1 - _M_ibegin(), __i2 - __i1, __s, __n);
1596 replace(iterator __i1, iterator __i2,
const _CharT* __s)
1598 __glibcxx_requires_string(__s);
1599 return this->
replace(__i1, __i2, __s, traits_type::length(__s));
1617 replace(iterator __i1, iterator __i2, size_type __n, _CharT __c)
1619 _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
1620 && __i2 <= _M_iend());
1621 return _M_replace_aux(__i1 - _M_ibegin(), __i2 - __i1, __n, __c);
1639 template<
class _InputIterator>
1642 _InputIterator __k1, _InputIterator __k2)
1644 _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
1645 && __i2 <= _M_iend());
1646 __glibcxx_requires_valid_range(__k1, __k2);
1647 typedef typename std::__is_integer<_InputIterator>::__type _Integral;
1648 return _M_replace_dispatch(__i1, __i2, __k1, __k2, _Integral());
1654 replace(iterator __i1, iterator __i2, _CharT* __k1, _CharT* __k2)
1656 _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
1657 && __i2 <= _M_iend());
1658 __glibcxx_requires_valid_range(__k1, __k2);
1659 return this->
replace(__i1 - _M_ibegin(), __i2 - __i1,
1664 replace(iterator __i1, iterator __i2,
1665 const _CharT* __k1,
const _CharT* __k2)
1667 _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
1668 && __i2 <= _M_iend());
1669 __glibcxx_requires_valid_range(__k1, __k2);
1670 return this->
replace(__i1 - _M_ibegin(), __i2 - __i1,
1675 replace(iterator __i1, iterator __i2, iterator __k1, iterator __k2)
1677 _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
1678 && __i2 <= _M_iend());
1679 __glibcxx_requires_valid_range(__k1, __k2);
1680 return this->
replace(__i1 - _M_ibegin(), __i2 - __i1,
1681 __k1.base(), __k2 - __k1);
1685 replace(iterator __i1, iterator __i2,
1686 const_iterator __k1, const_iterator __k2)
1688 _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
1689 && __i2 <= _M_iend());
1690 __glibcxx_requires_valid_range(__k1, __k2);
1691 return this->
replace(__i1 - _M_ibegin(), __i2 - __i1,
1692 __k1.base(), __k2 - __k1);
1695 #if __cplusplus >= 201103L
1711 initializer_list<_CharT> __l)
1712 {
return this->
replace(__i1, __i2, __l.begin(), __l.end()); }
1716 template<
class _Integer>
1718 _M_replace_dispatch(iterator __i1, iterator __i2, _Integer __n,
1719 _Integer __val, __true_type)
1720 {
return _M_replace_aux(__i1 - _M_ibegin(), __i2 - __i1, __n, __val); }
1722 template<
class _InputIterator>
1724 _M_replace_dispatch(iterator __i1, iterator __i2, _InputIterator __k1,
1725 _InputIterator __k2, __false_type);
1728 _M_replace_aux(size_type __pos1, size_type __n1, size_type __n2,
1732 _M_replace_safe(size_type __pos1, size_type __n1,
const _CharT* __s,
1737 template<
class _InIterator>
1739 _S_construct_aux(_InIterator __beg, _InIterator __end,
1740 const _Alloc& __a, __false_type)
1742 typedef typename iterator_traits<_InIterator>::iterator_category _Tag;
1743 return _S_construct(__beg, __end, __a, _Tag());
1748 template<
class _Integer>
1750 _S_construct_aux(_Integer __beg, _Integer __end,
1751 const _Alloc& __a, __true_type)
1752 {
return _S_construct_aux_2(static_cast<size_type>(__beg),
1756 _S_construct_aux_2(size_type __req, _CharT __c,
const _Alloc& __a)
1757 {
return _S_construct(__req, __c, __a); }
1759 template<
class _InIterator>
1761 _S_construct(_InIterator __beg, _InIterator __end,
const _Alloc& __a)
1763 typedef typename std::__is_integer<_InIterator>::__type _Integral;
1764 return _S_construct_aux(__beg, __end, __a, _Integral());
1768 template<
class _InIterator>
1770 _S_construct(_InIterator __beg, _InIterator __end,
const _Alloc& __a,
1771 input_iterator_tag);
1775 template<
class _FwdIterator>
1777 _S_construct(_FwdIterator __beg, _FwdIterator __end,
const _Alloc& __a,
1778 forward_iterator_tag);
1781 _S_construct(size_type __req, _CharT __c,
const _Alloc& __a);
1798 copy(_CharT* __s, size_type __n, size_type __pos = 0)
const;
1820 {
return _M_data(); }
1830 {
return _M_data(); }
1837 {
return _M_dataplus; }
1852 find(
const _CharT* __s, size_type __pos, size_type __n)
const;
1867 {
return this->
find(__str.
data(), __pos, __str.
size()); }
1880 find(
const _CharT* __s, size_type __pos = 0)
const
1882 __glibcxx_requires_string(__s);
1883 return this->
find(__s, __pos, traits_type::length(__s));
1897 find(_CharT __c, size_type __pos = 0) const _GLIBCXX_NOEXCEPT;
1912 {
return this->
rfind(__str.data(), __pos, __str.size()); }
1927 rfind(
const _CharT* __s, size_type __pos, size_type __n)
const;
1940 rfind(
const _CharT* __s, size_type __pos = npos)
const
1942 __glibcxx_requires_string(__s);
1943 return this->
rfind(__s, __pos, traits_type::length(__s));
1957 rfind(_CharT __c, size_type __pos = npos) const _GLIBCXX_NOEXCEPT;
1973 {
return this->
find_first_of(__str.data(), __pos, __str.size()); }
1988 find_first_of(
const _CharT* __s, size_type __pos, size_type __n)
const;
2003 __glibcxx_requires_string(__s);
2004 return this->
find_first_of(__s, __pos, traits_type::length(__s));
2021 {
return this->
find(__c, __pos); }
2052 find_last_of(
const _CharT* __s, size_type __pos, size_type __n)
const;
2067 __glibcxx_requires_string(__s);
2068 return this->
find_last_of(__s, __pos, traits_type::length(__s));
2085 {
return this->
rfind(__c, __pos); }
2116 size_type __n)
const;
2131 __glibcxx_requires_string(__s);
2179 size_type __n)
const;
2194 __glibcxx_requires_string(__s);
2225 substr(size_type __pos = 0, size_type __n = npos)
const
2227 _M_check(__pos,
"basic_string::substr"), __n); }
2246 const size_type __size = this->
size();
2247 const size_type __osize = __str.
size();
2248 const size_type __len =
std::min(__size, __osize);
2250 int __r = traits_type::compare(_M_data(), __str.
data(), __len);
2252 __r = _S_compare(__size, __osize);
2303 size_type __pos2, size_type __n2)
const;
2320 compare(
const _CharT* __s)
const;
2344 compare(size_type __pos, size_type __n1,
const _CharT* __s)
const;
2371 compare(size_type __pos, size_type __n1,
const _CharT* __s,
2372 size_type __n2)
const;
2382 template<
typename _CharT,
typename _Traits,
typename _Alloc>
2383 basic_string<_CharT, _Traits, _Alloc>
2398 template<
typename _CharT,
typename _Traits,
typename _Alloc>
2399 basic_string<_CharT,_Traits,_Alloc>
2401 const basic_string<_CharT,_Traits,_Alloc>& __rhs);
2409 template<
typename _CharT,
typename _Traits,
typename _Alloc>
2410 basic_string<_CharT,_Traits,_Alloc>
2411 operator+(_CharT __lhs,
const basic_string<_CharT,_Traits,_Alloc>& __rhs);
2419 template<
typename _CharT,
typename _Traits,
typename _Alloc>
2420 inline basic_string<_CharT, _Traits, _Alloc>
2422 const _CharT* __rhs)
2435 template<
typename _CharT,
typename _Traits,
typename _Alloc>
2436 inline basic_string<_CharT, _Traits, _Alloc>
2440 typedef typename __string_type::size_type __size_type;
2441 __string_type __str(__lhs);
2442 __str.append(__size_type(1), __rhs);
2446 #if __cplusplus >= 201103L
2447 template<
typename _CharT,
typename _Traits,
typename _Alloc>
2448 inline basic_string<_CharT, _Traits, _Alloc>
2449 operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
2450 const basic_string<_CharT, _Traits, _Alloc>& __rhs)
2451 {
return std::move(__lhs.append(__rhs)); }
2453 template<
typename _CharT,
typename _Traits,
typename _Alloc>
2454 inline basic_string<_CharT, _Traits, _Alloc>
2455 operator+(
const basic_string<_CharT, _Traits, _Alloc>& __lhs,
2456 basic_string<_CharT, _Traits, _Alloc>&& __rhs)
2457 {
return std::move(__rhs.insert(0, __lhs)); }
2459 template<
typename _CharT,
typename _Traits,
typename _Alloc>
2460 inline basic_string<_CharT, _Traits, _Alloc>
2461 operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
2462 basic_string<_CharT, _Traits, _Alloc>&& __rhs)
2464 const auto __size = __lhs.size() + __rhs.size();
2465 const bool __cond = (__size > __lhs.capacity()
2466 && __size <= __rhs.capacity());
2467 return __cond ?
std::move(__rhs.insert(0, __lhs))
2471 template<
typename _CharT,
typename _Traits,
typename _Alloc>
2472 inline basic_string<_CharT, _Traits, _Alloc>
2474 basic_string<_CharT, _Traits, _Alloc>&& __rhs)
2475 {
return std::move(__rhs.insert(0, __lhs)); }
2477 template<
typename _CharT,
typename _Traits,
typename _Alloc>
2478 inline basic_string<_CharT, _Traits, _Alloc>
2480 basic_string<_CharT, _Traits, _Alloc>&& __rhs)
2481 {
return std::move(__rhs.insert(0, 1, __lhs)); }
2483 template<
typename _CharT,
typename _Traits,
typename _Alloc>
2484 inline basic_string<_CharT, _Traits, _Alloc>
2485 operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
2486 const _CharT* __rhs)
2487 {
return std::move(__lhs.append(__rhs)); }
2489 template<
typename _CharT,
typename _Traits,
typename _Alloc>
2490 inline basic_string<_CharT, _Traits, _Alloc>
2491 operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
2493 {
return std::move(__lhs.append(1, __rhs)); }
2503 template<
typename _CharT,
typename _Traits,
typename _Alloc>
2507 {
return __lhs.
compare(__rhs) == 0; }
2509 template<
typename _CharT>
2511 typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value,
bool>::__type
2512 operator==(
const basic_string<_CharT>& __lhs,
2513 const basic_string<_CharT>& __rhs)
2514 {
return (__lhs.size() == __rhs.size()
2524 template<
typename _CharT,
typename _Traits,
typename _Alloc>
2526 operator==(
const _CharT* __lhs,
2528 {
return __rhs.
compare(__lhs) == 0; }
2536 template<
typename _CharT,
typename _Traits,
typename _Alloc>
2539 const _CharT* __rhs)
2540 {
return __lhs.
compare(__rhs) == 0; }
2549 template<
typename _CharT,
typename _Traits,
typename _Alloc>
2553 {
return !(__lhs == __rhs); }
2561 template<
typename _CharT,
typename _Traits,
typename _Alloc>
2563 operator!=(
const _CharT* __lhs,
2565 {
return !(__lhs == __rhs); }
2573 template<
typename _CharT,
typename _Traits,
typename _Alloc>
2576 const _CharT* __rhs)
2577 {
return !(__lhs == __rhs); }
2586 template<
typename _CharT,
typename _Traits,
typename _Alloc>
2588 operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
2590 {
return __lhs.
compare(__rhs) < 0; }
2598 template<
typename _CharT,
typename _Traits,
typename _Alloc>
2600 operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
2601 const _CharT* __rhs)
2602 {
return __lhs.compare(__rhs) < 0; }
2610 template<
typename _CharT,
typename _Traits,
typename _Alloc>
2614 {
return __rhs.
compare(__lhs) > 0; }
2623 template<
typename _CharT,
typename _Traits,
typename _Alloc>
2627 {
return __lhs.
compare(__rhs) > 0; }
2635 template<
typename _CharT,
typename _Traits,
typename _Alloc>
2638 const _CharT* __rhs)
2639 {
return __lhs.
compare(__rhs) > 0; }
2647 template<
typename _CharT,
typename _Traits,
typename _Alloc>
2651 {
return __rhs.
compare(__lhs) < 0; }
2660 template<
typename _CharT,
typename _Traits,
typename _Alloc>
2662 operator<=(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
2664 {
return __lhs.
compare(__rhs) <= 0; }
2672 template<
typename _CharT,
typename _Traits,
typename _Alloc>
2674 operator<=(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
2675 const _CharT* __rhs)
2676 {
return __lhs.compare(__rhs) <= 0; }
2684 template<
typename _CharT,
typename _Traits,
typename _Alloc>
2688 {
return __rhs.
compare(__lhs) >= 0; }
2697 template<
typename _CharT,
typename _Traits,
typename _Alloc>
2701 {
return __lhs.
compare(__rhs) >= 0; }
2709 template<
typename _CharT,
typename _Traits,
typename _Alloc>
2712 const _CharT* __rhs)
2713 {
return __lhs.
compare(__rhs) >= 0; }
2721 template<
typename _CharT,
typename _Traits,
typename _Alloc>
2725 {
return __rhs.
compare(__lhs) <= 0; }
2734 template<
typename _CharT,
typename _Traits,
typename _Alloc>
2738 { __lhs.
swap(__rhs); }
2752 template<
typename _CharT,
typename _Traits,
typename _Alloc>
2753 basic_istream<_CharT, _Traits>&
2754 operator>>(basic_istream<_CharT, _Traits>& __is,
2755 basic_string<_CharT, _Traits, _Alloc>& __str);
2758 basic_istream<char>&
2759 operator>>(basic_istream<char>& __is, basic_string<char>& __str);
2770 template<
typename _CharT,
typename _Traits,
typename _Alloc>
2771 inline basic_ostream<_CharT, _Traits>&
2772 operator<<(basic_ostream<_CharT, _Traits>& __os,
2777 return __ostream_insert(__os, __str.data(), __str.size());
2793 template<
typename _CharT,
typename _Traits,
typename _Alloc>
2794 basic_istream<_CharT, _Traits>&
2795 getline(basic_istream<_CharT, _Traits>& __is,
2796 basic_string<_CharT, _Traits, _Alloc>& __str, _CharT __delim);
2810 template<
typename _CharT,
typename _Traits,
typename _Alloc>
2811 inline basic_istream<_CharT, _Traits>&
2814 {
return std::getline(__is, __str, __is.widen(
'\n')); }
2816 #if __cplusplus >= 201103L
2818 template<
typename _CharT,
typename _Traits,
typename _Alloc>
2819 inline basic_istream<_CharT, _Traits>&
2825 template<
typename _CharT,
typename _Traits,
typename _Alloc>
2826 inline basic_istream<_CharT, _Traits>&
2833 basic_istream<char>&
2834 getline(basic_istream<char>& __in, basic_string<char>& __str,
2837 #ifdef _GLIBCXX_USE_WCHAR_T
2839 basic_istream<wchar_t>&
2840 getline(basic_istream<wchar_t>& __in, basic_string<wchar_t>& __str,
2844 _GLIBCXX_END_NAMESPACE_VERSION
2847 #if ((__cplusplus >= 201103L) && defined(_GLIBCXX_USE_C99) \
2848 && !defined(_GLIBCXX_HAVE_BROKEN_VSWPRINTF))
2852 namespace std _GLIBCXX_VISIBILITY(default)
2854 _GLIBCXX_BEGIN_NAMESPACE_VERSION
2858 stoi(
const string& __str,
size_t* __idx = 0,
int __base = 10)
2859 {
return __gnu_cxx::__stoa<long, int>(&std::strtol,
"stoi", __str.c_str(),
2863 stol(
const string& __str,
size_t* __idx = 0,
int __base = 10)
2864 {
return __gnu_cxx::__stoa(&std::strtol,
"stol", __str.c_str(),
2867 inline unsigned long
2868 stoul(
const string& __str,
size_t* __idx = 0,
int __base = 10)
2869 {
return __gnu_cxx::__stoa(&std::strtoul,
"stoul", __str.c_str(),
2873 stoll(
const string& __str,
size_t* __idx = 0,
int __base = 10)
2874 {
return __gnu_cxx::__stoa(&std::strtoll,
"stoll", __str.c_str(),
2877 inline unsigned long long
2878 stoull(
const string& __str,
size_t* __idx = 0,
int __base = 10)
2879 {
return __gnu_cxx::__stoa(&std::strtoull,
"stoull", __str.c_str(),
2884 stof(
const string& __str,
size_t* __idx = 0)
2885 {
return __gnu_cxx::__stoa(&std::strtof,
"stof", __str.c_str(), __idx); }
2888 stod(
const string& __str,
size_t* __idx = 0)
2889 {
return __gnu_cxx::__stoa(&std::strtod,
"stod", __str.c_str(), __idx); }
2892 stold(
const string& __str,
size_t* __idx = 0)
2893 {
return __gnu_cxx::__stoa(&std::strtold,
"stold", __str.c_str(), __idx); }
2899 to_string(
int __val)
2900 {
return __gnu_cxx::__to_xstring<string>(&std::vsnprintf, 4 *
sizeof(int),
2904 to_string(
unsigned __val)
2905 {
return __gnu_cxx::__to_xstring<string>(&std::vsnprintf,
2906 4 *
sizeof(unsigned),
2910 to_string(
long __val)
2911 {
return __gnu_cxx::__to_xstring<string>(&std::vsnprintf, 4 *
sizeof(long),
2915 to_string(
unsigned long __val)
2916 {
return __gnu_cxx::__to_xstring<string>(&std::vsnprintf,
2917 4 *
sizeof(
unsigned long),
2921 to_string(
long long __val)
2922 {
return __gnu_cxx::__to_xstring<string>(&std::vsnprintf,
2923 4 *
sizeof(
long long),
2927 to_string(
unsigned long long __val)
2928 {
return __gnu_cxx::__to_xstring<string>(&std::vsnprintf,
2929 4 *
sizeof(
unsigned long long),
2933 to_string(
float __val)
2936 __gnu_cxx::__numeric_traits<float>::__max_exponent10 + 20;
2937 return __gnu_cxx::__to_xstring<string>(&std::vsnprintf, __n,
2942 to_string(
double __val)
2945 __gnu_cxx::__numeric_traits<double>::__max_exponent10 + 20;
2946 return __gnu_cxx::__to_xstring<string>(&std::vsnprintf, __n,
2951 to_string(
long double __val)
2954 __gnu_cxx::__numeric_traits<long double>::__max_exponent10 + 20;
2955 return __gnu_cxx::__to_xstring<string>(&std::vsnprintf, __n,
2959 #ifdef _GLIBCXX_USE_WCHAR_T
2961 stoi(
const wstring& __str,
size_t* __idx = 0,
int __base = 10)
2962 {
return __gnu_cxx::__stoa<long, int>(&std::wcstol,
"stoi", __str.c_str(),
2966 stol(
const wstring& __str,
size_t* __idx = 0,
int __base = 10)
2967 {
return __gnu_cxx::__stoa(&std::wcstol,
"stol", __str.c_str(),
2970 inline unsigned long
2971 stoul(
const wstring& __str,
size_t* __idx = 0,
int __base = 10)
2972 {
return __gnu_cxx::__stoa(&std::wcstoul,
"stoul", __str.c_str(),
2976 stoll(
const wstring& __str,
size_t* __idx = 0,
int __base = 10)
2977 {
return __gnu_cxx::__stoa(&std::wcstoll,
"stoll", __str.c_str(),
2980 inline unsigned long long
2981 stoull(
const wstring& __str,
size_t* __idx = 0,
int __base = 10)
2982 {
return __gnu_cxx::__stoa(&std::wcstoull,
"stoull", __str.c_str(),
2987 stof(
const wstring& __str,
size_t* __idx = 0)
2988 {
return __gnu_cxx::__stoa(&std::wcstof,
"stof", __str.c_str(), __idx); }
2991 stod(
const wstring& __str,
size_t* __idx = 0)
2992 {
return __gnu_cxx::__stoa(&std::wcstod,
"stod", __str.c_str(), __idx); }
2995 stold(
const wstring& __str,
size_t* __idx = 0)
2996 {
return __gnu_cxx::__stoa(&std::wcstold,
"stold", __str.c_str(), __idx); }
3000 to_wstring(
int __val)
3001 {
return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf, 4 *
sizeof(int),
3005 to_wstring(
unsigned __val)
3006 {
return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf,
3007 4 *
sizeof(unsigned),
3011 to_wstring(
long __val)
3012 {
return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf, 4 *
sizeof(long),
3016 to_wstring(
unsigned long __val)
3017 {
return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf,
3018 4 *
sizeof(
unsigned long),
3022 to_wstring(
long long __val)
3023 {
return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf,
3024 4 *
sizeof(
long long),
3028 to_wstring(
unsigned long long __val)
3029 {
return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf,
3030 4 *
sizeof(
unsigned long long),
3034 to_wstring(
float __val)
3037 __gnu_cxx::__numeric_traits<float>::__max_exponent10 + 20;
3038 return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf, __n,
3043 to_wstring(
double __val)
3046 __gnu_cxx::__numeric_traits<double>::__max_exponent10 + 20;
3047 return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf, __n,
3052 to_wstring(
long double __val)
3055 __gnu_cxx::__numeric_traits<long double>::__max_exponent10 + 20;
3056 return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf, __n,
3061 _GLIBCXX_END_NAMESPACE_VERSION
3066 #if __cplusplus >= 201103L
3070 namespace std _GLIBCXX_VISIBILITY(default)
3072 _GLIBCXX_BEGIN_NAMESPACE_VERSION
3076 #ifndef _GLIBCXX_COMPATIBILITY_CXX0X
3080 :
public __hash_base<size_t, string>
3083 operator()(
const string& __s)
const noexcept
3084 {
return std::_Hash_impl::hash(__s.
data(), __s.
length()); }
3088 struct __is_fast_hash<
hash<
string>> : std::false_type
3091 #ifdef _GLIBCXX_USE_WCHAR_T
3095 :
public __hash_base<size_t, wstring>
3098 operator()(
const wstring& __s)
const noexcept
3099 {
return std::_Hash_impl::hash(__s.
data(),
3100 __s.
length() *
sizeof(wchar_t)); }
3104 struct __is_fast_hash<
hash<
wstring>> : std::false_type
3109 #ifdef _GLIBCXX_USE_C99_STDINT_TR1
3113 :
public __hash_base<size_t, u16string>
3116 operator()(
const u16string& __s)
const noexcept
3117 {
return std::_Hash_impl::hash(__s.
data(),
3118 __s.
length() *
sizeof(char16_t)); }
3128 :
public __hash_base<size_t, u32string>
3131 operator()(
const u32string& __s)
const noexcept
3132 {
return std::_Hash_impl::hash(__s.
data(),
3133 __s.
length() *
sizeof(char32_t)); }
3141 #if __cplusplus > 201103L
3143 #define __cpp_lib_string_udls 201304
3145 inline namespace literals
3147 inline namespace string_literals
3150 inline basic_string<char>
3151 operator""s(
const char* __str,
size_t __len)
3152 {
return basic_string<char>{__str, __len}; }
3154 #ifdef _GLIBCXX_USE_WCHAR_T
3155 inline basic_string<wchar_t>
3156 operator""s(
const wchar_t* __str,
size_t __len)
3157 {
return basic_string<wchar_t>{__str, __len}; }
3160 #ifdef _GLIBCXX_USE_C99_STDINT_TR1
3161 inline basic_string<char16_t>
3162 operator""s(
const char16_t* __str,
size_t __len)
3163 {
return basic_string<char16_t>{__str, __len}; }
3165 inline basic_string<char32_t>
3166 operator""s(
const char32_t* __str,
size_t __len)
3167 {
return basic_string<char32_t>{__str, __len}; }
3173 #endif // __cplusplus > 201103L
3175 _GLIBCXX_END_NAMESPACE_VERSION
basic_string & append(const _CharT *__s)
Append a C string.
basic_string & assign(const basic_string &__str, size_type __pos, size_type __n)
Set value to a substring of a string.
size_type find(const _CharT *__s, size_type __pos, size_type __n) const
Find position of a C substring.
void resize(size_type __n, _CharT __c)
Resizes the string to the specified number of characters.
void push_back(_CharT __c)
Append a single character.
basic_string & assign(const basic_string &__str)
Set value to contents of another string.
const _CharT * data() const noexcept
Return const pointer to contents.
size_type find_last_not_of(const basic_string &__str, size_type __pos=npos) const noexcept
Find last position of a character not in string.
constexpr std::remove_reference< _Tp >::type && move(_Tp &&__t) noexcept
Convert a value to an rvalue.
basic_string & insert(size_type __pos, const _CharT *__s)
Insert a C string.
basic_string & assign(const _CharT *__s)
Set value to contents of a C string.
void swap(basic_string &__s)
Swap contents with another string.
size_type find_last_of(const basic_string &__str, size_type __pos=npos) const noexcept
Find last position of a character of string.
basic_string & operator+=(initializer_list< _CharT > __l)
Append an initializer_list of characters.
basic_string substr(size_type __pos=0, size_type __n=npos) const
Get a substring.
basic_string & operator=(basic_string &&__str)
Move assign the value of str to this string.
void pop_back()
Remove the last character.
size_type max_size() const noexcept
Returns the size() of the largest possible string.
const_iterator begin() const noexcept
basic_string & operator=(initializer_list< _CharT > __l)
Set value to string constructed from initializer list.
static const size_type npos
Value returned by various member functions when they fail.
reference at(size_type __n)
Provides access to the data contained in the string.
basic_string & assign(initializer_list< _CharT > __l)
Set value to an initializer_list of characters.
size_type copy(_CharT *__s, size_type __n, size_type __pos=0) const
Copy substring into C string.
reference operator[](size_type __pos)
Subscript access to the data contained in the string.
iterator erase(iterator __position)
Remove one character.
basic_string & erase(size_type __pos=0, size_type __n=npos)
Remove characters.
basic_string & replace(size_type __pos, size_type __n, const basic_string &__str)
Replace characters with value from another string.
size_type find(const _CharT *__s, size_type __pos=0) const
Find position of a C string.
size_type find_first_of(_CharT __c, size_type __pos=0) const noexcept
Find position of a character.
const_reference at(size_type __n) const
Provides access to the data contained in the string.
basic_string & replace(size_type __pos1, size_type __n1, const basic_string &__str, size_type __pos2, size_type __n2)
Replace characters with value from another string.
basic_string & replace(iterator __i1, iterator __i2, initializer_list< _CharT > __l)
Replace range of characters with initializer_list.
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.
basic_string & operator=(const _CharT *__s)
Copy contents of s into this string.
basic_string & replace(size_type __pos, size_type __n1, size_type __n2, _CharT __c)
Replace characters with multiple characters.
size_type length() const noexcept
Returns the number of characters in the string, not including any null-termination.
basic_string & replace(iterator __i1, iterator __i2, const _CharT *__s)
Replace range of characters with C string.
const_reverse_iterator rbegin() const noexcept
const_iterator cbegin() const noexcept
_Siter_base< _Iterator >::iterator_type __base(_Iterator __it)
basic_string & replace(iterator __i1, iterator __i2, const basic_string &__str)
Replace range of characters with string.
basic_string & operator+=(const basic_string &__str)
Append a string to this string.
basic_string & replace(iterator __i1, iterator __i2, _InputIterator __k1, _InputIterator __k2)
Replace range of characters with range.
int compare(const basic_string &__str) const
Compare to a string.
basic_string & insert(size_type __pos, size_type __n, _CharT __c)
Insert multiple characters.
basic_string()
Default constructor creates an empty string.
basic_string & append(initializer_list< _CharT > __l)
Append an initializer_list of characters.
basic_string & append(const basic_string &__str)
Append a string to this string.
basic_string(basic_string &&__str) noexcept
Move construct string.
ISO C++ entities toplevel namespace is std.
basic_string & replace(iterator __i1, iterator __i2, size_type __n, _CharT __c)
Replace range of characters with multiple characters.
const_reference front() const noexcept
void insert(iterator __p, initializer_list< _CharT > __l)
Insert an initializer_list of characters.
size_type rfind(const basic_string &__str, size_type __pos=npos) const noexcept
Find last position of a string.
const _Tp & min(const _Tp &, const _Tp &)
This does what you think it does.
basic_string & operator+=(const _CharT *__s)
Append a C string.
allocator_type get_allocator() const noexcept
Return copy of allocator used to construct this string.
size_type rfind(const _CharT *__s, size_type __pos=npos) const
Find last position of a C string.
size_type find_first_not_of(const basic_string &__str, size_type __pos=0) const noexcept
Find position of a character not in string.
Basis for explicit traits specializations.
size_type find(const basic_string &__str, size_type __pos=0) const noexcept
Find position of a string.
const_iterator end() const noexcept
const_reference back() const noexcept
~basic_string() noexcept
Destroy the string instance.
const_iterator cend() const noexcept
size_type find_first_of(const basic_string &__str, size_type __pos=0) const noexcept
Find position of a character of string.
basic_string & append(_InputIterator __first, _InputIterator __last)
Append a range of characters.
basic_string & insert(size_type __pos1, const basic_string &__str, size_type __pos2, size_type __n)
Insert a substring.
size_type find_first_of(const _CharT *__s, size_type __pos=0) const
Find position of a character of C string.
basic_string & assign(size_type __n, _CharT __c)
Set value to multiple characters.
size_type find_last_of(_CharT __c, size_type __pos=npos) const noexcept
Find last position of a character.
const_reverse_iterator rend() const noexcept
void insert(iterator __p, size_type __n, _CharT __c)
Insert multiple characters.
bool operator>=(const basic_string< _CharT, _Traits, _Alloc > &__lhs, const basic_string< _CharT, _Traits, _Alloc > &__rhs)
Test if string doesn't precede string.
bool operator<(const basic_string< _CharT, _Traits, _Alloc > &__lhs, const basic_string< _CharT, _Traits, _Alloc > &__rhs)
Test if string precedes string.
void shrink_to_fit() noexcept
A non-binding request to reduce capacity() to size().
basic_string & assign(basic_string &&__str)
Set value to contents of 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.
reverse_iterator rbegin()
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.
basic_string & replace(size_type __pos, size_type __n1, const _CharT *__s)
Replace characters with value of a C string.
basic_string & replace(iterator __i1, iterator __i2, const _CharT *__s, size_type __n)
Replace range of characters with C substring.
basic_istream< _CharT, _Traits > & operator>>(basic_istream< _CharT, _Traits > &__is, basic_string< _CharT, _Traits, _Alloc > &__str)
Read stream into a string.
bool empty() const noexcept
const_reverse_iterator crend() const noexcept
basic_string & operator=(_CharT __c)
Set value to string of length 1.
bool operator<=(const basic_string< _CharT, _Traits, _Alloc > &__lhs, const basic_string< _CharT, _Traits, _Alloc > &__rhs)
Test if string doesn't follow string.
basic_string< _CharT, _Traits, _Alloc > operator+(const basic_string< _CharT, _Traits, _Alloc > &__lhs, const basic_string< _CharT, _Traits, _Alloc > &__rhs)
Concatenate two strings.
void reserve(size_type __res_arg=0)
Attempt to preallocate enough memory for specified number of characters.
const_reverse_iterator crbegin() const noexcept
basic_string & operator=(const basic_string &__str)
Assign the value of str to this string.
Primary class template hash.
bool operator>(const basic_string< _CharT, _Traits, _Alloc > &__lhs, const basic_string< _CharT, _Traits, _Alloc > &__rhs)
Test if string follows string.
void resize(size_type __n)
Resizes the string to the specified number of characters.
size_type find_last_of(const _CharT *__s, size_type __pos=npos) const
Find last position of a character of C string.
iterator insert(iterator __p, _CharT __c)
Insert one character.
size_type capacity() const noexcept
basic_string & insert(size_type __pos1, const basic_string &__str)
Insert value of a string.
basic_string< wchar_t > wstring
A string of wchar_t.
void swap(_Tp &, _Tp &) noexcept(__and_< is_nothrow_move_constructible< _Tp >, is_nothrow_move_assignable< _Tp >>::value)
Swaps two values.
const_reference operator[](size_type __pos) const noexcept
Subscript access to the data contained in the string.
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 insert(iterator __p, _InputIterator __beg, _InputIterator __end)
Insert a range of characters.
basic_string & operator+=(_CharT __c)
Append a character.
basic_string & assign(_InputIterator __first, _InputIterator __last)
Set value to a range of characters.
Managing sequences of characters and character-like objects.