96 basic_string<_CharT, _Traits, _Allocator>,
97 _Allocator, _Safe_sequence, bool(_GLIBCXX_USE_CXX11_ABI)>,
102 basic_string, _Allocator,
_Safe_sequence, bool(_GLIBCXX_USE_CXX11_ABI)>
105 template<
typename _ItT,
typename _SeqT,
typename _CatT>
106 friend class ::__gnu_debug::_Safe_iterator;
110 typename _Base::__const_iterator, basic_string> __const_iterator;
114 typedef _Traits traits_type;
115 typedef typename _Traits::char_type value_type;
116 typedef _Allocator allocator_type;
117 typedef typename _Base::size_type size_type;
118 typedef typename _Base::difference_type difference_type;
119 typedef typename _Base::reference reference;
120 typedef typename _Base::const_reference const_reference;
121 typedef typename _Base::pointer pointer;
122 typedef typename _Base::const_pointer const_pointer;
125 typename _Base::iterator, basic_string> iterator;
127 typename _Base::const_iterator, basic_string> const_iterator;
140#if __cplusplus < 201103L
153 const _Allocator& __a = _Allocator())
157 basic_string(
const basic_string& __s,
const _Allocator& __a)
158 : _Base(__s, __a) { }
180 basic_string(
const basic_string& __str, size_type __pos,
182 const _Allocator& __a = _Allocator())
183 : _Base(__str, __pos, __n, __a) { }
186 const _Allocator& __a = _Allocator())
187 : _Base(__glibcxx_check_string_n_constructor(__s, __n), __n, __a) { }
189 basic_string(
const _CharT* __s,
const _Allocator& __a = _Allocator())
190 : _Base(__glibcxx_check_string_constructor(__s), __a)
194 const _Allocator& __a = _Allocator())
195 : _Base(__n, __c, __a) { }
197 template<
typename _InputIterator>
198 basic_string(_InputIterator __begin, _InputIterator __end,
199 const _Allocator& __a = _Allocator())
201 __glibcxx_check_valid_constructor_range(__begin, __end)),
204#if __cplusplus < 201103L
206 operator=(
const basic_string& __str)
208 this->_M_safe() = __str;
214 operator=(
const basic_string&) =
default;
217 operator=(basic_string&&) =
default;
221 operator=(
const _CharT* __s)
223 __glibcxx_check_string(__s);
225 this->_M_invalidate_all();
230 operator=(_CharT __c)
233 this->_M_invalidate_all();
237#if __cplusplus >= 201103L
242 this->_M_invalidate_all();
253 begin()
const _GLIBCXX_NOEXCEPT
261 end()
const _GLIBCXX_NOEXCEPT
262 {
return const_iterator(
_Base::end(),
this); }
266 {
return reverse_iterator(
end()); }
268 const_reverse_iterator
269 rbegin()
const _GLIBCXX_NOEXCEPT
270 {
return const_reverse_iterator(
end()); }
274 {
return reverse_iterator(
begin()); }
276 const_reverse_iterator
277 rend()
const _GLIBCXX_NOEXCEPT
278 {
return const_reverse_iterator(
begin()); }
280#if __cplusplus >= 201103L
286 cend()
const noexcept
287 {
return const_iterator(
_Base::end(),
this); }
289 const_reverse_iterator
291 {
return const_reverse_iterator(
end()); }
293 const_reverse_iterator
294 crend()
const noexcept
295 {
return const_reverse_iterator(
begin()); }
304 resize(size_type __n, _CharT __c)
307 this->_M_invalidate_all();
311 resize(size_type __n)
312 { this->resize(__n, _CharT()); }
314#if __cplusplus >= 201103L
323 this->_M_invalidate_all();
338 this->_M_invalidate_all();
345 operator[](size_type __pos)
const _GLIBCXX_NOEXCEPT
347 _GLIBCXX_DEBUG_VERIFY(__pos <= this->
size(),
348 _M_message(__gnu_debug::__msg_subscript_oob)
349 ._M_sequence(*
this,
"this")
350 ._M_integer(__pos,
"__pos")
351 ._M_integer(this->
size(),
"size"));
352 return _M_base()[__pos];
356 operator[](size_type __pos)
358#if __cplusplus < 201103L && defined(_GLIBCXX_DEBUG_PEDANTIC)
359 __glibcxx_check_subscript(__pos);
362 _GLIBCXX_DEBUG_VERIFY(__pos <= this->
size(),
363 _M_message(__gnu_debug::__msg_subscript_oob)
364 ._M_sequence(*
this,
"this")
365 ._M_integer(__pos,
"__pos")
366 ._M_integer(this->
size(),
"size"));
368 return _M_base()[__pos];
373#if __cplusplus >= 201103L
380 operator+=(
const basic_string& __str)
383 this->_M_invalidate_all();
388 operator+=(
const _CharT* __s)
390 __glibcxx_check_string(__s);
392 this->_M_invalidate_all();
397 operator+=(_CharT __c)
400 this->_M_invalidate_all();
404#if __cplusplus >= 201103L
409 this->_M_invalidate_all();
415 append(
const basic_string& __str)
418 this->_M_invalidate_all();
423 append(
const basic_string& __str, size_type __pos, size_type __n)
426 this->_M_invalidate_all();
431 append(
const _CharT* __s, size_type __n)
433 __glibcxx_check_string_len(__s, __n);
435 this->_M_invalidate_all();
440 append(
const _CharT* __s)
442 __glibcxx_check_string(__s);
444 this->_M_invalidate_all();
449 append(size_type __n, _CharT __c)
452 this->_M_invalidate_all();
456 template<
typename _InputIterator>
458 append(_InputIterator __first, _InputIterator __last)
460 typename __gnu_debug::_Distance_traits<_InputIterator>::__type __dist;
461 __glibcxx_check_valid_range2(__first, __last, __dist);
463 if (__dist.second >= __dp_sign)
465 __gnu_debug::__unsafe(__last));
469 this->_M_invalidate_all();
476 push_back(_CharT __c)
479 this->_M_invalidate_all();
483 assign(
const basic_string& __x)
486 this->_M_invalidate_all();
490#if __cplusplus >= 201103L
492 assign(basic_string&& __x)
496 this->_M_invalidate_all();
502 assign(
const basic_string& __str, size_type __pos, size_type __n)
505 this->_M_invalidate_all();
510 assign(
const _CharT* __s, size_type __n)
512 __glibcxx_check_string_len(__s, __n);
514 this->_M_invalidate_all();
519 assign(
const _CharT* __s)
521 __glibcxx_check_string(__s);
523 this->_M_invalidate_all();
528 assign(size_type __n, _CharT __c)
531 this->_M_invalidate_all();
535 template<
typename _InputIterator>
537 assign(_InputIterator __first, _InputIterator __last)
539 typename __gnu_debug::_Distance_traits<_InputIterator>::__type __dist;
540 __glibcxx_check_valid_range2(__first, __last, __dist);
542 if (__dist.second >= __dp_sign)
544 __gnu_debug::__unsafe(__last));
548 this->_M_invalidate_all();
552#if __cplusplus >= 201103L
557 this->_M_invalidate_all();
563 insert(size_type __pos1,
const basic_string& __str)
566 this->_M_invalidate_all();
571 insert(size_type __pos1,
const basic_string& __str,
572 size_type __pos2, size_type __n)
575 this->_M_invalidate_all();
580 insert(size_type __pos,
const _CharT* __s, size_type __n)
582 __glibcxx_check_string(__s);
584 this->_M_invalidate_all();
589 insert(size_type __pos,
const _CharT* __s)
591 __glibcxx_check_string(__s);
593 this->_M_invalidate_all();
598 insert(size_type __pos, size_type __n, _CharT __c)
601 this->_M_invalidate_all();
606 insert(__const_iterator __p, _CharT __c)
610 this->_M_invalidate_all();
611 return iterator(__res,
this);
614#if __cplusplus >= 201103L
616 insert(const_iterator __p, size_type __n, _CharT __c)
619#if _GLIBCXX_USE_CXX11_ABI
624 typename _Base::iterator __res =
_Base::begin() + __offset;
626 this->_M_invalidate_all();
627 return iterator(__res,
this);
631 insert(iterator __p, size_type __n, _CharT __c)
635 this->_M_invalidate_all();
639 template<
typename _InputIterator>
641 insert(__const_iterator __p,
642 _InputIterator __first, _InputIterator __last)
644 typename __gnu_debug::_Distance_traits<_InputIterator>::__type __dist;
647 typename _Base::iterator __res;
648#if ! _GLIBCXX_INSERT_RETURNS_ITERATOR
651 if (__dist.second >= __dp_sign)
653 _GLIBCXX_INSERT_RETURNS_ITERATOR_ONLY(__res =)
655 __gnu_debug::__unsafe(__last));
659 _GLIBCXX_INSERT_RETURNS_ITERATOR_ONLY(__res =)
663#if ! _GLIBCXX_INSERT_RETURNS_ITERATOR
666 this->_M_invalidate_all();
667 return iterator(__res,
this);
670#if __cplusplus >= 201103L
675#if _GLIBCXX_USE_CXX11_ABI
682 this->_M_invalidate_all();
683 return iterator(__res,
this);
688 erase(size_type __pos = 0, size_type __n =
_Base::npos)
691 this->_M_invalidate_all();
696 erase(__const_iterator __position)
700 this->_M_invalidate_all();
701 return iterator(__res,
this);
705 erase(__const_iterator __first, __const_iterator __last)
710 typename _Base::iterator __res =
_Base::erase(__first.base(),
712 this->_M_invalidate_all();
713 return iterator(__res,
this);
716#if __cplusplus >= 201103L
720 __glibcxx_check_nonempty();
722 this->_M_invalidate_all();
727 replace(size_type __pos1, size_type __n1,
const basic_string& __str)
730 this->_M_invalidate_all();
735 replace(size_type __pos1, size_type __n1,
const basic_string& __str,
736 size_type __pos2, size_type __n2)
739 this->_M_invalidate_all();
744 replace(size_type __pos, size_type __n1,
const _CharT* __s,
747 __glibcxx_check_string_len(__s, __n2);
749 this->_M_invalidate_all();
754 replace(size_type __pos, size_type __n1,
const _CharT* __s)
756 __glibcxx_check_string(__s);
758 this->_M_invalidate_all();
763 replace(size_type __pos, size_type __n1, size_type __n2, _CharT __c)
766 this->_M_invalidate_all();
771 replace(__const_iterator __i1, __const_iterator __i2,
772 const basic_string& __str)
776 this->_M_invalidate_all();
781 replace(__const_iterator __i1, __const_iterator __i2,
782 const _CharT* __s, size_type __n)
785 __glibcxx_check_string_len(__s, __n);
787 this->_M_invalidate_all();
792 replace(__const_iterator __i1, __const_iterator __i2,
796 __glibcxx_check_string(__s);
798 this->_M_invalidate_all();
803 replace(__const_iterator __i1, __const_iterator __i2,
804 size_type __n, _CharT __c)
808 this->_M_invalidate_all();
812 template<
typename _InputIterator>
814 replace(__const_iterator __i1, __const_iterator __i2,
815 _InputIterator __j1, _InputIterator __j2)
819 typename __gnu_debug::_Distance_traits<_InputIterator>::__type __dist;
820 __glibcxx_check_valid_range2(__j1, __j2, __dist);
822 if (__dist.second >= __dp_sign)
824 __gnu_debug::__unsafe(__j1),
825 __gnu_debug::__unsafe(__j2));
829 this->_M_invalidate_all();
833#if __cplusplus >= 201103L
835 replace(__const_iterator __i1, __const_iterator __i2,
840 this->_M_invalidate_all();
846 copy(_CharT* __s, size_type __n, size_type __pos = 0)
const
848 __glibcxx_check_string_len(__s, __n);
853 swap(basic_string& __x)
854 _GLIBCXX_NOEXCEPT_IF(std::__is_nothrow_swappable<_Base>::value)
862 c_str()
const _GLIBCXX_NOEXCEPT
865 this->_M_invalidate_all();
870 data()
const _GLIBCXX_NOEXCEPT
873 this->_M_invalidate_all();
880 find(
const basic_string& __str, size_type __pos = 0)
const
885 find(
const _CharT* __s, size_type __pos, size_type __n)
const
887 __glibcxx_check_string(__s);
892 find(
const _CharT* __s, size_type __pos = 0)
const
894 __glibcxx_check_string(__s);
899 find(_CharT __c, size_type __pos = 0)
const _GLIBCXX_NOEXCEPT
903 rfind(
const basic_string& __str, size_type __pos =
_Base::npos)
const
908 rfind(
const _CharT* __s, size_type __pos, size_type __n)
const
910 __glibcxx_check_string_len(__s, __n);
915 rfind(
const _CharT* __s, size_type __pos =
_Base::npos)
const
917 __glibcxx_check_string(__s);
922 rfind(_CharT __c, size_type __pos =
_Base::npos)
const _GLIBCXX_NOEXCEPT
926 find_first_of(
const basic_string& __str, size_type __pos = 0)
const
931 find_first_of(
const _CharT* __s, size_type __pos, size_type __n)
const
933 __glibcxx_check_string(__s);
938 find_first_of(
const _CharT* __s, size_type __pos = 0)
const
940 __glibcxx_check_string(__s);
945 find_first_of(_CharT __c, size_type __pos = 0)
const _GLIBCXX_NOEXCEPT
949 find_last_of(
const basic_string& __str,
950 size_type __pos =
_Base::npos)
const _GLIBCXX_NOEXCEPT
954 find_last_of(
const _CharT* __s, size_type __pos, size_type __n)
const
956 __glibcxx_check_string(__s);
961 find_last_of(
const _CharT* __s, size_type __pos =
_Base::npos)
const
963 __glibcxx_check_string(__s);
968 find_last_of(_CharT __c, size_type __pos =
_Base::npos)
const
973 find_first_not_of(
const basic_string& __str, size_type __pos = 0)
const
978 find_first_not_of(
const _CharT* __s, size_type __pos, size_type __n)
const
980 __glibcxx_check_string_len(__s, __n);
985 find_first_not_of(
const _CharT* __s, size_type __pos = 0)
const
987 __glibcxx_check_string(__s);
992 find_first_not_of(_CharT __c, size_type __pos = 0)
const _GLIBCXX_NOEXCEPT
996 find_last_not_of(
const basic_string& __str,
1002 find_last_not_of(
const _CharT* __s, size_type __pos, size_type __n)
const
1004 __glibcxx_check_string(__s);
1009 find_last_not_of(
const _CharT* __s, size_type __pos =
_Base::npos)
const
1011 __glibcxx_check_string(__s);
1016 find_last_not_of(_CharT __c, size_type __pos =
_Base::npos)
const
1021 substr(size_type __pos = 0, size_type __n =
_Base::npos)
const
1025 compare(
const basic_string& __str)
const
1029 compare(size_type __pos1, size_type __n1,
1030 const basic_string& __str)
const
1034 compare(size_type __pos1, size_type __n1,
const basic_string& __str,
1035 size_type __pos2, size_type __n2)
const
1039 compare(
const _CharT* __s)
const
1041 __glibcxx_check_string(__s);
1048 compare(size_type __pos1, size_type __n1,
const _CharT* __s)
const
1050 __glibcxx_check_string(__s);
1057 compare(size_type __pos1, size_type __n1,
const _CharT* __s,
1058 size_type __n2)
const
1060 __glibcxx_check_string_len(__s, __n2);
1065 _M_base() _GLIBCXX_NOEXCEPT {
return *
this; }
1068 _M_base()
const _GLIBCXX_NOEXCEPT {
return *
this; }