1 // Debugging string implementation -*- C++ -*-
4 // Free Software Foundation, Inc.
6 // This file is part of the GNU ISO C++ Library. This library is free
7 // software; you can redistribute it and/or modify it under the
8 // terms of the GNU General Public License as published by the
9 // Free Software Foundation; either version 2, or (at your option)
12 // This library is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
17 // You should have received a copy of the GNU General Public License along
18 // with this library; see the file COPYING. If not, write to the Free
19 // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
22 // As a special exception, you may use this file as part of a free software
23 // library without restriction. Specifically, if other files instantiate
24 // templates or use macros or inline functions from this file, or you compile
25 // this file and link it with other files to produce an executable, this
26 // file does not by itself cause the resulting executable to be covered by
27 // the GNU General Public License. This exception does not however
28 // invalidate any other reasons why the executable file might be covered by
29 // the GNU General Public License.
31 #ifndef _GLIBCXX_DEBUG_STRING
32 #define _GLIBCXX_DEBUG_STRING 1
35 #include <debug/safe_sequence.h>
36 #include <debug/safe_iterator.h>
40 template<typename _CharT, typename _Traits, typename _Allocator>
42 : public std::basic_string<_CharT, _Traits, _Allocator>,
43 public __gnu_debug::_Safe_sequence<basic_string<_CharT, _Traits,
46 typedef std::basic_string<_CharT, _Traits, _Allocator> _Base;
47 typedef __gnu_debug::_Safe_sequence<basic_string> _Safe_base;
51 typedef _Traits traits_type;
52 typedef typename _Traits::char_type value_type;
53 typedef _Allocator allocator_type;
54 typedef typename _Allocator::size_type size_type;
55 typedef typename _Allocator::difference_type difference_type;
56 typedef typename _Allocator::reference reference;
57 typedef typename _Allocator::const_reference const_reference;
58 typedef typename _Allocator::pointer pointer;
59 typedef typename _Allocator::const_pointer const_pointer;
61 typedef __gnu_debug::_Safe_iterator<typename _Base::iterator, basic_string>
63 typedef __gnu_debug::_Safe_iterator<typename _Base::const_iterator,
64 basic_string> const_iterator;
66 typedef std::reverse_iterator<iterator> reverse_iterator;
67 typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
71 // 21.3.1 construct/copy/destroy:
72 explicit basic_string(const _Allocator& __a = _Allocator())
76 // Provides conversion from a release-mode string to a debug-mode string
77 basic_string(const _Base& __base) : _Base(__base), _Safe_base() { }
79 // _GLIBCXX_RESOLVE_LIB_DEFECTS
80 // 42. string ctors specify wrong default allocator
81 basic_string(const basic_string& __str)
82 : _Base(__str, 0, _Base::npos, __str.get_allocator()), _Safe_base()
85 // _GLIBCXX_RESOLVE_LIB_DEFECTS
86 // 42. string ctors specify wrong default allocator
87 basic_string(const basic_string& __str, size_type __pos,
88 size_type __n = _Base::npos,
89 const _Allocator& __a = _Allocator())
90 : _Base(__str, __pos, __n, __a)
93 basic_string(const _CharT* __s, size_type __n,
94 const _Allocator& __a = _Allocator())
95 : _Base(__gnu_debug::__check_string(__s, __n), __n, __a)
98 basic_string(const _CharT* __s, const _Allocator& __a = _Allocator())
99 : _Base(__gnu_debug::__check_string(__s), __a)
100 { this->assign(__s); }
102 basic_string(size_type __n, _CharT __c,
103 const _Allocator& __a = _Allocator())
104 : _Base(__n, __c, __a)
107 template<typename _InputIterator>
108 basic_string(_InputIterator __begin, _InputIterator __end,
109 const _Allocator& __a = _Allocator())
110 : _Base(__gnu_debug::__check_valid_range(__begin, __end), __end, __a)
116 operator=(const basic_string& __str)
118 *static_cast<_Base*>(this) = __str;
119 this->_M_invalidate_all();
124 operator=(const _CharT* __s)
126 __glibcxx_check_string(__s);
127 *static_cast<_Base*>(this) = __s;
128 this->_M_invalidate_all();
133 operator=(_CharT __c)
135 *static_cast<_Base*>(this) = __c;
136 this->_M_invalidate_all();
143 { return iterator(_Base::begin(), this); }
147 { return const_iterator(_Base::begin(), this); }
151 { return iterator(_Base::end(), this); }
155 { return const_iterator(_Base::end(), this); }
159 { return reverse_iterator(end()); }
161 const_reverse_iterator
163 { return const_reverse_iterator(end()); }
167 { return reverse_iterator(begin()); }
169 const_reverse_iterator
171 { return const_reverse_iterator(begin()); }
176 using _Base::max_size;
179 resize(size_type __n, _CharT __c)
181 _Base::resize(__n, __c);
182 this->_M_invalidate_all();
186 resize(size_type __n)
187 { this->resize(__n, _CharT()); }
189 using _Base::capacity;
190 using _Base::reserve;
196 this->_M_invalidate_all();
201 // 21.3.4 element access:
203 operator[](size_type __pos) const
205 _GLIBCXX_DEBUG_VERIFY(__pos <= this->size(),
206 _M_message(::__gnu_debug::__msg_subscript_oob)
207 ._M_sequence(*this, "this")
208 ._M_integer(__pos, "__pos")
209 ._M_integer(this->size(), "size"));
210 return _M_base()[__pos];
214 operator[](size_type __pos)
216 __glibcxx_check_subscript(__pos);
217 return _M_base()[__pos];
224 operator+=(const basic_string& __str)
227 this->_M_invalidate_all();
232 operator+=(const _CharT* __s)
234 __glibcxx_check_string(__s);
236 this->_M_invalidate_all();
241 operator+=(_CharT __c)
244 this->_M_invalidate_all();
249 append(const basic_string& __str)
251 _Base::append(__str);
252 this->_M_invalidate_all();
257 append(const basic_string& __str, size_type __pos, size_type __n)
259 _Base::append(__str, __pos, __n);
260 this->_M_invalidate_all();
265 append(const _CharT* __s, size_type __n)
267 __glibcxx_check_string_len(__s, __n);
268 _Base::append(__s, __n);
269 this->_M_invalidate_all();
274 append(const _CharT* __s)
276 __glibcxx_check_string(__s);
278 this->_M_invalidate_all();
283 append(size_type __n, _CharT __c)
285 _Base::append(__n, __c);
286 this->_M_invalidate_all();
290 template<typename _InputIterator>
292 append(_InputIterator __first, _InputIterator __last)
294 __glibcxx_check_valid_range(__first, __last);
295 _Base::append(__first, __last);
296 this->_M_invalidate_all();
300 // _GLIBCXX_RESOLVE_LIB_DEFECTS
301 // 7. string clause minor problems
303 push_back(_CharT __c)
305 _Base::push_back(__c);
306 this->_M_invalidate_all();
310 assign(const basic_string& __x)
313 this->_M_invalidate_all();
318 assign(const basic_string& __str, size_type __pos, size_type __n)
320 _Base::assign(__str, __pos, __n);
321 this->_M_invalidate_all();
326 assign(const _CharT* __s, size_type __n)
328 __glibcxx_check_string_len(__s, __n);
329 _Base::assign(__s, __n);
330 this->_M_invalidate_all();
335 assign(const _CharT* __s)
337 __glibcxx_check_string(__s);
339 this->_M_invalidate_all();
344 assign(size_type __n, _CharT __c)
346 _Base::assign(__n, __c);
347 this->_M_invalidate_all();
351 template<typename _InputIterator>
353 assign(_InputIterator __first, _InputIterator __last)
355 __glibcxx_check_valid_range(__first, __last);
356 _Base::assign(__first, __last);
357 this->_M_invalidate_all();
362 insert(size_type __pos1, const basic_string& __str)
364 _Base::insert(__pos1, __str);
365 this->_M_invalidate_all();
370 insert(size_type __pos1, const basic_string& __str,
371 size_type __pos2, size_type __n)
373 _Base::insert(__pos1, __str, __pos2, __n);
374 this->_M_invalidate_all();
379 insert(size_type __pos, const _CharT* __s, size_type __n)
381 __glibcxx_check_string(__s);
382 _Base::insert(__pos, __s, __n);
383 this->_M_invalidate_all();
388 insert(size_type __pos, const _CharT* __s)
390 __glibcxx_check_string(__s);
391 _Base::insert(__pos, __s);
392 this->_M_invalidate_all();
397 insert(size_type __pos, size_type __n, _CharT __c)
399 _Base::insert(__pos, __n, __c);
400 this->_M_invalidate_all();
405 insert(iterator __p, _CharT __c)
407 __glibcxx_check_insert(__p);
408 typename _Base::iterator __res = _Base::insert(__p.base(), __c);
409 this->_M_invalidate_all();
410 return iterator(__res, this);
414 insert(iterator __p, size_type __n, _CharT __c)
416 __glibcxx_check_insert(__p);
417 _Base::insert(__p.base(), __n, __c);
418 this->_M_invalidate_all();
421 template<typename _InputIterator>
423 insert(iterator __p, _InputIterator __first, _InputIterator __last)
425 __glibcxx_check_insert_range(__p, __first, __last);
426 _Base::insert(__p.base(), __first, __last);
427 this->_M_invalidate_all();
431 erase(size_type __pos = 0, size_type __n = _Base::npos)
433 _Base::erase(__pos, __n);
434 this->_M_invalidate_all();
439 erase(iterator __position)
441 __glibcxx_check_erase(__position);
442 typename _Base::iterator __res = _Base::erase(__position.base());
443 this->_M_invalidate_all();
444 return iterator(__res, this);
448 erase(iterator __first, iterator __last)
450 // _GLIBCXX_RESOLVE_LIB_DEFECTS
451 // 151. can't currently clear() empty container
452 __glibcxx_check_erase_range(__first, __last);
453 typename _Base::iterator __res = _Base::erase(__first.base(),
455 this->_M_invalidate_all();
456 return iterator(__res, this);
460 replace(size_type __pos1, size_type __n1, const basic_string& __str)
462 _Base::replace(__pos1, __n1, __str);
463 this->_M_invalidate_all();
468 replace(size_type __pos1, size_type __n1, const basic_string& __str,
469 size_type __pos2, size_type __n2)
471 _Base::replace(__pos1, __n1, __str, __pos2, __n2);
472 this->_M_invalidate_all();
477 replace(size_type __pos, size_type __n1, const _CharT* __s,
480 __glibcxx_check_string_len(__s, __n2);
481 _Base::replace(__pos, __n1, __s, __n2);
482 this->_M_invalidate_all();
487 replace(size_type __pos, size_type __n1, const _CharT* __s)
489 __glibcxx_check_string(__s);
490 _Base::replace(__pos, __n1, __s);
491 this->_M_invalidate_all();
496 replace(size_type __pos, size_type __n1, size_type __n2, _CharT __c)
498 _Base::replace(__pos, __n1, __n2, __c);
499 this->_M_invalidate_all();
504 replace(iterator __i1, iterator __i2, const basic_string& __str)
506 __glibcxx_check_erase_range(__i1, __i2);
507 _Base::replace(__i1.base(), __i2.base(), __str);
508 this->_M_invalidate_all();
513 replace(iterator __i1, iterator __i2, const _CharT* __s, size_type __n)
515 __glibcxx_check_erase_range(__i1, __i2);
516 __glibcxx_check_string_len(__s, __n);
517 _Base::replace(__i1.base(), __i2.base(), __s, __n);
518 this->_M_invalidate_all();
523 replace(iterator __i1, iterator __i2, const _CharT* __s)
525 __glibcxx_check_erase_range(__i1, __i2);
526 __glibcxx_check_string(__s);
527 _Base::replace(__i1.base(), __i2.base(), __s);
528 this->_M_invalidate_all();
533 replace(iterator __i1, iterator __i2, size_type __n, _CharT __c)
535 __glibcxx_check_erase_range(__i1, __i2);
536 _Base::replace(__i1.base(), __i2.base(), __n, __c);
537 this->_M_invalidate_all();
541 template<typename _InputIterator>
543 replace(iterator __i1, iterator __i2,
544 _InputIterator __j1, _InputIterator __j2)
546 __glibcxx_check_erase_range(__i1, __i2);
547 __glibcxx_check_valid_range(__j1, __j2);
548 _Base::replace(__i1.base(), __i2.base(), __j1, __j2);
549 this->_M_invalidate_all();
554 copy(_CharT* __s, size_type __n, size_type __pos = 0) const
556 __glibcxx_check_string_len(__s, __n);
557 return _Base::copy(__s, __n, __pos);
561 swap(basic_string<_CharT,_Traits,_Allocator>& __x)
565 this->_M_invalidate_all();
566 __x._M_invalidate_all();
569 // 21.3.6 string operations:
573 const _CharT* __res = _Base::c_str();
574 this->_M_invalidate_all();
581 const _CharT* __res = _Base::data();
582 this->_M_invalidate_all();
586 using _Base::get_allocator;
589 find(const basic_string& __str, size_type __pos = 0) const
590 { return _Base::find(__str, __pos); }
593 find(const _CharT* __s, size_type __pos, size_type __n) const
595 __glibcxx_check_string(__s);
596 return _Base::find(__s, __pos, __n);
600 find(const _CharT* __s, size_type __pos = 0) const
602 __glibcxx_check_string(__s);
603 return _Base::find(__s, __pos);
607 find(_CharT __c, size_type __pos = 0) const
608 { return _Base::find(__c, __pos); }
611 rfind(const basic_string& __str, size_type __pos = _Base::npos) const
612 { return _Base::rfind(__str, __pos); }
615 rfind(const _CharT* __s, size_type __pos, size_type __n) const
617 __glibcxx_check_string_len(__s, __n);
618 return _Base::rfind(__s, __pos, __n);
622 rfind(const _CharT* __s, size_type __pos = _Base::npos) const
624 __glibcxx_check_string(__s);
625 return _Base::rfind(__s, __pos);
629 rfind(_CharT __c, size_type __pos = _Base::npos) const
630 { return _Base::rfind(__c, __pos); }
633 find_first_of(const basic_string& __str, size_type __pos = 0) const
634 { return _Base::find_first_of(__str, __pos); }
637 find_first_of(const _CharT* __s, size_type __pos, size_type __n) const
639 __glibcxx_check_string(__s);
640 return _Base::find_first_of(__s, __pos, __n);
644 find_first_of(const _CharT* __s, size_type __pos = 0) const
646 __glibcxx_check_string(__s);
647 return _Base::find_first_of(__s, __pos);
651 find_first_of(_CharT __c, size_type __pos = 0) const
652 { return _Base::find_first_of(__c, __pos); }
655 find_last_of(const basic_string& __str, size_type __pos = _Base::npos) const
656 { return _Base::find_last_of(__str, __pos); }
659 find_last_of(const _CharT* __s, size_type __pos, size_type __n) const
661 __glibcxx_check_string(__s);
662 return _Base::find_last_of(__s, __pos, __n);
666 find_last_of(const _CharT* __s, size_type __pos = _Base::npos) const
668 __glibcxx_check_string(__s);
669 return _Base::find_last_of(__s, __pos);
673 find_last_of(_CharT __c, size_type __pos = _Base::npos) const
674 { return _Base::find_last_of(__c, __pos); }
677 find_first_not_of(const basic_string& __str, size_type __pos = 0) const
678 { return _Base::find_first_not_of(__str, __pos); }
681 find_first_not_of(const _CharT* __s, size_type __pos, size_type __n) const
683 __glibcxx_check_string_len(__s, __n);
684 return _Base::find_first_not_of(__s, __pos, __n);
688 find_first_not_of(const _CharT* __s, size_type __pos = 0) const
690 __glibcxx_check_string(__s);
691 return _Base::find_first_not_of(__s, __pos);
695 find_first_not_of(_CharT __c, size_type __pos = 0) const
696 { return _Base::find_first_not_of(__c, __pos); }
699 find_last_not_of(const basic_string& __str,
700 size_type __pos = _Base::npos) const
701 { return _Base::find_last_not_of(__str, __pos); }
704 find_last_not_of(const _CharT* __s, size_type __pos, size_type __n) const
706 __glibcxx_check_string(__s);
707 return _Base::find_last_not_of(__s, __pos, __n);
711 find_last_not_of(const _CharT* __s, size_type __pos = _Base::npos) const
713 __glibcxx_check_string(__s);
714 return _Base::find_last_not_of(__s, __pos);
718 find_last_not_of(_CharT __c, size_type __pos = _Base::npos) const
719 { return _Base::find_last_not_of(__c, __pos); }
722 substr(size_type __pos = 0, size_type __n = _Base::npos) const
723 { return basic_string(_Base::substr(__pos, __n)); }
726 compare(const basic_string& __str) const
727 { return _Base::compare(__str); }
730 compare(size_type __pos1, size_type __n1,
731 const basic_string& __str) const
732 { return _Base::compare(__pos1, __n1, __str); }
735 compare(size_type __pos1, size_type __n1, const basic_string& __str,
736 size_type __pos2, size_type __n2) const
737 { return _Base::compare(__pos1, __n1, __str, __pos2, __n2); }
740 compare(const _CharT* __s) const
742 __glibcxx_check_string(__s);
743 return _Base::compare(__s);
746 // _GLIBCXX_RESOLVE_LIB_DEFECTS
747 // 5. string::compare specification questionable
749 compare(size_type __pos1, size_type __n1, const _CharT* __s) const
751 __glibcxx_check_string(__s);
752 return _Base::compare(__pos1, __n1, __s);
755 // _GLIBCXX_RESOLVE_LIB_DEFECTS
756 // 5. string::compare specification questionable
758 compare(size_type __pos1, size_type __n1,const _CharT* __s,
759 size_type __n2) const
761 __glibcxx_check_string_len(__s, __n2);
762 return _Base::compare(__pos1, __n1, __s, __n2);
766 _M_base() { return *this; }
769 _M_base() const { return *this; }
771 using _Safe_base::_M_invalidate_all;
774 template<typename _CharT, typename _Traits, typename _Allocator>
775 inline basic_string<_CharT,_Traits,_Allocator>
776 operator+(const basic_string<_CharT,_Traits,_Allocator>& __lhs,
777 const basic_string<_CharT,_Traits,_Allocator>& __rhs)
778 { return basic_string<_CharT,_Traits,_Allocator>(__lhs) += __rhs; }
780 template<typename _CharT, typename _Traits, typename _Allocator>
781 inline basic_string<_CharT,_Traits,_Allocator>
782 operator+(const _CharT* __lhs,
783 const basic_string<_CharT,_Traits,_Allocator>& __rhs)
785 __glibcxx_check_string(__lhs);
786 return basic_string<_CharT,_Traits,_Allocator>(__lhs) += __rhs;
789 template<typename _CharT, typename _Traits, typename _Allocator>
790 inline basic_string<_CharT,_Traits,_Allocator>
791 operator+(_CharT __lhs,
792 const basic_string<_CharT,_Traits,_Allocator>& __rhs)
793 { return basic_string<_CharT,_Traits,_Allocator>(1, __lhs) += __rhs; }
795 template<typename _CharT, typename _Traits, typename _Allocator>
796 inline basic_string<_CharT,_Traits,_Allocator>
797 operator+(const basic_string<_CharT,_Traits,_Allocator>& __lhs,
800 __glibcxx_check_string(__rhs);
801 return basic_string<_CharT,_Traits,_Allocator>(__lhs) += __rhs;
804 template<typename _CharT, typename _Traits, typename _Allocator>
805 inline basic_string<_CharT,_Traits,_Allocator>
806 operator+(const basic_string<_CharT,_Traits,_Allocator>& __lhs,
808 { return basic_string<_CharT,_Traits,_Allocator>(__lhs) += __rhs; }
810 template<typename _CharT, typename _Traits, typename _Allocator>
812 operator==(const basic_string<_CharT,_Traits,_Allocator>& __lhs,
813 const basic_string<_CharT,_Traits,_Allocator>& __rhs)
814 { return __lhs._M_base() == __rhs._M_base(); }
816 template<typename _CharT, typename _Traits, typename _Allocator>
818 operator==(const _CharT* __lhs,
819 const basic_string<_CharT,_Traits,_Allocator>& __rhs)
821 __glibcxx_check_string(__lhs);
822 return __lhs == __rhs._M_base();
825 template<typename _CharT, typename _Traits, typename _Allocator>
827 operator==(const basic_string<_CharT,_Traits,_Allocator>& __lhs,
830 __glibcxx_check_string(__rhs);
831 return __lhs._M_base() == __rhs;
834 template<typename _CharT, typename _Traits, typename _Allocator>
836 operator!=(const basic_string<_CharT,_Traits,_Allocator>& __lhs,
837 const basic_string<_CharT,_Traits,_Allocator>& __rhs)
838 { return __lhs._M_base() != __rhs._M_base(); }
840 template<typename _CharT, typename _Traits, typename _Allocator>
842 operator!=(const _CharT* __lhs,
843 const basic_string<_CharT,_Traits,_Allocator>& __rhs)
845 __glibcxx_check_string(__lhs);
846 return __lhs != __rhs._M_base();
849 template<typename _CharT, typename _Traits, typename _Allocator>
851 operator!=(const basic_string<_CharT,_Traits,_Allocator>& __lhs,
854 __glibcxx_check_string(__rhs);
855 return __lhs._M_base() != __rhs;
858 template<typename _CharT, typename _Traits, typename _Allocator>
860 operator<(const basic_string<_CharT,_Traits,_Allocator>& __lhs,
861 const basic_string<_CharT,_Traits,_Allocator>& __rhs)
862 { return __lhs._M_base() < __rhs._M_base(); }
864 template<typename _CharT, typename _Traits, typename _Allocator>
866 operator<(const _CharT* __lhs,
867 const basic_string<_CharT,_Traits,_Allocator>& __rhs)
869 __glibcxx_check_string(__lhs);
870 return __lhs < __rhs._M_base();
873 template<typename _CharT, typename _Traits, typename _Allocator>
875 operator<(const basic_string<_CharT,_Traits,_Allocator>& __lhs,
878 __glibcxx_check_string(__rhs);
879 return __lhs._M_base() < __rhs;
882 template<typename _CharT, typename _Traits, typename _Allocator>
884 operator<=(const basic_string<_CharT,_Traits,_Allocator>& __lhs,
885 const basic_string<_CharT,_Traits,_Allocator>& __rhs)
886 { return __lhs._M_base() <= __rhs._M_base(); }
888 template<typename _CharT, typename _Traits, typename _Allocator>
890 operator<=(const _CharT* __lhs,
891 const basic_string<_CharT,_Traits,_Allocator>& __rhs)
893 __glibcxx_check_string(__lhs);
894 return __lhs <= __rhs._M_base();
897 template<typename _CharT, typename _Traits, typename _Allocator>
899 operator<=(const basic_string<_CharT,_Traits,_Allocator>& __lhs,
902 __glibcxx_check_string(__rhs);
903 return __lhs._M_base() <= __rhs;
906 template<typename _CharT, typename _Traits, typename _Allocator>
908 operator>=(const basic_string<_CharT,_Traits,_Allocator>& __lhs,
909 const basic_string<_CharT,_Traits,_Allocator>& __rhs)
910 { return __lhs._M_base() >= __rhs._M_base(); }
912 template<typename _CharT, typename _Traits, typename _Allocator>
914 operator>=(const _CharT* __lhs,
915 const basic_string<_CharT,_Traits,_Allocator>& __rhs)
917 __glibcxx_check_string(__lhs);
918 return __lhs >= __rhs._M_base();
921 template<typename _CharT, typename _Traits, typename _Allocator>
923 operator>=(const basic_string<_CharT,_Traits,_Allocator>& __lhs,
926 __glibcxx_check_string(__rhs);
927 return __lhs._M_base() >= __rhs;
930 template<typename _CharT, typename _Traits, typename _Allocator>
932 operator>(const basic_string<_CharT,_Traits,_Allocator>& __lhs,
933 const basic_string<_CharT,_Traits,_Allocator>& __rhs)
934 { return __lhs._M_base() > __rhs._M_base(); }
936 template<typename _CharT, typename _Traits, typename _Allocator>
938 operator>(const _CharT* __lhs,
939 const basic_string<_CharT,_Traits,_Allocator>& __rhs)
941 __glibcxx_check_string(__lhs);
942 return __lhs > __rhs._M_base();
945 template<typename _CharT, typename _Traits, typename _Allocator>
947 operator>(const basic_string<_CharT,_Traits,_Allocator>& __lhs,
950 __glibcxx_check_string(__rhs);
951 return __lhs._M_base() > __rhs;
955 template<typename _CharT, typename _Traits, typename _Allocator>
957 swap(basic_string<_CharT,_Traits,_Allocator>& __lhs,
958 basic_string<_CharT,_Traits,_Allocator>& __rhs)
959 { __lhs.swap(__rhs); }
961 template<typename _CharT, typename _Traits, typename _Allocator>
962 std::basic_ostream<_CharT, _Traits>&
963 operator<<(std::basic_ostream<_CharT, _Traits>& __os,
964 const basic_string<_CharT, _Traits, _Allocator>& __str)
965 { return __os << __str._M_base(); }
967 template<typename _CharT, typename _Traits, typename _Allocator>
968 std::basic_istream<_CharT,_Traits>&
969 operator>>(std::basic_istream<_CharT,_Traits>& __is,
970 basic_string<_CharT,_Traits,_Allocator>& __str)
972 std::basic_istream<_CharT,_Traits>& __res = __is >> __str._M_base();
973 __str._M_invalidate_all();
977 template<typename _CharT, typename _Traits, typename _Allocator>
978 std::basic_istream<_CharT,_Traits>&
979 getline(std::basic_istream<_CharT,_Traits>& __is,
980 basic_string<_CharT,_Traits,_Allocator>& __str, _CharT __delim)
982 std::basic_istream<_CharT,_Traits>& __res = getline(__is,
985 __str._M_invalidate_all();
989 template<typename _CharT, typename _Traits, typename _Allocator>
990 std::basic_istream<_CharT,_Traits>&
991 getline(std::basic_istream<_CharT,_Traits>& __is,
992 basic_string<_CharT,_Traits,_Allocator>& __str)
994 std::basic_istream<_CharT,_Traits>& __res = getline(__is,
996 __str._M_invalidate_all();
999 } // namespace __gnu_debug