34 #ifndef _BASIC_STRING_H 35 #define _BASIC_STRING_H 1 37 #pragma GCC system_header 42 #if __cplusplus >= 201103L 46 namespace std _GLIBCXX_VISIBILITY(default)
48 _GLIBCXX_BEGIN_NAMESPACE_VERSION
50 #if _GLIBCXX_USE_CXX11_ABI 51 _GLIBCXX_BEGIN_NAMESPACE_CXX11
70 template<
typename _CharT,
typename _Traits,
typename _Alloc>
74 rebind<_CharT>::other _Char_alloc_type;
79 typedef _Traits traits_type;
80 typedef typename _Traits::char_type value_type;
81 typedef _Char_alloc_type allocator_type;
82 typedef typename _Alloc_traits::size_type size_type;
83 typedef typename _Alloc_traits::difference_type difference_type;
84 typedef typename _Alloc_traits::reference reference;
85 typedef typename _Alloc_traits::const_reference const_reference;
86 typedef typename _Alloc_traits::pointer pointer;
87 typedef typename _Alloc_traits::const_pointer const_pointer;
88 typedef __gnu_cxx::__normal_iterator<pointer, basic_string> iterator;
89 typedef __gnu_cxx::__normal_iterator<const_pointer, basic_string>
95 static const size_type
npos =
static_cast<size_type
>(-1);
99 #if __cplusplus < 201103L 100 typedef iterator __const_iterator;
102 typedef const_iterator __const_iterator;
106 struct _Alloc_hider : allocator_type
108 _Alloc_hider(pointer __dat,
const _Alloc& __a = _Alloc())
109 : allocator_type(__a), _M_p(__dat) { }
114 _Alloc_hider _M_dataplus;
115 size_type _M_string_length;
117 enum { _S_local_capacity = 15 /
sizeof(_CharT) };
121 _CharT _M_local_buf[_S_local_capacity + 1];
122 size_type _M_allocated_capacity;
127 { _M_dataplus._M_p = __p; }
130 _M_length(size_type __length)
131 { _M_string_length = __length; }
135 {
return _M_dataplus._M_p; }
140 #if __cplusplus >= 201103L 143 return pointer(_M_local_buf);
148 _M_local_data()
const 150 #if __cplusplus >= 201103L 153 return const_pointer(_M_local_buf);
158 _M_capacity(size_type __capacity)
159 { _M_allocated_capacity = __capacity; }
162 _M_set_length(size_type __n)
165 traits_type::assign(_M_data()[__n], _CharT());
170 {
return _M_data() == _M_local_data(); }
174 _M_create(size_type&, size_type);
180 _M_destroy(_M_allocated_capacity);
184 _M_destroy(size_type __size)
throw()
185 { _Alloc_traits::deallocate(_M_get_allocator(), _M_data(), __size + 1); }
189 template<
typename _InIterator>
191 _M_construct_aux(_InIterator __beg, _InIterator __end,
194 typedef typename iterator_traits<_InIterator>::iterator_category _Tag;
195 _M_construct(__beg, __end, _Tag());
200 template<
typename _Integer>
202 _M_construct_aux(_Integer __beg, _Integer __end, std::__true_type)
203 { _M_construct_aux_2(static_cast<size_type>(__beg), __end); }
206 _M_construct_aux_2(size_type __req, _CharT __c)
207 { _M_construct(__req, __c); }
209 template<
typename _InIterator>
211 _M_construct(_InIterator __beg, _InIterator __end)
213 typedef typename std::__is_integer<_InIterator>::__type _Integral;
214 _M_construct_aux(__beg, __end, _Integral());
218 template<
typename _InIterator>
220 _M_construct(_InIterator __beg, _InIterator __end,
225 template<
typename _FwdIterator>
227 _M_construct(_FwdIterator __beg, _FwdIterator __end,
231 _M_construct(size_type __req, _CharT __c);
235 {
return _M_dataplus; }
237 const allocator_type&
238 _M_get_allocator()
const 239 {
return _M_dataplus; }
243 #ifdef _GLIBCXX_DISAMBIGUATE_REPLACE_INST 246 template<
typename _Tp,
bool _Requires =
247 !__are_same<_Tp, _CharT*>::__value
248 && !__are_same<_Tp, const _CharT*>::__value
249 && !__are_same<_Tp, iterator>::__value
250 && !__are_same<_Tp, const_iterator>::__value>
251 struct __enable_if_not_native_iterator
253 template<
typename _Tp>
254 struct __enable_if_not_native_iterator<_Tp, false> { };
258 _M_check(size_type __pos,
const char* __s)
const 260 if (__pos > this->
size())
261 __throw_out_of_range_fmt(__N(
"%s: __pos (which is %zu) > " 262 "this->size() (which is %zu)"),
263 __s, __pos, this->
size());
268 _M_check_length(size_type __n1, size_type __n2,
const char* __s)
const 271 __throw_length_error(__N(__s));
277 _M_limit(size_type __pos, size_type __off)
const _GLIBCXX_NOEXCEPT
279 const bool __testoff = __off < this->
size() - __pos;
280 return __testoff ? __off : this->
size() - __pos;
285 _M_disjunct(
const _CharT* __s)
const _GLIBCXX_NOEXCEPT
287 return (less<const _CharT*>()(__s, _M_data())
288 || less<const _CharT*>()(_M_data() + this->
size(), __s));
294 _S_copy(_CharT* __d,
const _CharT* __s, size_type __n)
297 traits_type::assign(*__d, *__s);
299 traits_type::copy(__d, __s, __n);
303 _S_move(_CharT* __d,
const _CharT* __s, size_type __n)
306 traits_type::assign(*__d, *__s);
308 traits_type::move(__d, __s, __n);
312 _S_assign(_CharT* __d, size_type __n, _CharT __c)
315 traits_type::assign(*__d, __c);
317 traits_type::assign(__d, __n, __c);
322 template<
class _Iterator>
324 _S_copy_chars(_CharT* __p, _Iterator __k1, _Iterator __k2)
326 for (; __k1 != __k2; ++__k1, ++__p)
327 traits_type::assign(*__p, *__k1);
331 _S_copy_chars(_CharT* __p, iterator __k1, iterator __k2) _GLIBCXX_NOEXCEPT
332 { _S_copy_chars(__p, __k1.base(), __k2.base()); }
335 _S_copy_chars(_CharT* __p, const_iterator __k1, const_iterator __k2)
337 { _S_copy_chars(__p, __k1.base(), __k2.base()); }
340 _S_copy_chars(_CharT* __p, _CharT* __k1, _CharT* __k2) _GLIBCXX_NOEXCEPT
341 { _S_copy(__p, __k1, __k2 - __k1); }
344 _S_copy_chars(_CharT* __p,
const _CharT* __k1,
const _CharT* __k2)
346 { _S_copy(__p, __k1, __k2 - __k1); }
349 _S_compare(size_type __n1, size_type __n2) _GLIBCXX_NOEXCEPT
351 const difference_type __d = difference_type(__n1 - __n2);
353 if (__d > __gnu_cxx::__numeric_traits<int>::__max)
354 return __gnu_cxx::__numeric_traits<int>::__max;
355 else if (__d < __gnu_cxx::__numeric_traits<int>::__min)
356 return __gnu_cxx::__numeric_traits<int>::__min;
365 _M_mutate(size_type __pos, size_type __len1,
const _CharT* __s,
369 _M_erase(size_type __pos, size_type __n);
380 #if __cplusplus >= 201103L 381 noexcept(is_nothrow_default_constructible<_Alloc>::value)
383 : _M_dataplus(_M_local_data())
384 { _M_set_length(0); }
391 : _M_dataplus(_M_local_data(), __a)
392 { _M_set_length(0); }
399 : _M_dataplus(_M_local_data(), __str._M_get_allocator())
400 { _M_construct(__str._M_data(), __str._M_data() + __str.length()); }
411 size_type __n = npos)
412 : _M_dataplus(_M_local_data())
414 const _CharT* __start = __str._M_data()
415 + __str._M_check(__pos,
"basic_string::basic_string");
416 _M_construct(__start, __start + __str._M_limit(__pos, __n));
426 basic_string(
const basic_string& __str, size_type __pos,
427 size_type __n,
const _Alloc& __a)
428 : _M_dataplus(_M_local_data(), __a)
430 const _CharT* __start
431 = __str._M_data() + __str._M_check(__pos,
"string::string");
432 _M_construct(__start, __start + __str._M_limit(__pos, __n));
445 const _Alloc& __a = _Alloc())
446 : _M_dataplus(_M_local_data(), __a)
447 { _M_construct(__s, __s + __n); }
454 basic_string(
const _CharT* __s,
const _Alloc& __a = _Alloc())
455 : _M_dataplus(_M_local_data(), __a)
456 { _M_construct(__s, __s ? __s + traits_type::length(__s) : __s+npos); }
464 basic_string(size_type __n, _CharT __c,
const _Alloc& __a = _Alloc())
465 : _M_dataplus(_M_local_data(), __a)
466 { _M_construct(__n, __c); }
468 #if __cplusplus >= 201103L 477 : _M_dataplus(_M_local_data(),
std::move(__str._M_get_allocator()))
479 if (__str._M_is_local())
481 traits_type::copy(_M_local_buf, __str._M_local_buf,
482 _S_local_capacity + 1);
486 _M_data(__str._M_data());
487 _M_capacity(__str._M_allocated_capacity);
493 _M_length(__str.length());
494 __str._M_data(__str._M_local_data());
495 __str._M_set_length(0);
503 basic_string(initializer_list<_CharT> __l,
const _Alloc& __a = _Alloc())
504 : _M_dataplus(_M_local_data(), __a)
505 { _M_construct(__l.begin(), __l.end()); }
507 basic_string(
const basic_string& __str,
const _Alloc& __a)
508 : _M_dataplus(_M_local_data(), __a)
509 { _M_construct(__str.begin(), __str.end()); }
512 : _M_dataplus(_M_local_data(), __a)
514 if (__str.get_allocator() == __a)
515 *
this = std::move(__str);
517 _M_construct(__str.begin(), __str.end());
528 #if __cplusplus >= 201103L 529 template<
typename _InputIterator,
530 typename = std::_RequireInputIter<_InputIterator>>
532 template<
typename _InputIterator>
534 basic_string(_InputIterator __beg, _InputIterator __end,
535 const _Alloc& __a = _Alloc())
536 : _M_dataplus(_M_local_data(), __a)
537 { _M_construct(__beg, __end); }
551 {
return this->
assign(__str); }
559 {
return this->
assign(__s); }
575 #if __cplusplus >= 201103L 600 this->
assign(__l.begin(), __l.size());
611 begin() _GLIBCXX_NOEXCEPT
612 {
return iterator(_M_data()); }
619 begin() const _GLIBCXX_NOEXCEPT
620 {
return const_iterator(_M_data()); }
627 end() _GLIBCXX_NOEXCEPT
628 {
return iterator(_M_data() + this->
size()); }
635 end() const _GLIBCXX_NOEXCEPT
636 {
return const_iterator(_M_data() + this->
size()); }
644 rbegin() _GLIBCXX_NOEXCEPT
645 {
return reverse_iterator(this->
end()); }
652 const_reverse_iterator
653 rbegin() const _GLIBCXX_NOEXCEPT
654 {
return const_reverse_iterator(this->
end()); }
662 rend() _GLIBCXX_NOEXCEPT
663 {
return reverse_iterator(this->
begin()); }
670 const_reverse_iterator
671 rend() const _GLIBCXX_NOEXCEPT
672 {
return const_reverse_iterator(this->
begin()); }
674 #if __cplusplus >= 201103L 681 {
return const_iterator(this->_M_data()); }
688 cend() const noexcept
689 {
return const_iterator(this->_M_data() + this->
size()); }
696 const_reverse_iterator
698 {
return const_reverse_iterator(this->
end()); }
705 const_reverse_iterator
706 crend() const noexcept
707 {
return const_reverse_iterator(this->
begin()); }
715 size() const _GLIBCXX_NOEXCEPT
716 {
return _M_string_length; }
721 length() const _GLIBCXX_NOEXCEPT
722 {
return _M_string_length; }
727 {
return (_Alloc_traits::max_size(_M_get_allocator()) - 1) / 2; }
740 resize(size_type __n, _CharT __c);
754 { this->
resize(__n, _CharT()); }
756 #if __cplusplus >= 201103L 780 return _M_is_local() ? size_type(_S_local_capacity)
781 : _M_allocated_capacity;
802 reserve(size_type __res_arg = 0);
808 clear() _GLIBCXX_NOEXCEPT
809 { _M_set_length(0); }
816 empty() const _GLIBCXX_NOEXCEPT
817 {
return this->
size() == 0; }
831 operator[] (size_type __pos)
const _GLIBCXX_NOEXCEPT
833 _GLIBCXX_DEBUG_ASSERT(__pos <=
size());
834 return _M_data()[__pos];
852 _GLIBCXX_DEBUG_ASSERT(__pos <=
size());
854 _GLIBCXX_DEBUG_PEDASSERT(__cplusplus >= 201103L || __pos <
size());
855 return _M_data()[__pos];
869 at(size_type __n)
const 871 if (__n >= this->
size())
872 __throw_out_of_range_fmt(__N(
"basic_string::at: __n " 873 "(which is %zu) >= this->size() " 876 return _M_data()[__n];
893 __throw_out_of_range_fmt(__N(
"basic_string::at: __n " 894 "(which is %zu) >= this->size() " 897 return _M_data()[__n];
900 #if __cplusplus >= 201103L 914 front() const noexcept
930 back() const noexcept
942 {
return this->
append(__str); }
951 {
return this->
append(__s); }
965 #if __cplusplus >= 201103L 973 {
return this->
append(__l.begin(), __l.size()); }
982 append(
const basic_string& __str)
983 {
return _M_append(__str._M_data(), __str.size()); }
999 append(
const basic_string& __str, size_type __pos, size_type __n)
1000 {
return _M_append(__str._M_data()
1001 + __str._M_check(__pos,
"basic_string::append"),
1002 __str._M_limit(__pos, __n)); }
1011 append(
const _CharT* __s, size_type __n)
1013 __glibcxx_requires_string_len(__s, __n);
1014 _M_check_length(size_type(0), __n,
"basic_string::append");
1015 return _M_append(__s, __n);
1024 append(
const _CharT* __s)
1026 __glibcxx_requires_string(__s);
1027 const size_type __n = traits_type::length(__s);
1028 _M_check_length(size_type(0), __n,
"basic_string::append");
1029 return _M_append(__s, __n);
1041 append(size_type __n, _CharT __c)
1042 {
return _M_replace_aux(this->
size(), size_type(0), __n, __c); }
1044 #if __cplusplus >= 201103L 1051 append(initializer_list<_CharT> __l)
1052 {
return this->
append(__l.begin(), __l.size()); }
1063 #if __cplusplus >= 201103L 1064 template<
class _InputIterator,
1065 typename = std::_RequireInputIter<_InputIterator>>
1067 template<
class _InputIterator>
1070 append(_InputIterator __first, _InputIterator __last)
1080 const size_type __size = this->
size();
1082 this->_M_mutate(__size, size_type(0), 0, size_type(1));
1083 traits_type::assign(this->_M_data()[__size], __c);
1084 this->_M_set_length(__size + 1);
1093 assign(
const basic_string& __str)
1095 this->_M_assign(__str);
1099 #if __cplusplus >= 201103L 1109 assign(basic_string&& __str)
1113 return *
this = std::move(__str);
1131 assign(
const basic_string& __str, size_type __pos, size_type __n)
1132 {
return _M_replace(size_type(0), this->
size(), __str._M_data()
1133 + __str._M_check(__pos,
"basic_string::assign"),
1134 __str._M_limit(__pos, __n)); }
1147 assign(
const _CharT* __s, size_type __n)
1149 __glibcxx_requires_string_len(__s, __n);
1150 return _M_replace(size_type(0), this->
size(), __s, __n);
1163 assign(
const _CharT* __s)
1165 __glibcxx_requires_string(__s);
1166 return _M_replace(size_type(0), this->
size(), __s,
1167 traits_type::length(__s));
1180 assign(size_type __n, _CharT __c)
1181 {
return _M_replace_aux(size_type(0), this->
size(), __n, __c); }
1191 #if __cplusplus >= 201103L 1192 template<
class _InputIterator,
1193 typename = std::_RequireInputIter<_InputIterator>>
1195 template<
class _InputIterator>
1198 assign(_InputIterator __first, _InputIterator __last)
1201 #if __cplusplus >= 201103L 1208 assign(initializer_list<_CharT> __l)
1209 {
return this->
assign(__l.begin(), __l.size()); }
1212 #if __cplusplus >= 201103L 1229 insert(const_iterator __p, size_type __n, _CharT __c)
1231 _GLIBCXX_DEBUG_PEDASSERT(__p >=
begin() && __p <=
end());
1232 const size_type __pos = __p -
begin();
1233 this->
replace(__p, __p, __n, __c);
1234 return iterator(this->_M_data() + __pos);
1251 insert(iterator __p, size_type __n, _CharT __c)
1252 { this->
replace(__p, __p, __n, __c); }
1255 #if __cplusplus >= 201103L 1270 template<
class _InputIterator,
1271 typename = std::_RequireInputIter<_InputIterator>>
1273 insert(const_iterator __p, _InputIterator __beg, _InputIterator __end)
1275 _GLIBCXX_DEBUG_PEDASSERT(__p >=
begin() && __p <=
end());
1276 const size_type __pos = __p -
begin();
1277 this->
replace(__p, __p, __beg, __end);
1278 return iterator(this->_M_data() + __pos);
1293 template<
class _InputIterator>
1295 insert(iterator __p, _InputIterator __beg, _InputIterator __end)
1296 { this->
replace(__p, __p, __beg, __end); }
1299 #if __cplusplus >= 201103L 1307 insert(iterator __p, initializer_list<_CharT> __l)
1309 _GLIBCXX_DEBUG_PEDASSERT(__p >=
begin() && __p <=
end());
1310 this->
insert(__p -
begin(), __l.begin(), __l.size());
1327 insert(size_type __pos1,
const basic_string& __str)
1328 {
return this->
replace(__pos1, size_type(0),
1329 __str._M_data(), __str.size()); }
1350 insert(size_type __pos1,
const basic_string& __str,
1351 size_type __pos2, size_type __n)
1352 {
return this->
replace(__pos1, size_type(0), __str._M_data()
1353 + __str._M_check(__pos2,
"basic_string::insert"),
1354 __str._M_limit(__pos2, __n)); }
1373 insert(size_type __pos,
const _CharT* __s, size_type __n)
1374 {
return this->
replace(__pos, size_type(0), __s, __n); }
1392 insert(size_type __pos,
const _CharT* __s)
1394 __glibcxx_requires_string(__s);
1395 return this->
replace(__pos, size_type(0), __s,
1396 traits_type::length(__s));
1416 insert(size_type __pos, size_type __n, _CharT __c)
1417 {
return _M_replace_aux(_M_check(__pos,
"basic_string::insert"),
1418 size_type(0), __n, __c); }
1434 insert(__const_iterator __p, _CharT __c)
1436 _GLIBCXX_DEBUG_PEDASSERT(__p >=
begin() && __p <=
end());
1437 const size_type __pos = __p -
begin();
1438 _M_replace_aux(__pos, size_type(0), size_type(1), __c);
1439 return iterator(_M_data() + __pos);
1458 erase(size_type __pos = 0, size_type __n = npos)
1460 this->_M_erase(_M_check(__pos,
"basic_string::erase"),
1461 _M_limit(__pos, __n));
1474 erase(__const_iterator __position)
1476 _GLIBCXX_DEBUG_PEDASSERT(__position >=
begin()
1477 && __position <
end());
1478 const size_type __pos = __position -
begin();
1479 this->_M_erase(__pos, size_type(1));
1480 return iterator(_M_data() + __pos);
1493 erase(__const_iterator __first, __const_iterator __last)
1495 _GLIBCXX_DEBUG_PEDASSERT(__first >=
begin() && __first <= __last
1496 && __last <=
end());
1497 const size_type __pos = __first -
begin();
1498 this->_M_erase(__pos, __last - __first);
1499 return iterator(this->_M_data() + __pos);
1502 #if __cplusplus >= 201103L 1510 { _M_erase(
size()-1, 1); }
1531 replace(size_type __pos, size_type __n,
const basic_string& __str)
1532 {
return this->
replace(__pos, __n, __str._M_data(), __str.size()); }
1553 replace(size_type __pos1, size_type __n1,
const basic_string& __str,
1554 size_type __pos2, size_type __n2)
1555 {
return this->
replace(__pos1, __n1, __str._M_data()
1556 + __str._M_check(__pos2,
"basic_string::replace"),
1557 __str._M_limit(__pos2, __n2)); }
1578 replace(size_type __pos, size_type __n1,
const _CharT* __s,
1581 __glibcxx_requires_string_len(__s, __n2);
1582 return _M_replace(_M_check(__pos,
"basic_string::replace"),
1583 _M_limit(__pos, __n1), __s, __n2);
1603 replace(size_type __pos, size_type __n1,
const _CharT* __s)
1605 __glibcxx_requires_string(__s);
1606 return this->
replace(__pos, __n1, __s, traits_type::length(__s));
1627 replace(size_type __pos, size_type __n1, size_type __n2, _CharT __c)
1628 {
return _M_replace_aux(_M_check(__pos,
"basic_string::replace"),
1629 _M_limit(__pos, __n1), __n2, __c); }
1645 replace(__const_iterator __i1, __const_iterator __i2,
1646 const basic_string& __str)
1647 {
return this->
replace(__i1, __i2, __str._M_data(), __str.size()); }
1665 replace(__const_iterator __i1, __const_iterator __i2,
1666 const _CharT* __s, size_type __n)
1668 _GLIBCXX_DEBUG_PEDASSERT(
begin() <= __i1 && __i1 <= __i2
1670 return this->
replace(__i1 -
begin(), __i2 - __i1, __s, __n);
1687 replace(__const_iterator __i1, __const_iterator __i2,
const _CharT* __s)
1689 __glibcxx_requires_string(__s);
1690 return this->
replace(__i1, __i2, __s, traits_type::length(__s));
1708 replace(__const_iterator __i1, __const_iterator __i2, size_type __n,
1711 _GLIBCXX_DEBUG_PEDASSERT(
begin() <= __i1 && __i1 <= __i2
1713 return _M_replace_aux(__i1 -
begin(), __i2 - __i1, __n, __c);
1731 #if __cplusplus >= 201103L 1732 template<
class _InputIterator,
1733 typename = std::_RequireInputIter<_InputIterator>>
1735 replace(const_iterator __i1, const_iterator __i2,
1736 _InputIterator __k1, _InputIterator __k2)
1738 _GLIBCXX_DEBUG_PEDASSERT(
begin() <= __i1 && __i1 <= __i2
1740 __glibcxx_requires_valid_range(__k1, __k2);
1741 return this->_M_replace_dispatch(__i1, __i2, __k1, __k2,
1742 std::__false_type());
1745 template<
class _InputIterator>
1746 #ifdef _GLIBCXX_DISAMBIGUATE_REPLACE_INST 1747 typename __enable_if_not_native_iterator<_InputIterator>::__type
1751 replace(iterator __i1, iterator __i2,
1752 _InputIterator __k1, _InputIterator __k2)
1754 _GLIBCXX_DEBUG_PEDASSERT(
begin() <= __i1 && __i1 <= __i2
1756 __glibcxx_requires_valid_range(__k1, __k2);
1757 typedef typename std::__is_integer<_InputIterator>::__type _Integral;
1758 return _M_replace_dispatch(__i1, __i2, __k1, __k2, _Integral());
1765 replace(__const_iterator __i1, __const_iterator __i2,
1766 _CharT* __k1, _CharT* __k2)
1768 _GLIBCXX_DEBUG_PEDASSERT(
begin() <= __i1 && __i1 <= __i2
1770 __glibcxx_requires_valid_range(__k1, __k2);
1776 replace(__const_iterator __i1, __const_iterator __i2,
1777 const _CharT* __k1,
const _CharT* __k2)
1779 _GLIBCXX_DEBUG_PEDASSERT(
begin() <= __i1 && __i1 <= __i2
1781 __glibcxx_requires_valid_range(__k1, __k2);
1787 replace(__const_iterator __i1, __const_iterator __i2,
1788 iterator __k1, iterator __k2)
1790 _GLIBCXX_DEBUG_PEDASSERT(
begin() <= __i1 && __i1 <= __i2
1792 __glibcxx_requires_valid_range(__k1, __k2);
1794 __k1.base(), __k2 - __k1);
1798 replace(__const_iterator __i1, __const_iterator __i2,
1799 const_iterator __k1, const_iterator __k2)
1801 _GLIBCXX_DEBUG_PEDASSERT(
begin() <= __i1 && __i1 <= __i2
1803 __glibcxx_requires_valid_range(__k1, __k2);
1805 __k1.base(), __k2 - __k1);
1808 #if __cplusplus >= 201103L 1823 basic_string&
replace(const_iterator __i1, const_iterator __i2,
1824 initializer_list<_CharT> __l)
1825 {
return this->
replace(__i1, __i2, __l.begin(), __l.end()); }
1829 template<
class _Integer>
1831 _M_replace_dispatch(const_iterator __i1, const_iterator __i2,
1832 _Integer __n, _Integer __val, __true_type)
1833 {
return _M_replace_aux(__i1 -
begin(), __i2 - __i1, __n, __val); }
1835 template<
class _InputIterator>
1837 _M_replace_dispatch(const_iterator __i1, const_iterator __i2,
1838 _InputIterator __k1, _InputIterator __k2,
1842 _M_replace_aux(size_type __pos1, size_type __n1, size_type __n2,
1846 _M_replace(size_type __pos, size_type __len1,
const _CharT* __s,
1847 const size_type __len2);
1850 _M_append(
const _CharT* __s, size_type __n);
1867 copy(_CharT* __s, size_type __n, size_type __pos = 0)
const;
1877 swap(basic_string& __s) _GLIBCXX_NOEXCEPT;
1887 c_str() const _GLIBCXX_NOEXCEPT
1888 {
return _M_data(); }
1897 data() const _GLIBCXX_NOEXCEPT
1898 {
return _M_data(); }
1905 {
return _M_get_allocator(); }
1920 find(
const _CharT* __s, size_type __pos, size_type __n)
const;
1933 find(
const basic_string& __str, size_type __pos = 0) const
1935 {
return this->
find(__str.data(), __pos, __str.size()); }
1948 find(
const _CharT* __s, size_type __pos = 0)
const 1950 __glibcxx_requires_string(__s);
1951 return this->
find(__s, __pos, traits_type::length(__s));
1965 find(_CharT __c, size_type __pos = 0) const _GLIBCXX_NOEXCEPT;
1978 rfind(const basic_string& __str, size_type __pos = npos) const
1980 {
return this->
rfind(__str.data(), __pos, __str.size()); }
1995 rfind(
const _CharT* __s, size_type __pos, size_type __n)
const;
2008 rfind(
const _CharT* __s, size_type __pos = npos)
const 2010 __glibcxx_requires_string(__s);
2011 return this->
rfind(__s, __pos, traits_type::length(__s));
2025 rfind(_CharT __c, size_type __pos = npos) const _GLIBCXX_NOEXCEPT;
2039 find_first_of(const basic_string& __str, size_type __pos = 0) const
2041 {
return this->
find_first_of(__str.data(), __pos, __str.size()); }
2056 find_first_of(
const _CharT* __s, size_type __pos, size_type __n)
const;
2071 __glibcxx_requires_string(__s);
2072 return this->
find_first_of(__s, __pos, traits_type::length(__s));
2088 find_first_of(_CharT __c, size_type __pos = 0) const _GLIBCXX_NOEXCEPT
2089 {
return this->
find(__c, __pos); }
2103 find_last_of(
const basic_string& __str, size_type __pos = npos) const
2105 {
return this->
find_last_of(__str.data(), __pos, __str.size()); }
2120 find_last_of(
const _CharT* __s, size_type __pos, size_type __n)
const;
2133 find_last_of(
const _CharT* __s, size_type __pos = npos)
const 2135 __glibcxx_requires_string(__s);
2136 return this->
find_last_of(__s, __pos, traits_type::length(__s));
2152 find_last_of(_CharT __c, size_type __pos = npos) const _GLIBCXX_NOEXCEPT
2153 {
return this->
rfind(__c, __pos); }
2184 size_type __n)
const;
2199 __glibcxx_requires_string(__s);
2247 size_type __n)
const;
2262 __glibcxx_requires_string(__s);
2293 substr(size_type __pos = 0, size_type __n = npos)
const 2295 _M_check(__pos,
"basic_string::substr"), __n); }
2312 compare(
const basic_string& __str)
const 2314 const size_type __size = this->
size();
2315 const size_type __osize = __str.size();
2316 const size_type __len =
std::min(__size, __osize);
2318 int __r = traits_type::compare(_M_data(), __str.data(), __len);
2320 __r = _S_compare(__size, __osize);
2344 compare(size_type __pos, size_type __n,
const basic_string& __str)
const;
2370 compare(size_type __pos1, size_type __n1,
const basic_string& __str,
2371 size_type __pos2, size_type __n2)
const;
2388 compare(
const _CharT* __s)
const;
2412 compare(size_type __pos, size_type __n1,
const _CharT* __s)
const;
2439 compare(size_type __pos, size_type __n1,
const _CharT* __s,
2440 size_type __n2)
const;
2442 _GLIBCXX_END_NAMESPACE_CXX11
2443 #else // !_GLIBCXX_USE_CXX11_ABI 2508 template<
typename _CharT,
typename _Traits,
typename _Alloc>
2511 typedef typename _Alloc::template rebind<_CharT>::other _CharT_alloc_type;
2515 typedef _Traits traits_type;
2516 typedef typename _Traits::char_type value_type;
2517 typedef _Alloc allocator_type;
2518 typedef typename _CharT_alloc_type::size_type size_type;
2519 typedef typename _CharT_alloc_type::difference_type difference_type;
2520 typedef typename _CharT_alloc_type::reference reference;
2521 typedef typename _CharT_alloc_type::const_reference const_reference;
2522 typedef typename _CharT_alloc_type::pointer pointer;
2523 typedef typename _CharT_alloc_type::const_pointer const_pointer;
2524 typedef __gnu_cxx::__normal_iterator<pointer, basic_string> iterator;
2525 typedef __gnu_cxx::__normal_iterator<const_pointer, basic_string>
2547 size_type _M_length;
2548 size_type _M_capacity;
2549 _Atomic_word _M_refcount;
2552 struct _Rep : _Rep_base
2555 typedef typename _Alloc::template rebind<char>::other _Raw_bytes_alloc;
2570 static const size_type _S_max_size;
2571 static const _CharT _S_terminal;
2575 static size_type _S_empty_rep_storage[];
2578 _S_empty_rep() _GLIBCXX_NOEXCEPT
2583 void* __p =
reinterpret_cast<void*
>(&_S_empty_rep_storage);
2584 return *
reinterpret_cast<_Rep*
>(__p);
2588 _M_is_leaked()
const _GLIBCXX_NOEXCEPT
2589 {
return this->_M_refcount < 0; }
2592 _M_is_shared()
const _GLIBCXX_NOEXCEPT
2593 {
return this->_M_refcount > 0; }
2596 _M_set_leaked() _GLIBCXX_NOEXCEPT
2597 { this->_M_refcount = -1; }
2600 _M_set_sharable() _GLIBCXX_NOEXCEPT
2601 { this->_M_refcount = 0; }
2604 _M_set_length_and_sharable(size_type __n) _GLIBCXX_NOEXCEPT
2606 #if _GLIBCXX_FULLY_DYNAMIC_STRING == 0 2607 if (__builtin_expect(
this != &_S_empty_rep(),
false))
2610 this->_M_set_sharable();
2611 this->_M_length = __n;
2612 traits_type::assign(this->_M_refdata()[__n], _S_terminal);
2619 _M_refdata()
throw()
2620 {
return reinterpret_cast<_CharT*
>(
this + 1); }
2623 _M_grab(
const _Alloc& __alloc1,
const _Alloc& __alloc2)
2625 return (!_M_is_leaked() && __alloc1 == __alloc2)
2626 ? _M_refcopy() : _M_clone(__alloc1);
2631 _S_create(size_type, size_type,
const _Alloc&);
2634 _M_dispose(
const _Alloc& __a) _GLIBCXX_NOEXCEPT
2636 #if _GLIBCXX_FULLY_DYNAMIC_STRING == 0 2637 if (__builtin_expect(
this != &_S_empty_rep(),
false))
2641 _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&this->_M_refcount);
2642 if (__gnu_cxx::__exchange_and_add_dispatch(&this->_M_refcount,
2645 _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&this->_M_refcount);
2652 _M_destroy(
const _Alloc&)
throw();
2655 _M_refcopy()
throw()
2657 #if _GLIBCXX_FULLY_DYNAMIC_STRING == 0 2658 if (__builtin_expect(
this != &_S_empty_rep(),
false))
2660 __gnu_cxx::__atomic_add_dispatch(&this->_M_refcount, 1);
2661 return _M_refdata();
2665 _M_clone(
const _Alloc&, size_type __res = 0);
2669 struct _Alloc_hider : _Alloc
2671 _Alloc_hider(_CharT* __dat,
const _Alloc& __a) _GLIBCXX_NOEXCEPT
2672 : _Alloc(__a), _M_p(__dat) { }
2682 static const size_type npos =
static_cast<size_type
>(-1);
2686 mutable _Alloc_hider _M_dataplus;
2689 _M_data() const _GLIBCXX_NOEXCEPT
2690 {
return _M_dataplus._M_p; }
2693 _M_data(_CharT* __p) _GLIBCXX_NOEXCEPT
2694 {
return (_M_dataplus._M_p = __p); }
2697 _M_rep()
const _GLIBCXX_NOEXCEPT
2698 {
return &((
reinterpret_cast<_Rep*
> (_M_data()))[-1]); }
2703 _M_ibegin()
const _GLIBCXX_NOEXCEPT
2704 {
return iterator(_M_data()); }
2707 _M_iend()
const _GLIBCXX_NOEXCEPT
2708 {
return iterator(_M_data() + this->
size()); }
2713 if (!_M_rep()->_M_is_leaked())
2718 _M_check(size_type __pos,
const char* __s)
const 2720 if (__pos > this->
size())
2721 __throw_out_of_range_fmt(__N(
"%s: __pos (which is %zu) > " 2722 "this->size() (which is %zu)"),
2723 __s, __pos, this->
size());
2728 _M_check_length(size_type __n1, size_type __n2,
const char* __s)
const 2731 __throw_length_error(__N(__s));
2736 _M_limit(size_type __pos, size_type __off)
const _GLIBCXX_NOEXCEPT
2738 const bool __testoff = __off < this->
size() - __pos;
2739 return __testoff ? __off : this->
size() - __pos;
2744 _M_disjunct(
const _CharT* __s)
const _GLIBCXX_NOEXCEPT
2753 _M_copy(_CharT* __d,
const _CharT* __s, size_type __n) _GLIBCXX_NOEXCEPT
2756 traits_type::assign(*__d, *__s);
2758 traits_type::copy(__d, __s, __n);
2762 _M_move(_CharT* __d,
const _CharT* __s, size_type __n) _GLIBCXX_NOEXCEPT
2765 traits_type::assign(*__d, *__s);
2767 traits_type::move(__d, __s, __n);
2771 _M_assign(_CharT* __d, size_type __n, _CharT __c) _GLIBCXX_NOEXCEPT
2774 traits_type::assign(*__d, __c);
2776 traits_type::assign(__d, __n, __c);
2781 template<
class _Iterator>
2783 _S_copy_chars(_CharT* __p, _Iterator __k1, _Iterator __k2)
2785 for (; __k1 != __k2; ++__k1, ++__p)
2786 traits_type::assign(*__p, *__k1);
2790 _S_copy_chars(_CharT* __p, iterator __k1, iterator __k2) _GLIBCXX_NOEXCEPT
2791 { _S_copy_chars(__p, __k1.base(), __k2.base()); }
2794 _S_copy_chars(_CharT* __p, const_iterator __k1, const_iterator __k2)
2796 { _S_copy_chars(__p, __k1.base(), __k2.base()); }
2799 _S_copy_chars(_CharT* __p, _CharT* __k1, _CharT* __k2) _GLIBCXX_NOEXCEPT
2800 { _M_copy(__p, __k1, __k2 - __k1); }
2803 _S_copy_chars(_CharT* __p,
const _CharT* __k1,
const _CharT* __k2)
2805 { _M_copy(__p, __k1, __k2 - __k1); }
2808 _S_compare(size_type __n1, size_type __n2) _GLIBCXX_NOEXCEPT
2810 const difference_type __d = difference_type(__n1 - __n2);
2812 if (__d > __gnu_cxx::__numeric_traits<int>::__max)
2813 return __gnu_cxx::__numeric_traits<int>::__max;
2814 else if (__d < __gnu_cxx::__numeric_traits<int>::__min)
2815 return __gnu_cxx::__numeric_traits<int>::__min;
2821 _M_mutate(size_type __pos, size_type __len1, size_type __len2);
2827 _S_empty_rep() _GLIBCXX_NOEXCEPT
2828 {
return _Rep::_S_empty_rep(); }
2839 #if _GLIBCXX_FULLY_DYNAMIC_STRING == 0 2840 : _M_dataplus(_S_empty_rep()._M_refdata(), _Alloc()) { }
2842 : _M_dataplus(_S_construct(size_type(), _CharT(), _Alloc()), _Alloc()){ }
2863 basic_string(
const basic_string& __str, size_type __pos,
2864 size_type __n = npos);
2872 basic_string(
const basic_string& __str, size_type __pos,
2873 size_type __n,
const _Alloc& __a);
2885 const _Alloc& __a = _Alloc());
2891 basic_string(
const _CharT* __s,
const _Alloc& __a = _Alloc());
2898 basic_string(size_type __n, _CharT __c,
const _Alloc& __a = _Alloc());
2900 #if __cplusplus >= 201103L 2909 #if _GLIBCXX_FULLY_DYNAMIC_STRING == 0 2912 : _M_dataplus(__str._M_dataplus)
2914 #if _GLIBCXX_FULLY_DYNAMIC_STRING == 0 2915 __str._M_data(_S_empty_rep()._M_refdata());
2917 __str._M_data(_S_construct(size_type(), _CharT(),
get_allocator()));
2935 template<
class _InputIterator>
2936 basic_string(_InputIterator __beg, _InputIterator __end,
2937 const _Alloc& __a = _Alloc());
2951 {
return this->
assign(__str); }
2959 {
return this->
assign(__s); }
2975 #if __cplusplus >= 201103L 2999 this->
assign(__l.begin(), __l.size());
3013 return iterator(_M_data());
3022 {
return const_iterator(_M_data()); }
3032 return iterator(_M_data() + this->
size());
3041 {
return const_iterator(_M_data() + this->
size()); }
3050 {
return reverse_iterator(this->
end()); }
3057 const_reverse_iterator
3059 {
return const_reverse_iterator(this->
end()); }
3068 {
return reverse_iterator(this->
begin()); }
3075 const_reverse_iterator
3077 {
return const_reverse_iterator(this->
begin()); }
3079 #if __cplusplus >= 201103L 3086 {
return const_iterator(this->_M_data()); }
3094 {
return const_iterator(this->_M_data() + this->
size()); }
3101 const_reverse_iterator
3103 {
return const_reverse_iterator(this->
end()); }
3110 const_reverse_iterator
3112 {
return const_reverse_iterator(this->
begin()); }
3121 {
return _M_rep()->_M_length; }
3127 {
return _M_rep()->_M_length; }
3132 {
return _Rep::_S_max_size; }
3145 resize(size_type __n, _CharT __c);
3159 { this->
resize(__n, _CharT()); }
3161 #if __cplusplus >= 201103L 3166 #if __cpp_exceptions 3184 {
return _M_rep()->_M_capacity; }
3204 reserve(size_type __res_arg = 0);
3212 { _M_mutate(0, this->
size(), 0); }
3220 {
return this->
size() == 0; }
3236 _GLIBCXX_DEBUG_ASSERT(__pos <=
size());
3237 return _M_data()[__pos];
3255 _GLIBCXX_DEBUG_ASSERT(__pos <=
size());
3257 _GLIBCXX_DEBUG_PEDASSERT(__cplusplus >= 201103L || __pos <
size());
3259 return _M_data()[__pos];
3275 if (__n >= this->
size())
3276 __throw_out_of_range_fmt(__N(
"basic_string::at: __n " 3277 "(which is %zu) >= this->size() " 3280 return _M_data()[__n];
3298 __throw_out_of_range_fmt(__N(
"basic_string::at: __n " 3299 "(which is %zu) >= this->size() " 3303 return _M_data()[__n];
3306 #if __cplusplus >= 201103L 3348 {
return this->
append(__str); }
3357 {
return this->
append(__s); }
3371 #if __cplusplus >= 201103L 3379 {
return this->
append(__l.begin(), __l.size()); }
3388 append(
const basic_string& __str);
3404 append(
const basic_string& __str, size_type __pos, size_type __n);
3413 append(
const _CharT* __s, size_type __n);
3423 __glibcxx_requires_string(__s);
3424 return this->
append(__s, traits_type::length(__s));
3436 append(size_type __n, _CharT __c);
3438 #if __cplusplus >= 201103L 3446 {
return this->
append(__l.begin(), __l.size()); }
3457 template<
class _InputIterator>
3459 append(_InputIterator __first, _InputIterator __last)
3460 {
return this->
replace(_M_iend(), _M_iend(), __first, __last); }
3469 const size_type __len = 1 + this->
size();
3470 if (__len > this->
capacity() || _M_rep()->_M_is_shared())
3472 traits_type::assign(_M_data()[this->
size()], __c);
3473 _M_rep()->_M_set_length_and_sharable(__len);
3482 assign(
const basic_string& __str);
3484 #if __cplusplus >= 201103L 3516 assign(
const basic_string& __str, size_type __pos, size_type __n)
3517 {
return this->
assign(__str._M_data()
3518 + __str._M_check(__pos,
"basic_string::assign"),
3519 __str._M_limit(__pos, __n)); }
3532 assign(
const _CharT* __s, size_type __n);
3546 __glibcxx_requires_string(__s);
3547 return this->
assign(__s, traits_type::length(__s));
3561 {
return _M_replace_aux(size_type(0), this->
size(), __n, __c); }
3571 template<
class _InputIterator>
3573 assign(_InputIterator __first, _InputIterator __last)
3574 {
return this->
replace(_M_ibegin(), _M_iend(), __first, __last); }
3576 #if __cplusplus >= 201103L 3584 {
return this->
assign(__l.begin(), __l.size()); }
3601 insert(iterator __p, size_type __n, _CharT __c)
3602 { this->
replace(__p, __p, __n, __c); }
3616 template<
class _InputIterator>
3618 insert(iterator __p, _InputIterator __beg, _InputIterator __end)
3619 { this->
replace(__p, __p, __beg, __end); }
3621 #if __cplusplus >= 201103L 3631 _GLIBCXX_DEBUG_PEDASSERT(__p >= _M_ibegin() && __p <= _M_iend());
3632 this->
insert(__p - _M_ibegin(), __l.begin(), __l.size());
3649 insert(size_type __pos1,
const basic_string& __str)
3650 {
return this->
insert(__pos1, __str, size_type(0), __str.size()); }
3671 insert(size_type __pos1,
const basic_string& __str,
3672 size_type __pos2, size_type __n)
3673 {
return this->
insert(__pos1, __str._M_data()
3674 + __str._M_check(__pos2,
"basic_string::insert"),
3675 __str._M_limit(__pos2, __n)); }
3694 insert(size_type __pos,
const _CharT* __s, size_type __n);
3714 __glibcxx_requires_string(__s);
3715 return this->
insert(__pos, __s, traits_type::length(__s));
3735 insert(size_type __pos, size_type __n, _CharT __c)
3736 {
return _M_replace_aux(_M_check(__pos,
"basic_string::insert"),
3737 size_type(0), __n, __c); }
3755 _GLIBCXX_DEBUG_PEDASSERT(__p >= _M_ibegin() && __p <= _M_iend());
3756 const size_type __pos = __p - _M_ibegin();
3757 _M_replace_aux(__pos, size_type(0), size_type(1), __c);
3758 _M_rep()->_M_set_leaked();
3759 return iterator(_M_data() + __pos);
3778 erase(size_type __pos = 0, size_type __n = npos)
3780 _M_mutate(_M_check(__pos,
"basic_string::erase"),
3781 _M_limit(__pos, __n), size_type(0));
3796 _GLIBCXX_DEBUG_PEDASSERT(__position >= _M_ibegin()
3797 && __position < _M_iend());
3798 const size_type __pos = __position - _M_ibegin();
3799 _M_mutate(__pos, size_type(1), size_type(0));
3800 _M_rep()->_M_set_leaked();
3801 return iterator(_M_data() + __pos);
3814 erase(iterator __first, iterator __last);
3816 #if __cplusplus >= 201103L 3845 replace(size_type __pos, size_type __n,
const basic_string& __str)
3846 {
return this->
replace(__pos, __n, __str._M_data(), __str.size()); }
3867 replace(size_type __pos1, size_type __n1,
const basic_string& __str,
3868 size_type __pos2, size_type __n2)
3869 {
return this->
replace(__pos1, __n1, __str._M_data()
3870 + __str._M_check(__pos2,
"basic_string::replace"),
3871 __str._M_limit(__pos2, __n2)); }
3892 replace(size_type __pos, size_type __n1,
const _CharT* __s,
3912 replace(size_type __pos, size_type __n1,
const _CharT* __s)
3914 __glibcxx_requires_string(__s);
3915 return this->
replace(__pos, __n1, __s, traits_type::length(__s));
3936 replace(size_type __pos, size_type __n1, size_type __n2, _CharT __c)
3937 {
return _M_replace_aux(_M_check(__pos,
"basic_string::replace"),
3938 _M_limit(__pos, __n1), __n2, __c); }
3954 replace(iterator __i1, iterator __i2,
const basic_string& __str)
3955 {
return this->
replace(__i1, __i2, __str._M_data(), __str.size()); }
3973 replace(iterator __i1, iterator __i2,
const _CharT* __s, size_type __n)
3975 _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
3976 && __i2 <= _M_iend());
3977 return this->
replace(__i1 - _M_ibegin(), __i2 - __i1, __s, __n);
3994 replace(iterator __i1, iterator __i2,
const _CharT* __s)
3996 __glibcxx_requires_string(__s);
3997 return this->
replace(__i1, __i2, __s, traits_type::length(__s));
4015 replace(iterator __i1, iterator __i2, size_type __n, _CharT __c)
4017 _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
4018 && __i2 <= _M_iend());
4019 return _M_replace_aux(__i1 - _M_ibegin(), __i2 - __i1, __n, __c);
4037 template<
class _InputIterator>
4040 _InputIterator __k1, _InputIterator __k2)
4042 _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
4043 && __i2 <= _M_iend());
4044 __glibcxx_requires_valid_range(__k1, __k2);
4045 typedef typename std::__is_integer<_InputIterator>::__type _Integral;
4046 return _M_replace_dispatch(__i1, __i2, __k1, __k2, _Integral());
4052 replace(iterator __i1, iterator __i2, _CharT* __k1, _CharT* __k2)
4054 _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
4055 && __i2 <= _M_iend());
4056 __glibcxx_requires_valid_range(__k1, __k2);
4057 return this->
replace(__i1 - _M_ibegin(), __i2 - __i1,
4062 replace(iterator __i1, iterator __i2,
4063 const _CharT* __k1,
const _CharT* __k2)
4065 _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
4066 && __i2 <= _M_iend());
4067 __glibcxx_requires_valid_range(__k1, __k2);
4068 return this->
replace(__i1 - _M_ibegin(), __i2 - __i1,
4073 replace(iterator __i1, iterator __i2, iterator __k1, iterator __k2)
4075 _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
4076 && __i2 <= _M_iend());
4077 __glibcxx_requires_valid_range(__k1, __k2);
4078 return this->
replace(__i1 - _M_ibegin(), __i2 - __i1,
4079 __k1.base(), __k2 - __k1);
4083 replace(iterator __i1, iterator __i2,
4084 const_iterator __k1, const_iterator __k2)
4086 _GLIBCXX_DEBUG_PEDASSERT(_M_ibegin() <= __i1 && __i1 <= __i2
4087 && __i2 <= _M_iend());
4088 __glibcxx_requires_valid_range(__k1, __k2);
4089 return this->
replace(__i1 - _M_ibegin(), __i2 - __i1,
4090 __k1.base(), __k2 - __k1);
4093 #if __cplusplus >= 201103L 4108 basic_string&
replace(iterator __i1, iterator __i2,
4110 {
return this->
replace(__i1, __i2, __l.begin(), __l.end()); }
4114 template<
class _Integer>
4116 _M_replace_dispatch(iterator __i1, iterator __i2, _Integer __n,
4117 _Integer __val, __true_type)
4118 {
return _M_replace_aux(__i1 - _M_ibegin(), __i2 - __i1, __n, __val); }
4120 template<
class _InputIterator>
4122 _M_replace_dispatch(iterator __i1, iterator __i2, _InputIterator __k1,
4123 _InputIterator __k2, __false_type);
4126 _M_replace_aux(size_type __pos1, size_type __n1, size_type __n2,
4130 _M_replace_safe(size_type __pos1, size_type __n1,
const _CharT* __s,
4135 template<
class _InIterator>
4137 _S_construct_aux(_InIterator __beg, _InIterator __end,
4138 const _Alloc& __a, __false_type)
4140 typedef typename iterator_traits<_InIterator>::iterator_category _Tag;
4141 return _S_construct(__beg, __end, __a, _Tag());
4146 template<
class _Integer>
4148 _S_construct_aux(_Integer __beg, _Integer __end,
4149 const _Alloc& __a, __true_type)
4150 {
return _S_construct_aux_2(static_cast<size_type>(__beg),
4154 _S_construct_aux_2(size_type __req, _CharT __c,
const _Alloc& __a)
4155 {
return _S_construct(__req, __c, __a); }
4157 template<
class _InIterator>
4159 _S_construct(_InIterator __beg, _InIterator __end,
const _Alloc& __a)
4161 typedef typename std::__is_integer<_InIterator>::__type _Integral;
4162 return _S_construct_aux(__beg, __end, __a, _Integral());
4166 template<
class _InIterator>
4168 _S_construct(_InIterator __beg, _InIterator __end,
const _Alloc& __a,
4173 template<
class _FwdIterator>
4175 _S_construct(_FwdIterator __beg, _FwdIterator __end,
const _Alloc& __a,
4179 _S_construct(size_type __req, _CharT __c,
const _Alloc& __a);
4196 copy(_CharT* __s, size_type __n, size_type __pos = 0)
const;
4207 swap(basic_string& __s);
4218 {
return _M_data(); }
4228 {
return _M_data(); }
4235 {
return _M_dataplus; }
4250 find(
const _CharT* __s, size_type __pos, size_type __n)
const;
4263 find(
const basic_string& __str, size_type __pos = 0) const
4265 {
return this->
find(__str.data(), __pos, __str.size()); }
4278 find(
const _CharT* __s, size_type __pos = 0)
const 4280 __glibcxx_requires_string(__s);
4281 return this->
find(__s, __pos, traits_type::length(__s));
4295 find(_CharT __c, size_type __pos = 0)
const _GLIBCXX_NOEXCEPT;
4308 rfind(
const basic_string& __str, size_type __pos = npos) const
4310 {
return this->
rfind(__str.data(), __pos, __str.size()); }
4325 rfind(
const _CharT* __s, size_type __pos, size_type __n)
const;
4338 rfind(
const _CharT* __s, size_type __pos = npos)
const 4340 __glibcxx_requires_string(__s);
4341 return this->
rfind(__s, __pos, traits_type::length(__s));
4355 rfind(_CharT __c, size_type __pos = npos)
const _GLIBCXX_NOEXCEPT;
4371 {
return this->
find_first_of(__str.data(), __pos, __str.size()); }
4386 find_first_of(
const _CharT* __s, size_type __pos, size_type __n)
const;
4401 __glibcxx_requires_string(__s);
4402 return this->
find_first_of(__s, __pos, traits_type::length(__s));
4419 {
return this->
find(__c, __pos); }
4435 {
return this->
find_last_of(__str.data(), __pos, __str.size()); }
4450 find_last_of(
const _CharT* __s, size_type __pos, size_type __n)
const;
4465 __glibcxx_requires_string(__s);
4466 return this->
find_last_of(__s, __pos, traits_type::length(__s));
4483 {
return this->
rfind(__c, __pos); }
4514 size_type __n)
const;
4529 __glibcxx_requires_string(__s);
4577 size_type __n)
const;
4592 __glibcxx_requires_string(__s);
4623 substr(size_type __pos = 0, size_type __n = npos)
const 4625 _M_check(__pos,
"basic_string::substr"), __n); }
4644 const size_type __size = this->
size();
4645 const size_type __osize = __str.size();
4646 const size_type __len =
std::min(__size, __osize);
4648 int __r = traits_type::compare(_M_data(), __str.data(), __len);
4650 __r = _S_compare(__size, __osize);
4674 compare(size_type __pos, size_type __n,
const basic_string& __str)
const;
4700 compare(size_type __pos1, size_type __n1,
const basic_string& __str,
4701 size_type __pos2, size_type __n2)
const;
4718 compare(
const _CharT* __s)
const;
4742 compare(size_type __pos, size_type __n1,
const _CharT* __s)
const;
4769 compare(size_type __pos, size_type __n1,
const _CharT* __s,
4770 size_type __n2)
const;
4772 #endif // !_GLIBCXX_USE_CXX11_ABI 4781 template<
typename _CharT,
typename _Traits,
typename _Alloc>
4787 __str.append(__rhs);
4797 template<
typename _CharT,
typename _Traits,
typename _Alloc>
4808 template<
typename _CharT,
typename _Traits,
typename _Alloc>
4818 template<
typename _CharT,
typename _Traits,
typename _Alloc>
4821 const _CharT* __rhs)
4824 __str.append(__rhs);
4834 template<
typename _CharT,
typename _Traits,
typename _Alloc>
4839 typedef typename __string_type::size_type __size_type;
4840 __string_type __str(__lhs);
4841 __str.append(__size_type(1), __rhs);
4845 #if __cplusplus >= 201103L 4846 template<
typename _CharT,
typename _Traits,
typename _Alloc>
4850 {
return std::move(__lhs.append(__rhs)); }
4852 template<
typename _CharT,
typename _Traits,
typename _Alloc>
4856 {
return std::move(__rhs.insert(0, __lhs)); }
4858 template<
typename _CharT,
typename _Traits,
typename _Alloc>
4863 const auto __size = __lhs.size() + __rhs.size();
4864 const bool __cond = (__size > __lhs.capacity()
4865 && __size <= __rhs.capacity());
4866 return __cond ? std::move(__rhs.insert(0, __lhs))
4867 : std::move(__lhs.append(__rhs));
4870 template<
typename _CharT,
typename _Traits,
typename _Alloc>
4874 {
return std::move(__rhs.insert(0, __lhs)); }
4876 template<
typename _CharT,
typename _Traits,
typename _Alloc>
4880 {
return std::move(__rhs.insert(0, 1, __lhs)); }
4882 template<
typename _CharT,
typename _Traits,
typename _Alloc>
4885 const _CharT* __rhs)
4886 {
return std::move(__lhs.append(__rhs)); }
4888 template<
typename _CharT,
typename _Traits,
typename _Alloc>
4892 {
return std::move(__lhs.append(1, __rhs)); }
4902 template<
typename _CharT,
typename _Traits,
typename _Alloc>
4906 {
return __lhs.compare(__rhs) == 0; }
4908 template<
typename _CharT>
4910 typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value,
bool>::__type
4913 {
return (__lhs.
size() == __rhs.
size()
4923 template<
typename _CharT,
typename _Traits,
typename _Alloc>
4925 operator==(
const _CharT* __lhs,
4927 {
return __rhs.compare(__lhs) == 0; }
4935 template<
typename _CharT,
typename _Traits,
typename _Alloc>
4938 const _CharT* __rhs)
4939 {
return __lhs.compare(__rhs) == 0; }
4948 template<
typename _CharT,
typename _Traits,
typename _Alloc>
4952 {
return !(__lhs == __rhs); }
4960 template<
typename _CharT,
typename _Traits,
typename _Alloc>
4962 operator!=(
const _CharT* __lhs,
4964 {
return !(__lhs == __rhs); }
4972 template<
typename _CharT,
typename _Traits,
typename _Alloc>
4975 const _CharT* __rhs)
4976 {
return !(__lhs == __rhs); }
4985 template<
typename _CharT,
typename _Traits,
typename _Alloc>
4987 operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
4989 {
return __lhs.
compare(__rhs) < 0; }
4997 template<
typename _CharT,
typename _Traits,
typename _Alloc>
4999 operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
5000 const _CharT* __rhs)
5001 {
return __lhs.
compare(__rhs) < 0; }
5009 template<
typename _CharT,
typename _Traits,
typename _Alloc>
5011 operator<(
const _CharT* __lhs,
5013 {
return __rhs.compare(__lhs) > 0; }
5022 template<
typename _CharT,
typename _Traits,
typename _Alloc>
5026 {
return __lhs.compare(__rhs) > 0; }
5034 template<
typename _CharT,
typename _Traits,
typename _Alloc>
5037 const _CharT* __rhs)
5038 {
return __lhs.compare(__rhs) > 0; }
5046 template<
typename _CharT,
typename _Traits,
typename _Alloc>
5048 operator>(
const _CharT* __lhs,
5050 {
return __rhs.compare(__lhs) < 0; }
5059 template<
typename _CharT,
typename _Traits,
typename _Alloc>
5061 operator<=(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
5063 {
return __lhs.
compare(__rhs) <= 0; }
5071 template<
typename _CharT,
typename _Traits,
typename _Alloc>
5073 operator<=(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
5074 const _CharT* __rhs)
5075 {
return __lhs.
compare(__rhs) <= 0; }
5083 template<
typename _CharT,
typename _Traits,
typename _Alloc>
5085 operator<=(
const _CharT* __lhs,
5087 {
return __rhs.compare(__lhs) >= 0; }
5096 template<
typename _CharT,
typename _Traits,
typename _Alloc>
5100 {
return __lhs.compare(__rhs) >= 0; }
5108 template<
typename _CharT,
typename _Traits,
typename _Alloc>
5111 const _CharT* __rhs)
5112 {
return __lhs.compare(__rhs) >= 0; }
5120 template<
typename _CharT,
typename _Traits,
typename _Alloc>
5122 operator>=(
const _CharT* __lhs,
5124 {
return __rhs.compare(__lhs) <= 0; }
5133 template<
typename _CharT,
typename _Traits,
typename _Alloc>
5137 { __lhs.swap(__rhs); }
5152 template<
typename _CharT,
typename _Traits,
typename _Alloc>
5170 template<
typename _CharT,
typename _Traits,
typename _Alloc>
5172 operator<<(basic_ostream<_CharT, _Traits>& __os,
5177 return __ostream_insert(__os, __str.
data(), __str.
size());
5193 template<
typename _CharT,
typename _Traits,
typename _Alloc>
5210 template<
typename _CharT,
typename _Traits,
typename _Alloc>
5216 #if __cplusplus >= 201103L 5218 template<
typename _CharT,
typename _Traits,
typename _Alloc>
5225 template<
typename _CharT,
typename _Traits,
typename _Alloc>
5237 #ifdef _GLIBCXX_USE_WCHAR_T 5244 _GLIBCXX_END_NAMESPACE_VERSION
5247 #if __cplusplus >= 201103L && defined(_GLIBCXX_USE_C99) 5251 namespace std _GLIBCXX_VISIBILITY(default)
5253 _GLIBCXX_BEGIN_NAMESPACE_VERSION
5254 _GLIBCXX_BEGIN_NAMESPACE_CXX11
5258 stoi(
const string& __str,
size_t* __idx = 0,
int __base = 10)
5259 {
return __gnu_cxx::__stoa<long, int>(&std::strtol,
"stoi", __str.
c_str(),
5263 stol(
const string& __str,
size_t* __idx = 0,
int __base = 10)
5264 {
return __gnu_cxx::__stoa(&std::strtol,
"stol", __str.
c_str(),
5267 inline unsigned long 5268 stoul(
const string& __str,
size_t* __idx = 0,
int __base = 10)
5269 {
return __gnu_cxx::__stoa(&std::strtoul,
"stoul", __str.
c_str(),
5273 stoll(
const string& __str,
size_t* __idx = 0,
int __base = 10)
5274 {
return __gnu_cxx::__stoa(&std::strtoll,
"stoll", __str.
c_str(),
5277 inline unsigned long long 5278 stoull(
const string& __str,
size_t* __idx = 0,
int __base = 10)
5279 {
return __gnu_cxx::__stoa(&std::strtoull,
"stoull", __str.
c_str(),
5284 stof(
const string& __str,
size_t* __idx = 0)
5285 {
return __gnu_cxx::__stoa(&std::strtof,
"stof", __str.
c_str(), __idx); }
5288 stod(
const string& __str,
size_t* __idx = 0)
5289 {
return __gnu_cxx::__stoa(&std::strtod,
"stod", __str.
c_str(), __idx); }
5292 stold(
const string& __str,
size_t* __idx = 0)
5293 {
return __gnu_cxx::__stoa(&std::strtold,
"stold", __str.
c_str(), __idx); }
5299 to_string(
int __val)
5300 {
return __gnu_cxx::__to_xstring<string>(&std::vsnprintf, 4 *
sizeof(int),
5304 to_string(
unsigned __val)
5305 {
return __gnu_cxx::__to_xstring<string>(&std::vsnprintf,
5306 4 *
sizeof(unsigned),
5310 to_string(
long __val)
5311 {
return __gnu_cxx::__to_xstring<string>(&std::vsnprintf, 4 *
sizeof(long),
5315 to_string(
unsigned long __val)
5316 {
return __gnu_cxx::__to_xstring<string>(&std::vsnprintf,
5317 4 *
sizeof(
unsigned long),
5321 to_string(
long long __val)
5322 {
return __gnu_cxx::__to_xstring<string>(&std::vsnprintf,
5323 4 *
sizeof(
long long),
5327 to_string(
unsigned long long __val)
5328 {
return __gnu_cxx::__to_xstring<string>(&std::vsnprintf,
5329 4 *
sizeof(
unsigned long long),
5333 to_string(
float __val)
5336 __gnu_cxx::__numeric_traits<float>::__max_exponent10 + 20;
5337 return __gnu_cxx::__to_xstring<string>(&std::vsnprintf, __n,
5342 to_string(
double __val)
5345 __gnu_cxx::__numeric_traits<double>::__max_exponent10 + 20;
5346 return __gnu_cxx::__to_xstring<string>(&std::vsnprintf, __n,
5351 to_string(
long double __val)
5354 __gnu_cxx::__numeric_traits<long double>::__max_exponent10 + 20;
5355 return __gnu_cxx::__to_xstring<string>(&std::vsnprintf, __n,
5359 #ifdef _GLIBCXX_USE_WCHAR_T 5361 stoi(
const wstring& __str,
size_t* __idx = 0,
int __base = 10)
5362 {
return __gnu_cxx::__stoa<long, int>(&std::wcstol,
"stoi", __str.
c_str(),
5366 stol(
const wstring& __str,
size_t* __idx = 0,
int __base = 10)
5367 {
return __gnu_cxx::__stoa(&std::wcstol,
"stol", __str.
c_str(),
5370 inline unsigned long 5371 stoul(
const wstring& __str,
size_t* __idx = 0,
int __base = 10)
5372 {
return __gnu_cxx::__stoa(&std::wcstoul,
"stoul", __str.
c_str(),
5376 stoll(
const wstring& __str,
size_t* __idx = 0,
int __base = 10)
5377 {
return __gnu_cxx::__stoa(&std::wcstoll,
"stoll", __str.
c_str(),
5380 inline unsigned long long 5381 stoull(
const wstring& __str,
size_t* __idx = 0,
int __base = 10)
5382 {
return __gnu_cxx::__stoa(&std::wcstoull,
"stoull", __str.
c_str(),
5387 stof(
const wstring& __str,
size_t* __idx = 0)
5388 {
return __gnu_cxx::__stoa(&std::wcstof,
"stof", __str.
c_str(), __idx); }
5391 stod(
const wstring& __str,
size_t* __idx = 0)
5392 {
return __gnu_cxx::__stoa(&std::wcstod,
"stod", __str.
c_str(), __idx); }
5395 stold(
const wstring& __str,
size_t* __idx = 0)
5396 {
return __gnu_cxx::__stoa(&std::wcstold,
"stold", __str.
c_str(), __idx); }
5398 #ifndef _GLIBCXX_HAVE_BROKEN_VSWPRINTF 5401 to_wstring(
int __val)
5402 {
return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf, 4 *
sizeof(int),
5406 to_wstring(
unsigned __val)
5407 {
return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf,
5408 4 *
sizeof(unsigned),
5412 to_wstring(
long __val)
5413 {
return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf, 4 *
sizeof(long),
5417 to_wstring(
unsigned long __val)
5418 {
return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf,
5419 4 *
sizeof(
unsigned long),
5423 to_wstring(
long long __val)
5424 {
return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf,
5425 4 *
sizeof(
long long),
5429 to_wstring(
unsigned long long __val)
5430 {
return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf,
5431 4 *
sizeof(
unsigned long long),
5435 to_wstring(
float __val)
5438 __gnu_cxx::__numeric_traits<float>::__max_exponent10 + 20;
5439 return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf, __n,
5444 to_wstring(
double __val)
5447 __gnu_cxx::__numeric_traits<double>::__max_exponent10 + 20;
5448 return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf, __n,
5453 to_wstring(
long double __val)
5456 __gnu_cxx::__numeric_traits<long double>::__max_exponent10 + 20;
5457 return __gnu_cxx::__to_xstring<wstring>(&std::vswprintf, __n,
5460 #endif // _GLIBCXX_HAVE_BROKEN_VSWPRINTF 5463 _GLIBCXX_END_NAMESPACE_CXX11
5464 _GLIBCXX_END_NAMESPACE_VERSION
5469 #if __cplusplus >= 201103L 5473 namespace std _GLIBCXX_VISIBILITY(default)
5475 _GLIBCXX_BEGIN_NAMESPACE_VERSION
5479 #ifndef _GLIBCXX_COMPATIBILITY_CXX0X 5483 :
public __hash_base<size_t, string>
5486 operator()(
const string& __s)
const noexcept
5487 {
return std::_Hash_impl::hash(__s.
data(), __s.
length()); }
5494 #ifdef _GLIBCXX_USE_WCHAR_T 5498 :
public __hash_base<size_t, wstring>
5501 operator()(
const wstring& __s)
const noexcept
5502 {
return std::_Hash_impl::hash(__s.
data(),
5503 __s.
length() *
sizeof(wchar_t)); }
5512 #ifdef _GLIBCXX_USE_C99_STDINT_TR1 5516 :
public __hash_base<size_t, u16string>
5519 operator()(
const u16string& __s)
const noexcept
5520 {
return std::_Hash_impl::hash(__s.
data(),
5521 __s.
length() *
sizeof(char16_t)); }
5531 :
public __hash_base<size_t, u32string>
5534 operator()(
const u32string& __s)
const noexcept
5535 {
return std::_Hash_impl::hash(__s.
data(),
5536 __s.
length() *
sizeof(char32_t)); }
5544 #if __cplusplus > 201103L 5546 #define __cpp_lib_string_udls 201304 5548 inline namespace literals
5550 inline namespace string_literals
5553 _GLIBCXX_DEFAULT_ABI_TAG
5555 operator""s(
const char* __str,
size_t __len)
5558 #ifdef _GLIBCXX_USE_WCHAR_T 5559 _GLIBCXX_DEFAULT_ABI_TAG
5561 operator""s(
const wchar_t* __str,
size_t __len)
5565 #ifdef _GLIBCXX_USE_C99_STDINT_TR1 5566 _GLIBCXX_DEFAULT_ABI_TAG
5568 operator""s(
const char16_t* __str,
size_t __len)
5571 _GLIBCXX_DEFAULT_ABI_TAG
5573 operator""s(
const char32_t* __str,
size_t __len)
5580 #endif // __cplusplus > 201103L 5582 _GLIBCXX_END_NAMESPACE_VERSION
basic_string & replace(iterator __i1, iterator __i2, const basic_string &__str)
Replace range of characters with string.
reference operator[](size_type __pos)
Subscript access to the data contained in the string.
const_reference operator[](size_type __pos) const noexcept
Subscript access to the data contained in the string.
size_type max_size() const noexcept
Returns the size() of the largest possible string.
basic_string & operator=(const basic_string &__str)
Assign the value of str to this string.
std::basic_istream< _CharT, _Traits > & operator>>(std::basic_istream< _CharT, _Traits > &__is, bitset< _Nb > &__x)
Global I/O operators for bitsets.
size_type find_last_of(_CharT __c, size_type __pos=npos) const noexcept
Find last position of a character.
basic_string()
Default constructor creates an empty string.
basic_string & append(_InputIterator __first, _InputIterator __last)
Append a range of characters.
basic_string & operator=(const _CharT *__s)
Copy contents of s into this string.
Basis for explicit traits specializations.
basic_string & append(const _CharT *__s)
Append a C string.
const_reference at(size_type __n) const
Provides access to the data contained in the string.
const_iterator cend() const noexcept
basic_string & operator=(_CharT __c)
Set value to string of length 1.
basic_string & assign(initializer_list< _CharT > __l)
Set value to an initializer_list of characters.
basic_string & replace(iterator __i1, iterator __i2, const _CharT *__s)
Replace range of characters with C string.
const_iterator begin() const noexcept
basic_string & replace(size_type __pos, size_type __n, const basic_string &__str)
Replace characters with value from another string.
iterator insert(iterator __p, _CharT __c)
Insert one character.
size_type find_first_of(_CharT __c, size_type __pos=0) const noexcept
Find position of a character.
basic_string & assign(basic_string &&__str)
Set value to contents of another string.
basic_string & assign(size_type __n, _CharT __c)
Set value to multiple characters.
basic_string & assign(const basic_string &__str)
Set value to contents of another string.
size_type rfind(const _CharT *__s, size_type __pos=npos) const
Find last position of a C string.
~basic_string() noexcept
Destroy the string instance.
basic_string & insert(size_type __pos, const _CharT *__s)
Insert a C string.
void insert(iterator __p, size_type __n, _CharT __c)
Insert multiple characters.
size_type find(const basic_string &__str, size_type __pos=0) const noexcept
Find position of a string.
basic_string(basic_string &&__str) noexcept
Move construct string.
basic_string & insert(size_type __pos, size_type __n, _CharT __c)
Insert multiple characters.
basic_string & replace(iterator __i1, iterator __i2, const _CharT *__s, size_type __n)
Replace range of characters with C substring.
basic_string & operator=(basic_string &&__str)
Move assign the value of str to this string.
size_type find_last_of(const _CharT *__s, size_type __pos=npos) const
Find last position of a character of C string.
int compare(const basic_string &__str) const
Compare to a string.
bool empty() const noexcept
basic_string & insert(size_type __pos1, const basic_string &__str, size_type __pos2, size_type __n)
Insert a substring.
basic_string & append(initializer_list< _CharT > __l)
Append an initializer_list of characters.
size_type find(const _CharT *__s, size_type __pos, size_type __n) const
Find position of a C substring.
basic_string & replace(iterator __i1, iterator __i2, size_type __n, _CharT __c)
Replace range of characters with multiple characters.
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.
Managing sequences of characters and character-like objects.
basic_string & append(const basic_string &__str)
Append a string to this string.
size_type find_first_not_of(const _CharT *__s, size_type __pos=0) const
Find position of a character not in C string.
void resize(size_type __n)
Resizes the string to the specified number of characters.
Template class basic_ostream.
const_reverse_iterator rend() const noexcept
const_reverse_iterator crbegin() const noexcept
basic_string & assign(_InputIterator __first, _InputIterator __last)
Set value to a range of characters.
void pop_back()
Remove the last character.
_GLIBCXX14_CONSTEXPR const _Tp & min(const _Tp &, const _Tp &)
This does what you think it does.
size_type find_first_not_of(const basic_string &__str, size_type __pos=0) const noexcept
Find position of a character not in string.
size_type find(const _CharT *__s, size_type __pos=0) const
Find position of a C string.
basic_string & replace(size_type __pos, size_type __n1, size_type __n2, _CharT __c)
Replace characters with multiple characters.
complex< _Tp > operator+(const complex< _Tp > &__x, const complex< _Tp > &__y)
Return new complex value x plus y.
basic_string & operator+=(const basic_string &__str)
Append a string to this string.
const_reverse_iterator crend() const noexcept
One of the comparison functors.
Primary class template hash.
void insert(iterator __p, initializer_list< _CharT > __l)
Insert an initializer_list of characters.
void reserve(size_type __res_arg=0)
Attempt to preallocate enough memory for specified number of characters.
char_type widen(char __c) const
Widens characters.
basic_string & replace(size_type __pos, size_type __n1, const _CharT *__s)
Replace characters with value of a C 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.
size_type find_last_of(const basic_string &__str, size_type __pos=npos) const noexcept
Find last position of a character of string.
void resize(size_type __n, _CharT __c)
Resizes the string to the specified number of characters.
Uniform interface to all pointer-like types.
iterator erase(iterator __position)
Remove one character.
size_type copy(_CharT *__s, size_type __n, size_type __pos=0) const
Copy substring into C string.
size_type find_first_of(const basic_string &__str, size_type __pos=0) const noexcept
Find position of a character of string.
const _CharT * c_str() const noexcept
Return const pointer to null-terminated contents.
size_type find_first_of(const _CharT *__s, size_type __pos=0) const
Find position of a character of 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 rfind(const basic_string &__str, size_type __pos=npos) const noexcept
Find last position of a string.
basic_string & replace(iterator __i1, iterator __i2, _InputIterator __k1, _InputIterator __k2)
Replace range of characters with range.
void insert(iterator __p, _InputIterator __beg, _InputIterator __end)
Insert a range of characters.
const_iterator cbegin() const noexcept
const_iterator end() const noexcept
basic_string & insert(size_type __pos1, const basic_string &__str)
Insert value of a string.
const_reverse_iterator rbegin() const noexcept
_Siter_base< _Iterator >::iterator_type __base(_Iterator __it)
const_reference back() const noexcept
Template class basic_istream.
basic_string & erase(size_type __pos=0, size_type __n=npos)
Remove characters.
void push_back(_CharT __c)
Append a single character.
void swap(basic_string &__s)
Swap contents with another string.
static const size_type npos
Value returned by various member functions when they fail.
reverse_iterator rbegin()
allocator_type get_allocator() const noexcept
Return copy of allocator used to construct this string.
reference at(size_type __n)
Provides access to the data contained in the string.
basic_string & operator+=(const _CharT *__s)
Append a C string.
basic_string & assign(const _CharT *__s)
Set value to contents of a C string.
const_reference front() const noexcept
Forward iterators support a superset of input iterator operations.
size_type size() const noexcept
Returns the number of characters in the string, not including any null-termination.
const _CharT * data() const noexcept
Return const pointer to contents.
basic_string & operator=(initializer_list< _CharT > __l)
Set value to string constructed from initializer list.
basic_string & operator+=(_CharT __c)
Append a character.
ISO C++ entities toplevel namespace is std.
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.
size_type capacity() const noexcept
Uniform interface to C++98 and C++0x allocators.
void shrink_to_fit() noexcept
A non-binding request to reduce capacity() to size().
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(iterator __i1, iterator __i2, initializer_list< _CharT > __l)
Replace range of characters with initializer_list.
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 length() const noexcept
Returns the number of characters in the string, not including any null-termination.