46 #pragma GCC system_header 
   55 #include <bits/gthr.h> 
   56 #include <tr1/functional> 
   59 #   define __GC_CONST const 
   61 #   define __GC_CONST   // constant except for deallocation 
   66 namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
 
   70     enum { _S_max_rope_depth = 45 };
 
   71     enum _Tag {_S_leaf, _S_concat, _S_substringfn, _S_function};
 
   79 _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
   82   template<
typename _ForwardIterator, 
typename _Allocator>
 
   84     _Destroy_const(_ForwardIterator __first,
 
   85            _ForwardIterator __last, _Allocator __alloc)
 
   87       for (; __first != __last; ++__first)
 
   88     __alloc.destroy(&*__first);
 
   91   template<
typename _ForwardIterator, 
typename _Tp>
 
   93     _Destroy_const(_ForwardIterator __first,
 
   94            _ForwardIterator __last, allocator<_Tp>)
 
  102   template <
class _CharT>
 
  109   template <
class _CharT>
 
  111     _S_is_basic_char_type(_CharT*)
 
  114   template <
class _CharT>
 
  116     _S_is_one_byte_char_type(_CharT*)
 
  120   _S_is_basic_char_type(
char*)
 
  124   _S_is_one_byte_char_type(
char*)
 
  128   _S_is_basic_char_type(
wchar_t*)
 
  133   template <
class _CharT>
 
  135     _S_cond_store_eos(_CharT&) { }
 
  138   _S_cond_store_eos(
char& __c)
 
  142   _S_cond_store_eos(
wchar_t& __c)
 
  149   template <
class _CharT>
 
  153       virtual ~char_producer() { };
 
  156       operator()(
size_t __start_pos, 
size_t __len,
 
  157          _CharT* __buffer) = 0;
 
  178   template<
class _Sequence, 
size_t _Buf_sz = 100>
 
  179     class sequence_buffer
 
  180     : 
public std::iterator<std::output_iterator_tag, void, void, void, void>
 
  183       typedef typename _Sequence::value_type value_type;
 
  185       _Sequence* _M_prefix;
 
  186       value_type _M_buffer[_Buf_sz];
 
  193     _M_prefix->append(_M_buffer, _M_buffer + _M_buf_count);
 
  201       : _M_prefix(0), _M_buf_count(0) { }
 
  203       sequence_buffer(
const sequence_buffer& __x)
 
  205     _M_prefix = __x._M_prefix;
 
  206     _M_buf_count = __x._M_buf_count;
 
  207     std::copy(__x._M_buffer, __x._M_buffer + __x._M_buf_count, _M_buffer);
 
  210       sequence_buffer(sequence_buffer& __x)
 
  213     _M_prefix = __x._M_prefix;
 
  217       sequence_buffer(_Sequence& __s)
 
  218       : _M_prefix(&__s), _M_buf_count(0) { }
 
  221       operator=(sequence_buffer& __x)
 
  224     _M_prefix = __x._M_prefix;
 
  230       operator=(
const sequence_buffer& __x)
 
  232     _M_prefix = __x._M_prefix;
 
  233     _M_buf_count = __x._M_buf_count;
 
  234     std::copy(__x._M_buffer, __x._M_buffer + __x._M_buf_count, _M_buffer);
 
  239       push_back(value_type __x)
 
  241     if (_M_buf_count < _Buf_sz)
 
  243         _M_buffer[_M_buf_count] = __x;
 
  255       append(value_type* __s, 
size_t __len)
 
  257     if (__len + _M_buf_count <= _Buf_sz)
 
  259         size_t __i = _M_buf_count;
 
  260         for (
size_t __j = 0; __j < __len; __i++, __j++)
 
  261           _M_buffer[__i] = __s[__j];
 
  262         _M_buf_count += __len;
 
  264     else if (0 == _M_buf_count)
 
  265       _M_prefix->append(__s, __s + __len);
 
  274       write(value_type* __s, 
size_t __len)
 
  288       operator=(
const value_type& __rhs)
 
  308   template<
class _CharT>
 
  309     class _Rope_char_consumer
 
  317       virtual ~_Rope_char_consumer() { };
 
  320       operator()(
const _CharT* __buffer, 
size_t __len) = 0;
 
  326   template<
class _CharT, 
class _Alloc = allocator<_CharT> >
 
  329   template<
class _CharT, 
class _Alloc>
 
  330     struct _Rope_RopeConcatenation;
 
  332   template<
class _CharT, 
class _Alloc>
 
  333     struct _Rope_RopeLeaf;
 
  335   template<
class _CharT, 
class _Alloc>
 
  336     struct _Rope_RopeFunction;
 
  338   template<
class _CharT, 
class _Alloc>
 
  339     struct _Rope_RopeSubstring;
 
  341   template<
class _CharT, 
class _Alloc>
 
  342     class _Rope_iterator;
 
  344   template<
class _CharT, 
class _Alloc>
 
  345     class _Rope_const_iterator;
 
  347   template<
class _CharT, 
class _Alloc>
 
  348     class _Rope_char_ref_proxy;
 
  350   template<
class _CharT, 
class _Alloc>
 
  351     class _Rope_char_ptr_proxy;
 
  353   template<
class _CharT, 
class _Alloc>
 
  355     operator==(
const _Rope_char_ptr_proxy<_CharT, _Alloc>& __x,
 
  356            const _Rope_char_ptr_proxy<_CharT, _Alloc>& __y);
 
  358   template<
class _CharT, 
class _Alloc>
 
  359     _Rope_const_iterator<_CharT, _Alloc>
 
  360     operator-(
const _Rope_const_iterator<_CharT, _Alloc>& __x,
 
  363   template<
class _CharT, 
class _Alloc>
 
  364     _Rope_const_iterator<_CharT, _Alloc>
 
  365     operator+(
const _Rope_const_iterator<_CharT, _Alloc>& __x,
 
  368   template<
class _CharT, 
class _Alloc>
 
  369     _Rope_const_iterator<_CharT, _Alloc>
 
  370     operator+(ptrdiff_t __n,
 
  371           const _Rope_const_iterator<_CharT, _Alloc>& __x);
 
  373   template<
class _CharT, 
class _Alloc>
 
  375     operator==(
const _Rope_const_iterator<_CharT, _Alloc>& __x,
 
  376            const _Rope_const_iterator<_CharT, _Alloc>& __y);
 
  378   template<
class _CharT, 
class _Alloc>
 
  380     operator<(const _Rope_const_iterator<_CharT, _Alloc>& __x,
 
  381           const _Rope_const_iterator<_CharT, _Alloc>& __y);
 
  383   template<
class _CharT, 
class _Alloc>
 
  385     operator-(
const _Rope_const_iterator<_CharT, _Alloc>& __x,
 
  386           const _Rope_const_iterator<_CharT, _Alloc>& __y);
 
  388   template<
class _CharT, 
class _Alloc>
 
  389     _Rope_iterator<_CharT, _Alloc>
 
  390     operator-(
const _Rope_iterator<_CharT, _Alloc>& __x, ptrdiff_t __n);
 
  392   template<
class _CharT, 
class _Alloc>
 
  393     _Rope_iterator<_CharT, _Alloc>
 
  394     operator+(
const _Rope_iterator<_CharT, _Alloc>& __x, ptrdiff_t __n);
 
  396   template<
class _CharT, 
class _Alloc>
 
  397     _Rope_iterator<_CharT, _Alloc>
 
  398     operator+(ptrdiff_t __n, 
const _Rope_iterator<_CharT, _Alloc>& __x);
 
  400   template<
class _CharT, 
class _Alloc>
 
  402     operator==(
const _Rope_iterator<_CharT, _Alloc>& __x,
 
  403            const _Rope_iterator<_CharT, _Alloc>& __y);
 
  405   template<
class _CharT, 
class _Alloc>
 
  407     operator<(const _Rope_iterator<_CharT, _Alloc>& __x,
 
  408           const _Rope_iterator<_CharT, _Alloc>& __y);
 
  410   template<
class _CharT, 
class _Alloc>
 
  412     operator-(
const _Rope_iterator<_CharT, _Alloc>& __x,
 
  413           const _Rope_iterator<_CharT, _Alloc>& __y);
 
  415   template<
class _CharT, 
class _Alloc>
 
  420   template<
class _CharT, 
class _Alloc>
 
  424   template<
class _CharT, 
class _Alloc>
 
  433   template<
class _CharT, 
class _Alloc>
 
  434     struct _Rope_Concat_fn
 
  436                   rope<_CharT, _Alloc> >
 
  441       { 
return __x + __y; }
 
  444   template <
class _CharT, 
class _Alloc>
 
  445     inline rope<_CharT, _Alloc>
 
  446     identity_element(_Rope_Concat_fn<_CharT, _Alloc>)
 
  447     { 
return rope<_CharT, _Alloc>(); }
 
  453   struct _Refcount_Base
 
  456     typedef size_t _RC_t;
 
  459     volatile _RC_t _M_ref_count;
 
  462 #ifdef __GTHREAD_MUTEX_INIT 
  463     __gthread_mutex_t _M_ref_count_lock = __GTHREAD_MUTEX_INIT;
 
  465     __gthread_mutex_t _M_ref_count_lock;
 
  468     _Refcount_Base(_RC_t __n) : _M_ref_count(__n)
 
  470 #ifndef __GTHREAD_MUTEX_INIT 
  471 #ifdef __GTHREAD_MUTEX_INIT_FUNCTION 
  472       __GTHREAD_MUTEX_INIT_FUNCTION (&_M_ref_count_lock);
 
  474 #error __GTHREAD_MUTEX_INIT or __GTHREAD_MUTEX_INIT_FUNCTION should be defined by gthr.h abstraction layer, report problem to libstdc++@gcc.gnu.org. 
  479 #ifndef __GTHREAD_MUTEX_INIT 
  481     { __gthread_mutex_destroy(&_M_ref_count_lock); }
 
  487       __gthread_mutex_lock(&_M_ref_count_lock);
 
  489       __gthread_mutex_unlock(&_M_ref_count_lock);
 
  495       __gthread_mutex_lock(&_M_ref_count_lock);
 
  496       volatile _RC_t __tmp = --_M_ref_count;
 
  497       __gthread_mutex_unlock(&_M_ref_count_lock);
 
  527 #define __ROPE_DEFINE_ALLOCS(__a) \ 
  528         __ROPE_DEFINE_ALLOC(_CharT,_Data)  \ 
  529         typedef _Rope_RopeConcatenation<_CharT,__a> __C; \ 
  530         __ROPE_DEFINE_ALLOC(__C,_C) \ 
  531         typedef _Rope_RopeLeaf<_CharT,__a> __L; \ 
  532         __ROPE_DEFINE_ALLOC(__L,_L) \ 
  533         typedef _Rope_RopeFunction<_CharT,__a> __F; \ 
  534         __ROPE_DEFINE_ALLOC(__F,_F) \ 
  535         typedef _Rope_RopeSubstring<_CharT,__a> __S; \ 
  536         __ROPE_DEFINE_ALLOC(__S,_S) 
  545 #define __STATIC_IF_SGI_ALLOC   
  547   template <
class _CharT, 
class _Alloc>
 
  548     struct _Rope_rep_base
 
  551       typedef _Alloc allocator_type;
 
  554       get_allocator()
 const 
  555       { 
return *
static_cast<const _Alloc*
>(
this); }
 
  559       { 
return *
static_cast<_Alloc*
>(
this); }
 
  561       const allocator_type&
 
  562       _M_get_allocator()
 const 
  563       { 
return *
static_cast<const _Alloc*
>(
this); }
 
  565       _Rope_rep_base(
size_t __size, 
const allocator_type&)
 
  566       : _M_size(__size) { }
 
  570 # define __ROPE_DEFINE_ALLOC(_Tp, __name) \ 
  572           _Alloc::template rebind<_Tp>::other __name##Alloc; \ 
  573         static _Tp* __name##_allocate(size_t __n) \ 
  574           { return __name##Alloc().allocate(__n); } \ 
  575         static void __name##_deallocate(_Tp *__p, size_t __n) \ 
  576           { __name##Alloc().deallocate(__p, __n); } 
  577       __ROPE_DEFINE_ALLOCS(_Alloc)
 
  578 # undef __ROPE_DEFINE_ALLOC 
  581   template<
class _CharT, 
class _Alloc>
 
  583     : 
public _Rope_rep_base<_CharT, _Alloc>
 
  589       __detail::_Tag _M_tag:8;
 
  590       bool _M_is_balanced:8;
 
  591       unsigned char _M_depth;
 
  592       __GC_CONST _CharT* _M_c_string;
 
  593 #ifdef __GTHREAD_MUTEX_INIT 
  594       __gthread_mutex_t _M_c_string_lock = __GTHREAD_MUTEX_INIT;
 
  596       __gthread_mutex_t _M_c_string_lock;
 
  604       typedef typename _Rope_rep_base<_CharT, _Alloc>::allocator_type
 
  607       using _Rope_rep_base<_CharT, _Alloc>::get_allocator;
 
  608       using _Rope_rep_base<_CharT, _Alloc>::_M_get_allocator;
 
  610       _Rope_RopeRep(__detail::_Tag __t, 
int __d, 
bool __b, 
size_t __size,
 
  611             const allocator_type& __a)
 
  612       : _Rope_rep_base<_CharT, _Alloc>(__size, __a),
 
  616     _M_tag(__t), _M_is_balanced(__b), _M_depth(__d), _M_c_string(0)
 
  617 #ifdef __GTHREAD_MUTEX_INIT
 
  620       { __GTHREAD_MUTEX_INIT_FUNCTION (&_M_c_string_lock); }
 
  622       { __gthread_mutex_destroy (&_M_c_string_lock); }
 
  629       _S_free_string(__GC_CONST _CharT*, 
size_t __len,
 
  630              allocator_type& __a);
 
  631 #define __STL_FREE_STRING(__s, __l, __a) _S_free_string(__s, __l, __a); 
  639       void _M_free_c_string();
 
  654       _S_unref(_Rope_RopeRep* __t)
 
  657       __t->_M_unref_nonnil();
 
  661       _S_ref(_Rope_RopeRep* __t)
 
  668       _S_free_if_unref(_Rope_RopeRep* __t)
 
  670     if (0 != __t && 0 == __t->_M_ref_count)
 
  674       void _M_unref_nonnil() { }
 
  675       void _M_ref_nonnil() { }
 
  676       static void _S_unref(_Rope_RopeRep*) { }
 
  677       static void _S_ref(_Rope_RopeRep*) { }
 
  678       static void _S_free_if_unref(_Rope_RopeRep*) { }
 
  682       operator=(
const _Rope_RopeRep&);
 
  684       _Rope_RopeRep(
const _Rope_RopeRep&);
 
  687   template<
class _CharT, 
class _Alloc>
 
  688     struct _Rope_RopeLeaf
 
  689     : 
public _Rope_RopeRep<_CharT, _Alloc>
 
  696       enum { _S_alloc_granularity = 8 };
 
  699       _S_rounded_up_size(
size_t __n)
 
  701         size_t __size_with_eos;
 
  703         if (_S_is_basic_char_type((_CharT*)0))
 
  704       __size_with_eos = __n + 1;
 
  706       __size_with_eos = __n;
 
  708     return __size_with_eos;
 
  711     return ((__size_with_eos + 
size_t(_S_alloc_granularity) - 1)
 
  712         &~ (
size_t(_S_alloc_granularity) - 1));
 
  715       __GC_CONST _CharT* _M_data; 
 
  720       typedef typename _Rope_rep_base<_CharT,_Alloc>::allocator_type
 
  723       _Rope_RopeLeaf(__GC_CONST _CharT* __d, 
size_t __size,
 
  724              const allocator_type& __a)
 
  725       : _Rope_RopeRep<_CharT, _Alloc>(__detail::_S_leaf, 0, true,
 
  726                       __size, __a), _M_data(__d)
 
  728         if (_S_is_basic_char_type((_CharT *)0))
 
  731             this->_M_c_string = __d;
 
  738       ~_Rope_RopeLeaf() throw()
 
  740         if (_M_data != this->_M_c_string)
 
  741       this->_M_free_c_string();
 
  743     this->__STL_FREE_STRING(_M_data, this->_M_size, this->_M_get_allocator());
 
  748       operator=(
const _Rope_RopeLeaf&);
 
  750       _Rope_RopeLeaf(
const _Rope_RopeLeaf&);
 
  753   template<
class _CharT, 
class _Alloc>
 
  754     struct _Rope_RopeConcatenation
 
  755     : 
public _Rope_RopeRep<_CharT, _Alloc>
 
  758       _Rope_RopeRep<_CharT, _Alloc>* _M_left;
 
  759       _Rope_RopeRep<_CharT, _Alloc>* _M_right;
 
  761       typedef typename _Rope_rep_base<_CharT, _Alloc>::allocator_type
 
  764       _Rope_RopeConcatenation(_Rope_RopeRep<_CharT, _Alloc>* __l,
 
  765                   _Rope_RopeRep<_CharT, _Alloc>* __r,
 
  766                   const allocator_type& __a)
 
  767     : _Rope_RopeRep<_CharT, _Alloc>(__detail::_S_concat,
 
  768                       std::
max(__l->_M_depth,
 
  771                       __l->_M_size + __r->_M_size, __a),
 
  772         _M_left(__l), _M_right(__r)
 
  775       ~_Rope_RopeConcatenation() throw()
 
  777     this->_M_free_c_string();
 
  778     _M_left->_M_unref_nonnil();
 
  779     _M_right->_M_unref_nonnil();
 
  783       _Rope_RopeConcatenation&
 
  784       operator=(
const _Rope_RopeConcatenation&);
 
  786       _Rope_RopeConcatenation(
const _Rope_RopeConcatenation&);
 
  789   template<
class _CharT, 
class _Alloc>
 
  790     struct _Rope_RopeFunction
 
  791     : 
public _Rope_RopeRep<_CharT, _Alloc>
 
  794       char_producer<_CharT>* _M_fn;
 
  796       bool _M_delete_when_done; 
 
  807       _S_fn_finalization_proc(
void * __tree, 
void *)
 
  808       { 
delete ((_Rope_RopeFunction *)__tree) -> _M_fn; }
 
  810     typedef typename _Rope_rep_base<_CharT, _Alloc>::allocator_type
 
  813       _Rope_RopeFunction(char_producer<_CharT>* __f, 
size_t __size,
 
  814                         bool __d, 
const allocator_type& __a)
 
  815       : _Rope_RopeRep<_CharT, _Alloc>(__detail::_S_function, 0, true, __size, __a)
 
  818     , _M_delete_when_done(__d)
 
  824         GC_REGISTER_FINALIZER(
this, _Rope_RopeFunction::
 
  825                   _S_fn_finalization_proc, 0, 0, 0);
 
  830       ~_Rope_RopeFunction() throw()
 
  832     this->_M_free_c_string();
 
  833     if (_M_delete_when_done)
 
  839       operator=(
const _Rope_RopeFunction&);
 
  841       _Rope_RopeFunction(
const _Rope_RopeFunction&);
 
  850   template<
class _CharT, 
class _Alloc>
 
  851     struct _Rope_RopeSubstring
 
  852     : 
public _Rope_RopeFunction<_CharT, _Alloc>,
 
  853       public char_producer<_CharT>
 
  857       _Rope_RopeRep<_CharT,_Alloc>* _M_base;      
 
  861       operator()(
size_t __start_pos, 
size_t __req_len,
 
  864         switch(_M_base->_M_tag)
 
  866       case __detail::_S_function:
 
  867       case __detail::_S_substringfn:
 
  869           char_producer<_CharT>* __fn =
 
  870         ((_Rope_RopeFunction<_CharT,_Alloc>*)_M_base)->_M_fn;
 
  871           (*__fn)(__start_pos + _M_start, __req_len, __buffer);
 
  874       case __detail::_S_leaf:
 
  876           __GC_CONST _CharT* __s =
 
  877         ((_Rope_RopeLeaf<_CharT,_Alloc>*)_M_base)->_M_data;
 
  887       typedef typename _Rope_rep_base<_CharT, _Alloc>::allocator_type
 
  890       _Rope_RopeSubstring(_Rope_RopeRep<_CharT, _Alloc>* __b, 
size_t __s,
 
  891                           size_t __l, 
const allocator_type& __a)
 
  892       : _Rope_RopeFunction<_CharT, _Alloc>(this, __l, false, __a),
 
  893         char_producer<_CharT>(), _M_base(__b), _M_start(__s)
 
  896     _M_base->_M_ref_nonnil();
 
  898         this->_M_tag = __detail::_S_substringfn;
 
  900     virtual ~_Rope_RopeSubstring() throw()
 
  903     _M_base->_M_unref_nonnil();
 
  919   template<
class _CharT, 
class _Alloc>
 
  920     struct _Rope_self_destruct_ptr
 
  922       _Rope_RopeRep<_CharT, _Alloc>* _M_ptr;
 
  924       ~_Rope_self_destruct_ptr()
 
  925       { _Rope_RopeRep<_CharT, _Alloc>::_S_unref(_M_ptr); }
 
  927       _Rope_self_destruct_ptr() : _M_ptr(0) { };
 
  929       _Rope_self_destruct_ptr() { };
 
  931       _Rope_self_destruct_ptr(_Rope_RopeRep<_CharT, _Alloc>* __p)
 
  934       _Rope_RopeRep<_CharT, _Alloc>&
 
  938       _Rope_RopeRep<_CharT, _Alloc>*
 
  942       operator _Rope_RopeRep<_CharT, _Alloc>*()
 
  945       _Rope_self_destruct_ptr&
 
  946       operator=(_Rope_RopeRep<_CharT, _Alloc>* __x)
 
  947       { _M_ptr = __x; 
return *
this; }
 
  956   template<
class _CharT, 
class _Alloc>
 
  957     class _Rope_char_ref_proxy
 
  959       friend class rope<_CharT, _Alloc>;
 
  960       friend class _Rope_iterator<_CharT, _Alloc>;
 
  961       friend class _Rope_char_ptr_proxy<_CharT, _Alloc>;
 
  963       typedef _Rope_RopeRep<_CharT, _Alloc>* _Self_destruct_ptr;
 
  965       typedef _Rope_self_destruct_ptr<_CharT, _Alloc> _Self_destruct_ptr;
 
  967       typedef _Rope_RopeRep<_CharT, _Alloc> _RopeRep;
 
  968       typedef rope<_CharT, _Alloc> _My_rope;
 
  971       bool _M_current_valid;
 
  974       _Rope_char_ref_proxy(_My_rope* __r, 
size_t __p)
 
  975       :  _M_pos(__p), _M_current(), _M_current_valid(false), _M_root(__r) { }
 
  977       _Rope_char_ref_proxy(
const _Rope_char_ref_proxy& __x)
 
  978       : _M_pos(__x._M_pos), _M_current(__x._M_current), 
 
  979     _M_current_valid(false), _M_root(__x._M_root) { }
 
  985       _Rope_char_ref_proxy(_My_rope* __r, 
size_t __p, _CharT __c)
 
  986       : _M_pos(__p), _M_current(__c), _M_current_valid(true), _M_root(__r) { }
 
  988       inline operator _CharT () 
const;
 
  990       _Rope_char_ref_proxy&
 
  991       operator=(_CharT __c);
 
  993       _Rope_char_ptr_proxy<_CharT, _Alloc> 
operator&() 
const;
 
  995       _Rope_char_ref_proxy&
 
  996       operator=(
const _Rope_char_ref_proxy& __c)
 
  997       { 
return operator=((_CharT)__c); }
 
 1000   template<
class _CharT, 
class __Alloc>
 
 1002     swap(_Rope_char_ref_proxy <_CharT, __Alloc > __a,
 
 1003      _Rope_char_ref_proxy <_CharT, __Alloc > __b)
 
 1010   template<
class _CharT, 
class _Alloc>
 
 1011     class _Rope_char_ptr_proxy
 
 1014       friend class _Rope_char_ref_proxy<_CharT, _Alloc>;
 
 1016       rope<_CharT,_Alloc>* _M_root;     
 
 1018       _Rope_char_ptr_proxy(
const _Rope_char_ref_proxy<_CharT,_Alloc>& __x)
 
 1019       : _M_pos(__x._M_pos), _M_root(__x._M_root) { }
 
 1021       _Rope_char_ptr_proxy(
const _Rope_char_ptr_proxy& __x)
 
 1022       : _M_pos(__x._M_pos), _M_root(__x._M_root) { }
 
 1024       _Rope_char_ptr_proxy() { }
 
 1026       _Rope_char_ptr_proxy(_CharT* __x)
 
 1027       : _M_root(0), _M_pos(0) { }
 
 1029       _Rope_char_ptr_proxy&
 
 1030       operator=(
const _Rope_char_ptr_proxy& __x)
 
 1032         _M_pos = __x._M_pos;
 
 1033         _M_root = __x._M_root;
 
 1037       template<
class _CharT2, 
class _Alloc2>
 
 1039         operator==(
const _Rope_char_ptr_proxy<_CharT2, _Alloc2>& __x,
 
 1040            const _Rope_char_ptr_proxy<_CharT2, _Alloc2>& __y);
 
 1042       _Rope_char_ref_proxy<_CharT, _Alloc> operator*()
 const 
 1043       { 
return _Rope_char_ref_proxy<_CharT, _Alloc>(_M_root, _M_pos); }
 
 1055   template<
class _CharT, 
class _Alloc>
 
 1056     class _Rope_iterator_base
 
 1057     : 
public std::iterator<std::random_access_iterator_tag, _CharT>
 
 1059       friend class rope<_CharT, _Alloc>;
 
 1061       typedef _Alloc _allocator_type; 
 
 1062       typedef _Rope_RopeRep<_CharT, _Alloc> _RopeRep;
 
 1065       enum { _S_path_cache_len = 4 }; 
 
 1066       enum { _S_iterator_buf_len = 15 };
 
 1067       size_t _M_current_pos;
 
 1070       __GC_CONST _CharT* _M_buf_start;
 
 1073       __GC_CONST _CharT* _M_buf_ptr;
 
 1076       __GC_CONST _CharT* _M_buf_end;
 
 1082       const _RopeRep* _M_path_end[_S_path_cache_len];
 
 1086       unsigned char _M_path_directions;
 
 1091       _CharT _M_tmp_buf[_S_iterator_buf_len];
 
 1099       static void _S_setbuf(_Rope_iterator_base& __x);
 
 1102       static void _S_setcache(_Rope_iterator_base& __x);
 
 1105       static void _S_setcache_for_incr(_Rope_iterator_base& __x);
 
 1108       _Rope_iterator_base() { }
 
 1110       _Rope_iterator_base(_RopeRep* __root, 
size_t __pos)
 
 1111       : _M_current_pos(__pos), _M_root(__root), _M_buf_ptr(0) { }
 
 1113       void _M_incr(
size_t __n);
 
 1114       void _M_decr(
size_t __n);
 
 1118       { 
return _M_current_pos; }
 
 1120       _Rope_iterator_base(
const _Rope_iterator_base& __x)
 
 1122         if (0 != __x._M_buf_ptr)
 
 1126             _M_current_pos = __x._M_current_pos;
 
 1127             _M_root = __x._M_root;
 
 1133   template<
class _CharT, 
class _Alloc>
 
 1134     class _Rope_iterator;
 
 1136   template<
class _CharT, 
class _Alloc>
 
 1137     class _Rope_const_iterator
 
 1138     : 
public _Rope_iterator_base<_CharT, _Alloc>
 
 1140       friend class rope<_CharT, _Alloc>;
 
 1142       typedef _Rope_RopeRep<_CharT, _Alloc> _RopeRep;
 
 1144       _Rope_const_iterator(
const _RopeRep* __root, 
size_t __pos)
 
 1145       : _Rope_iterator_base<_CharT, _Alloc>(const_cast<_RopeRep*>(__root),
 
 1150       typedef _CharT reference;   
 
 1153       typedef const _CharT* pointer;
 
 1156       _Rope_const_iterator() { };
 
 1158       _Rope_const_iterator(
const _Rope_const_iterator& __x)
 
 1159       : _Rope_iterator_base<_CharT,_Alloc>(__x) { }
 
 1161       _Rope_const_iterator(
const _Rope_iterator<_CharT,_Alloc>& __x);
 
 1163       _Rope_const_iterator(
const rope<_CharT, _Alloc>& __r, 
size_t __pos)
 
 1164       : _Rope_iterator_base<_CharT,_Alloc>(__r._M_tree_ptr, __pos) { }
 
 1166       _Rope_const_iterator&
 
 1167       operator=(
const _Rope_const_iterator& __x)
 
 1169         if (0 != __x._M_buf_ptr)
 
 1170       *(
static_cast<_Rope_iterator_base<_CharT, _Alloc>*
>(
this)) = __x;
 
 1173             this->_M_current_pos = __x._M_current_pos;
 
 1174             this->_M_root = __x._M_root;
 
 1175             this->_M_buf_ptr = 0;
 
 1183         if (0 == this->_M_buf_ptr)
 
 1184       this->_S_setcache(*
this);
 
 1185         return *this->_M_buf_ptr;
 
 1193     return *
const_cast<_Rope_const_iterator&
>(*this);
 
 1196       _Rope_const_iterator&
 
 1199         __GC_CONST _CharT* __next;
 
 1200         if (0 != this->_M_buf_ptr
 
 1201         && (__next = this->_M_buf_ptr + 1) < this->_M_buf_end)
 
 1203             this->_M_buf_ptr = __next;
 
 1204             ++this->_M_current_pos;
 
 1211       _Rope_const_iterator&
 
 1212       operator+=(ptrdiff_t __n)
 
 1217       this->_M_decr(-__n);
 
 1221       _Rope_const_iterator&
 
 1228       _Rope_const_iterator&
 
 1229       operator-=(ptrdiff_t __n)
 
 1234       this->_M_incr(-__n);
 
 1238       _Rope_const_iterator
 
 1241         size_t __old_pos = this->_M_current_pos;
 
 1243         return _Rope_const_iterator<_CharT,_Alloc>(this->_M_root, __old_pos);
 
 1249       _Rope_const_iterator
 
 1252         size_t __old_pos = this->_M_current_pos;
 
 1254         return _Rope_const_iterator<_CharT,_Alloc>(this->_M_root, __old_pos);
 
 1257       template<
class _CharT2, 
class _Alloc2>
 
 1258         friend _Rope_const_iterator<_CharT2, _Alloc2>
 
 1259         operator-(
const _Rope_const_iterator<_CharT2, _Alloc2>& __x,
 
 1262       template<
class _CharT2, 
class _Alloc2>
 
 1263         friend _Rope_const_iterator<_CharT2, _Alloc2>
 
 1264         operator+(
const _Rope_const_iterator<_CharT2, _Alloc2>& __x,
 
 1267       template<
class _CharT2, 
class _Alloc2>
 
 1268         friend _Rope_const_iterator<_CharT2, _Alloc2>
 
 1269         operator+(ptrdiff_t __n,
 
 1270           const _Rope_const_iterator<_CharT2, _Alloc2>& __x);
 
 1274       { 
return rope<_CharT, _Alloc>::_S_fetch(this->_M_root,
 
 1275                           this->_M_current_pos + __n); }
 
 1277       template<
class _CharT2, 
class _Alloc2>
 
 1279         operator==(
const _Rope_const_iterator<_CharT2, _Alloc2>& __x,
 
 1280            const _Rope_const_iterator<_CharT2, _Alloc2>& __y);
 
 1282       template<
class _CharT2, 
class _Alloc2>
 
 1284         operator<(const _Rope_const_iterator<_CharT2, _Alloc2>& __x,
 
 1285           const _Rope_const_iterator<_CharT2, _Alloc2>& __y);
 
 1287       template<
class _CharT2, 
class _Alloc2>
 
 1289         operator-(
const _Rope_const_iterator<_CharT2, _Alloc2>& __x,
 
 1290           const _Rope_const_iterator<_CharT2, _Alloc2>& __y);
 
 1293   template<
class _CharT, 
class _Alloc>
 
 1294     class _Rope_iterator
 
 1295     : 
public _Rope_iterator_base<_CharT, _Alloc>
 
 1297       friend class rope<_CharT, _Alloc>;
 
 1299       typedef typename _Rope_iterator_base<_CharT, _Alloc>::_RopeRep _RopeRep;
 
 1300       rope<_CharT, _Alloc>* _M_root_rope;
 
 1308       _Rope_iterator(rope<_CharT, _Alloc>* __r, 
size_t __pos)
 
 1309       : _Rope_iterator_base<_CharT, _Alloc>(__r->_M_tree_ptr, __pos),
 
 1311       { _RopeRep::_S_ref(this->_M_root);
 
 1312         if (!(__r -> empty()))
 
 1313       this->_S_setcache(*
this);
 
 1318       typedef _Rope_char_ref_proxy<_CharT, _Alloc>  reference;
 
 1319       typedef _Rope_char_ref_proxy<_CharT, _Alloc>* pointer;
 
 1321       rope<_CharT, _Alloc>&
 
 1323       { 
return *_M_root_rope; }
 
 1330       _Rope_iterator(
const _Rope_iterator& __x)
 
 1331       : _Rope_iterator_base<_CharT, _Alloc>(__x)
 
 1333         _M_root_rope = __x._M_root_rope;
 
 1334         _RopeRep::_S_ref(this->_M_root);
 
 1337       _Rope_iterator(rope<_CharT, _Alloc>& __r, 
size_t __pos);
 
 1340       { _RopeRep::_S_unref(this->_M_root); }
 
 1343       operator=(
const _Rope_iterator& __x)
 
 1345         _RopeRep* __old = this->_M_root;
 
 1347         _RopeRep::_S_ref(__x._M_root);
 
 1348         if (0 != __x._M_buf_ptr)
 
 1350             _M_root_rope = __x._M_root_rope;
 
 1351             *(
static_cast<_Rope_iterator_base<_CharT, _Alloc>*
>(
this)) = __x;
 
 1355         this->_M_current_pos = __x._M_current_pos;
 
 1356             this->_M_root = __x._M_root;
 
 1357             _M_root_rope = __x._M_root_rope;
 
 1358             this->_M_buf_ptr = 0;
 
 1360         _RopeRep::_S_unref(__old);
 
 1368         if (0 == this->_M_buf_ptr)
 
 1369       return _Rope_char_ref_proxy<_CharT, _Alloc>(_M_root_rope,
 
 1370                               this->_M_current_pos);
 
 1372       return _Rope_char_ref_proxy<_CharT, _Alloc>(_M_root_rope,
 
 1373                               this->_M_current_pos,
 
 1381     return *
const_cast<_Rope_iterator&
>(*this);
 
 1392       operator+=(ptrdiff_t __n)
 
 1397       this->_M_decr(-__n);
 
 1409       operator-=(ptrdiff_t __n)
 
 1414       this->_M_incr(-__n);
 
 1421         size_t __old_pos = this->_M_current_pos;
 
 1423         return _Rope_iterator<_CharT,_Alloc>(_M_root_rope, __old_pos);
 
 1429         size_t __old_pos = this->_M_current_pos;
 
 1431         return _Rope_iterator<_CharT,_Alloc>(_M_root_rope, __old_pos);
 
 1436       { 
return _Rope_char_ref_proxy<_CharT, _Alloc>(_M_root_rope,
 
 1437                             this->_M_current_pos
 
 1440       template<
class _CharT2, 
class _Alloc2>
 
 1442         operator==(
const _Rope_iterator<_CharT2, _Alloc2>& __x,
 
 1443            const _Rope_iterator<_CharT2, _Alloc2>& __y);
 
 1445       template<
class _CharT2, 
class _Alloc2>
 
 1447         operator<(const _Rope_iterator<_CharT2, _Alloc2>& __x,
 
 1448           const _Rope_iterator<_CharT2, _Alloc2>& __y);
 
 1450       template<
class _CharT2, 
class _Alloc2>
 
 1452         operator-(
const _Rope_iterator<_CharT2, _Alloc2>& __x,
 
 1453           const _Rope_iterator<_CharT2, _Alloc2>& __y);
 
 1455       template<
class _CharT2, 
class _Alloc2>
 
 1456         friend _Rope_iterator<_CharT2, _Alloc2>
 
 1457         operator-(
const _Rope_iterator<_CharT2, _Alloc2>& __x, ptrdiff_t __n);
 
 1459       template<
class _CharT2, 
class _Alloc2>
 
 1460         friend _Rope_iterator<_CharT2, _Alloc2>
 
 1461         operator+(
const _Rope_iterator<_CharT2, _Alloc2>& __x, ptrdiff_t __n);
 
 1463       template<
class _CharT2, 
class _Alloc2>
 
 1464         friend _Rope_iterator<_CharT2, _Alloc2>
 
 1465         operator+(ptrdiff_t __n, 
const _Rope_iterator<_CharT2, _Alloc2>& __x);
 
 1469   template <
class _CharT, 
class _Alloc>
 
 1473       typedef _Alloc allocator_type;
 
 1476       get_allocator()
 const 
 1477       { 
return *
static_cast<const _Alloc*
>(
this); }
 
 1481       { 
return *
static_cast<_Alloc*
>(
this); }
 
 1483       const allocator_type&
 
 1484       _M_get_allocator()
 const 
 1485       { 
return *
static_cast<const _Alloc*
>(
this); }
 
 1487       typedef _Rope_RopeRep<_CharT, _Alloc> _RopeRep;
 
 1490       _Rope_base(_RopeRep* __t, 
const allocator_type&)
 
 1491       : _M_tree_ptr(__t) { }
 
 1493       _Rope_base(
const allocator_type&) { }
 
 1496       _RopeRep *_M_tree_ptr;
 
 1498 #define __ROPE_DEFINE_ALLOC(_Tp, __name) \ 
 1500           _Alloc::template rebind<_Tp>::other __name##Alloc; \ 
 1501         static _Tp* __name##_allocate(size_t __n) \ 
 1502           { return __name##Alloc().allocate(__n); } \ 
 1503         static void __name##_deallocate(_Tp *__p, size_t __n) \ 
 1504           { __name##Alloc().deallocate(__p, __n); } 
 1505       __ROPE_DEFINE_ALLOCS(_Alloc)
 
 1506 #undef __ROPE_DEFINE_ALLOC 
 1510       operator=(
const _Rope_base&);
 
 1512       _Rope_base(
const _Rope_base&);
 
 1520   template <
class _CharT, 
class _Alloc>
 
 1521     class rope : 
public _Rope_base<_CharT, _Alloc>
 
 1524       typedef _CharT value_type;
 
 1525       typedef ptrdiff_t difference_type;
 
 1526       typedef size_t size_type;
 
 1527       typedef _CharT const_reference;
 
 1528       typedef const _CharT* const_pointer;
 
 1529       typedef _Rope_iterator<_CharT, _Alloc> iterator;
 
 1530       typedef _Rope_const_iterator<_CharT, _Alloc> const_iterator;
 
 1531       typedef _Rope_char_ref_proxy<_CharT, _Alloc> reference;
 
 1532       typedef _Rope_char_ptr_proxy<_CharT, _Alloc> pointer;
 
 1534       friend class _Rope_iterator<_CharT, _Alloc>;
 
 1535       friend class _Rope_const_iterator<_CharT, _Alloc>;
 
 1536       friend struct _Rope_RopeRep<_CharT, _Alloc>;
 
 1537       friend class _Rope_iterator_base<_CharT, _Alloc>;
 
 1538       friend class _Rope_char_ptr_proxy<_CharT, _Alloc>;
 
 1539       friend class _Rope_char_ref_proxy<_CharT, _Alloc>;
 
 1540       friend struct _Rope_RopeSubstring<_CharT, _Alloc>;
 
 1543       typedef _Rope_base<_CharT, _Alloc> _Base;
 
 1544       typedef typename _Base::allocator_type allocator_type;
 
 1545       using _Base::_M_tree_ptr;
 
 1546       using _Base::get_allocator;
 
 1547       using _Base::_M_get_allocator;      
 
 1548       typedef __GC_CONST _CharT* _Cstrptr;
 
 1550       static _CharT _S_empty_c_str[1];
 
 1554       { 
return __c == _S_eos((_CharT*)0); }
 
 1556       enum { _S_copy_max = 23 };
 
 1560       typedef _Rope_RopeRep<_CharT, _Alloc> _RopeRep;
 
 1561       typedef _Rope_RopeConcatenation<_CharT, _Alloc> _RopeConcatenation;
 
 1562       typedef _Rope_RopeLeaf<_CharT, _Alloc> _RopeLeaf;
 
 1563       typedef _Rope_RopeFunction<_CharT, _Alloc> _RopeFunction;
 
 1564       typedef _Rope_RopeSubstring<_CharT, _Alloc> _RopeSubstring;
 
 1567       static _CharT _S_fetch(_RopeRep* __r, size_type __pos);
 
 1576       static _CharT* _S_fetch_ptr(_RopeRep* __r, size_type __pos);
 
 1581              _Rope_char_consumer<_CharT>& __c,
 
 1582              const _RopeRep* __r,
 
 1583              size_t __begin, 
size_t __end);
 
 1588       _S_unref(_RopeRep* __t)
 
 1589       { _RopeRep::_S_unref(__t); }
 
 1592       _S_ref(_RopeRep* __t)
 
 1593       { _RopeRep::_S_ref(__t); }
 
 1596       static void _S_unref(_RopeRep*) { }
 
 1597       static void _S_ref(_RopeRep*) { }
 
 1601       typedef _Rope_RopeRep<_CharT, _Alloc>* _Self_destruct_ptr;
 
 1603       typedef _Rope_self_destruct_ptr<_CharT, _Alloc> _Self_destruct_ptr;
 
 1607       static _RopeRep* _S_substring(_RopeRep* 
__base,
 
 1608                                     size_t __start, 
size_t __endp1);
 
 1610       static _RopeRep* _S_concat_char_iter(_RopeRep* __r,
 
 1611                        const _CharT* __iter, 
size_t __slen);
 
 1615       static _RopeRep* _S_destr_concat_char_iter(_RopeRep* __r,
 
 1616                          const _CharT* __iter,
 
 1623       { 
return _S_concat_char_iter(__r, __iter, __slen); }
 
 1628       static _RopeRep* _S_concat(_RopeRep* __left, _RopeRep* __right);
 
 1634       apply_to_pieces(
size_t __begin, 
size_t __end,
 
 1635               _Rope_char_consumer<_CharT>& __c)
 const 
 1636       { _S_apply_to_pieces(__c, this->_M_tree_ptr, __begin, __end); }
 
 1641       _S_rounded_up_size(
size_t __n)
 
 1642       { 
return _RopeLeaf::_S_rounded_up_size(__n); }
 
 1645       _S_allocated_capacity(
size_t __n)
 
 1647     if (_S_is_basic_char_type((_CharT*)0))
 
 1648       return _S_rounded_up_size(__n) - 1;
 
 1650       return _S_rounded_up_size(__n);
 
 1657       _S_new_RopeLeaf(__GC_CONST _CharT *__s,
 
 1658               size_t __size, allocator_type& __a)
 
 1660     _RopeLeaf* __space = 
typename _Base::_LAlloc(__a).allocate(1);
 
 1661     return new(__space) _RopeLeaf(__s, __size, __a);
 
 1664       static _RopeConcatenation*
 
 1665       _S_new_RopeConcatenation(_RopeRep* __left, _RopeRep* __right,
 
 1666                    allocator_type& __a)
 
 1668     _RopeConcatenation* __space = 
typename _Base::_CAlloc(__a).allocate(1);
 
 1669     return new(__space) _RopeConcatenation(__left, __right, __a);
 
 1672       static _RopeFunction*
 
 1673       _S_new_RopeFunction(char_producer<_CharT>* __f,
 
 1674               size_t __size, 
bool __d, allocator_type& __a)
 
 1676     _RopeFunction* __space = 
typename _Base::_FAlloc(__a).allocate(1);
 
 1677     return new(__space) _RopeFunction(__f, __size, __d, __a);
 
 1680       static _RopeSubstring*
 
 1681       _S_new_RopeSubstring(_Rope_RopeRep<_CharT,_Alloc>* __b, 
size_t __s,
 
 1682                size_t __l, allocator_type& __a)
 
 1684     _RopeSubstring* __space = 
typename _Base::_SAlloc(__a).allocate(1);
 
 1685     return new(__space) _RopeSubstring(__b, __s, __l, __a);
 
 1689       _S_RopeLeaf_from_unowned_char_ptr(
const _CharT *__s,
 
 1690                     size_t __size, allocator_type& __a)
 
 1691 #define __STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __size, __a) \ 
 1692                 _S_RopeLeaf_from_unowned_char_ptr(__s, __size, __a) 
 1696     _CharT* __buf = __a.allocate(_S_rounded_up_size(__size));
 
 1698     __uninitialized_copy_n_a(__s, __size, __buf, __a);
 
 1699     _S_cond_store_eos(__buf[__size]);
 
 1701       { 
return _S_new_RopeLeaf(__buf, __size, __a); }
 
 1704         _RopeRep::__STL_FREE_STRING(__buf, __size, __a);
 
 1705         __throw_exception_again;
 
 1716       _S_tree_concat(_RopeRep* __left, _RopeRep* __right);
 
 1720       _S_leaf_concat_char_iter(_RopeLeaf* __r,
 
 1721                    const _CharT* __iter, 
size_t __slen);
 
 1727       _S_destr_leaf_concat_char_iter(_RopeLeaf* __r,
 
 1728                      const _CharT* __iter, 
size_t __slen);
 
 1734       static size_t _S_char_ptr_len(
const _CharT* __s);
 
 1737       rope(_RopeRep* __t, 
const allocator_type& __a = allocator_type())
 
 1738       : _Base(__t, __a) { }
 
 1744       static _CharT* _S_flatten(_RopeRep* __r, _CharT* __buffer);
 
 1748       static _CharT* _S_flatten(_RopeRep* __r,
 
 1749                 size_t __start, 
size_t __len,
 
 1752       static const unsigned long 
 1753       _S_min_len[__detail::_S_max_rope_depth + 1];
 
 1756       _S_is_balanced(_RopeRep* __r)
 
 1757       { 
return (__r->_M_size >= _S_min_len[__r->_M_depth]); }
 
 1760       _S_is_almost_balanced(_RopeRep* __r)
 
 1761       { 
return (__r->_M_depth == 0
 
 1762         || __r->_M_size >= _S_min_len[__r->_M_depth - 1]); }
 
 1765       _S_is_roughly_balanced(_RopeRep* __r)
 
 1766       { 
return (__r->_M_depth <= 1
 
 1767         || __r->_M_size >= _S_min_len[__r->_M_depth - 2]); }
 
 1771       _S_concat_and_set_balanced(_RopeRep* __left, _RopeRep* __right)
 
 1773     _RopeRep* __result = _S_concat(__left, __right);
 
 1774     if (_S_is_balanced(__result))
 
 1775       __result->_M_is_balanced = 
true;
 
 1784       static _RopeRep* _S_balance(_RopeRep* __r);
 
 1788       static void _S_add_to_forest(_RopeRep*__r, _RopeRep** __forest);
 
 1791       static void _S_add_leaf_to_forest(_RopeRep* __r, _RopeRep** __forest);
 
 1794       static void _S_dump(_RopeRep* __r, 
int __indent = 0);
 
 1797       static int _S_compare(
const _RopeRep* __x, 
const _RopeRep* __y);
 
 1802       { 
return 0 == this->_M_tree_ptr; }
 
 1808       compare(
const rope& __y)
 const 
 1809       { 
return _S_compare(this->_M_tree_ptr, __y._M_tree_ptr); }
 
 1811       rope(
const _CharT* __s, 
const allocator_type& __a = allocator_type())
 
 1815       __STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, _S_char_ptr_len(__s),
 
 1816                        _M_get_allocator());
 
 1819       rope(
const _CharT* __s, 
size_t __len,
 
 1820        const allocator_type& __a = allocator_type())
 
 1824       __STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __len, _M_get_allocator());
 
 1830       rope(
const _CharT* __s, 
const _CharT* __e,
 
 1831        const allocator_type& __a = allocator_type())
 
 1835       __STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __e - __s, _M_get_allocator());
 
 1838       rope(
const const_iterator& __s, 
const const_iterator& __e,
 
 1839        const allocator_type& __a = allocator_type())
 
 1840       : _Base(_S_substring(__s._M_root, __s._M_current_pos,
 
 1841                __e._M_current_pos), __a)
 
 1844       rope(
const iterator& __s, 
const iterator& __e,
 
 1845        const allocator_type& __a = allocator_type())
 
 1846       : _Base(_S_substring(__s._M_root, __s._M_current_pos,
 
 1847                __e._M_current_pos), __a)
 
 1850       rope(_CharT __c, 
const allocator_type& __a = allocator_type())
 
 1853     _CharT* __buf = this->_Data_allocate(_S_rounded_up_size(1));
 
 1855     _M_get_allocator().construct(__buf, __c);
 
 1858         this->_M_tree_ptr = _S_new_RopeLeaf(__buf, 1,
 
 1859                         _M_get_allocator());
 
 1863         _RopeRep::__STL_FREE_STRING(__buf, 1, _M_get_allocator());
 
 1864         __throw_exception_again;
 
 1868       rope(
size_t __n, _CharT __c,
 
 1869        const allocator_type& __a = allocator_type());
 
 1871       rope(
const allocator_type& __a = allocator_type())
 
 1875       rope(char_producer<_CharT> *__fn, 
size_t __len, 
bool __delete_fn,
 
 1876        const allocator_type& __a = allocator_type())
 
 1879     this->_M_tree_ptr = (0 == __len) ?
 
 1880       0 : _S_new_RopeFunction(__fn, __len, __delete_fn, __a);
 
 1883       rope(
const rope& __x, 
const allocator_type& __a = allocator_type())
 
 1884       : _Base(__x._M_tree_ptr, __a)
 
 1885       { _S_ref(this->_M_tree_ptr); }
 
 1888       { _S_unref(this->_M_tree_ptr); }
 
 1891       operator=(
const rope& __x)
 
 1893     _RopeRep* __old = this->_M_tree_ptr;
 
 1894     this->_M_tree_ptr = __x._M_tree_ptr;
 
 1895     _S_ref(this->_M_tree_ptr);
 
 1903     _S_unref(this->_M_tree_ptr);
 
 1904     this->_M_tree_ptr = 0;
 
 1908       push_back(_CharT __x)
 
 1910     _RopeRep* __old = this->_M_tree_ptr;
 
 1912       = _S_destr_concat_char_iter(this->_M_tree_ptr, &__x, 1);
 
 1919     _RopeRep* __old = this->_M_tree_ptr;
 
 1920     this->_M_tree_ptr = _S_substring(this->_M_tree_ptr,
 
 1921                      0, this->_M_tree_ptr->_M_size - 1);
 
 1927       { 
return _S_fetch(this->_M_tree_ptr, this->_M_tree_ptr->_M_size - 1); }
 
 1930       push_front(_CharT __x)
 
 1932     _RopeRep* __old = this->_M_tree_ptr;
 
 1934       __STL_ROPE_FROM_UNOWNED_CHAR_PTR(&__x, 1, _M_get_allocator());
 
 1937         this->_M_tree_ptr = _S_concat(__left, this->_M_tree_ptr);
 
 1944         __throw_exception_again;
 
 1951     _RopeRep* __old = this->_M_tree_ptr;
 
 1953       = _S_substring(this->_M_tree_ptr, 1, this->_M_tree_ptr->_M_size);
 
 1959       { 
return _S_fetch(this->_M_tree_ptr, 0); }
 
 1964     _RopeRep* __old = this->_M_tree_ptr;
 
 1965     this->_M_tree_ptr = _S_balance(this->_M_tree_ptr);
 
 1970       copy(_CharT* __buffer)
 const 
 1972     _Destroy_const(__buffer, __buffer + 
size(), _M_get_allocator());
 
 1973     _S_flatten(this->_M_tree_ptr, __buffer);
 
 1982       copy(size_type __pos, size_type __n, _CharT* __buffer)
 const 
 1984     size_t __size = 
size();
 
 1985     size_t __len = (__pos + __n > __size? __size - __pos : __n);
 
 1987     _Destroy_const(__buffer, __buffer + __len, _M_get_allocator());
 
 1988     _S_flatten(this->_M_tree_ptr, __pos, __len, __buffer);
 
 1996       { _S_dump(this->_M_tree_ptr); }
 
 2000       const _CharT* c_str() 
const;
 
 2004       const _CharT* replace_with_c_str();
 
 2012     if (0 == this->_M_tree_ptr)
 
 2014     if (__detail::_S_leaf == this->_M_tree_ptr->_M_tag &&
 
 2015         ((_RopeLeaf*)this->_M_tree_ptr)->_M_data ==
 
 2016         this->_M_tree_ptr->_M_c_string)
 
 2022     this->_M_tree_ptr->_M_free_c_string();
 
 2024     this->_M_tree_ptr->_M_c_string = 0;
 
 2029       { 
return _S_fetch(this->_M_tree_ptr, __pos); }
 
 2032       at(size_type __pos)
 const 
 2035     return (*
this)[__pos];
 
 2040       { 
return(const_iterator(this->_M_tree_ptr, 0)); }
 
 2045       { 
return(const_iterator(this->_M_tree_ptr, 0)); }
 
 2049       { 
return(const_iterator(this->_M_tree_ptr, 
size())); }
 
 2053       { 
return(const_iterator(this->_M_tree_ptr, 
size())); }
 
 2057       { 
return(0 == this->_M_tree_ptr? 0 : this->_M_tree_ptr->_M_size); }
 
 2066     return _S_min_len[int(__detail::_S_max_rope_depth) - 1] - 1;
 
 2074       const_reverse_iterator
 
 2076       { 
return const_reverse_iterator(
end()); }
 
 2078       const_reverse_iterator
 
 2079       const_rbegin()
 const 
 2080       { 
return const_reverse_iterator(
end()); }
 
 2082       const_reverse_iterator
 
 2084       { 
return const_reverse_iterator(
begin()); }
 
 2086       const_reverse_iterator
 
 2088       { 
return const_reverse_iterator(
begin()); }
 
 2090       template<
class _CharT2, 
class _Alloc2>
 
 2091         friend rope<_CharT2, _Alloc2>
 
 2092         operator+(
const rope<_CharT2, _Alloc2>& __left,
 
 2093           const rope<_CharT2, _Alloc2>& __right);
 
 2095       template<
class _CharT2, 
class _Alloc2>
 
 2096         friend rope<_CharT2, _Alloc2>
 
 2097         operator+(
const rope<_CharT2, _Alloc2>& __left, 
const _CharT2* __right);
 
 2099       template<
class _CharT2, 
class _Alloc2>
 
 2100         friend rope<_CharT2, _Alloc2>
 
 2101         operator+(
const rope<_CharT2, _Alloc2>& __left, _CharT2 __right);
 
 2110       append(
const _CharT* __iter, 
size_t __n)
 
 2112     _RopeRep* __result =
 
 2113       _S_destr_concat_char_iter(this->_M_tree_ptr, __iter, __n);
 
 2114     _S_unref(this->_M_tree_ptr);
 
 2115     this->_M_tree_ptr = __result;
 
 2120       append(
const _CharT* __c_string)
 
 2122     size_t __len = _S_char_ptr_len(__c_string);
 
 2123     append(__c_string, __len);
 
 2128       append(
const _CharT* __s, 
const _CharT* __e)
 
 2130     _RopeRep* __result =
 
 2131       _S_destr_concat_char_iter(this->_M_tree_ptr, __s, __e - __s);
 
 2132     _S_unref(this->_M_tree_ptr);
 
 2133     this->_M_tree_ptr = __result;
 
 2138       append(const_iterator __s, const_iterator __e)
 
 2140     _Self_destruct_ptr __appendee(_S_substring(__s._M_root,
 
 2142                            __e._M_current_pos));
 
 2143     _RopeRep* __result = _S_concat(this->_M_tree_ptr, 
 
 2144                        (_RopeRep*)__appendee);
 
 2145     _S_unref(this->_M_tree_ptr);
 
 2146     this->_M_tree_ptr = __result;
 
 2153     _RopeRep* __result =
 
 2154       _S_destr_concat_char_iter(this->_M_tree_ptr, &__c, 1);
 
 2155     _S_unref(this->_M_tree_ptr);
 
 2156     this->_M_tree_ptr = __result;
 
 2162       { 
return append(_CharT()); }  
 
 2165       append(
const rope& __y)
 
 2167     _RopeRep* __result = _S_concat(this->_M_tree_ptr, __y._M_tree_ptr);
 
 2168     _S_unref(this->_M_tree_ptr);
 
 2169     this->_M_tree_ptr = __result;
 
 2174       append(
size_t __n, _CharT __c)
 
 2176     rope<_CharT,_Alloc> __last(__n, __c);
 
 2177     return append(__last);
 
 2183     _RopeRep* __tmp = this->_M_tree_ptr;
 
 2184     this->_M_tree_ptr = __b._M_tree_ptr;
 
 2185     __b._M_tree_ptr = __tmp;
 
 2191       replace(_RopeRep* __old, 
size_t __pos1,
 
 2192           size_t __pos2, _RopeRep* __r)
 
 2199     _Self_destruct_ptr __left(_S_substring(__old, 0, __pos1));
 
 2200     _Self_destruct_ptr __right(_S_substring(__old, __pos2, __old->_M_size));
 
 2204       __result = _S_concat(__left, __right);
 
 2207         _Self_destruct_ptr __left_result(_S_concat(__left, __r));
 
 2208         __result = _S_concat(__left_result, __right);
 
 2215       insert(
size_t __p, 
const rope& __r)
 
 2217     _RopeRep* __result =
 
 2218       replace(this->_M_tree_ptr, __p, __p, __r._M_tree_ptr);
 
 2219     _S_unref(this->_M_tree_ptr);
 
 2220     this->_M_tree_ptr = __result;
 
 2224       insert(
size_t __p, 
size_t __n, _CharT __c)
 
 2226     rope<_CharT,_Alloc> __r(__n,__c);
 
 2231       insert(
size_t __p, 
const _CharT* __i, 
size_t __n)
 
 2233     _Self_destruct_ptr __left(_S_substring(this->_M_tree_ptr, 0, __p));
 
 2234     _Self_destruct_ptr __right(_S_substring(this->_M_tree_ptr,
 
 2236     _Self_destruct_ptr __left_result(_S_concat_char_iter(__left, __i, __n));
 
 2240     _RopeRep* __result = _S_concat(__left_result, __right);
 
 2241     _S_unref(this->_M_tree_ptr);
 
 2242     this->_M_tree_ptr = __result;
 
 2246       insert(
size_t __p, 
const _CharT* __c_string)
 
 2247       { insert(__p, __c_string, _S_char_ptr_len(__c_string)); }
 
 2250       insert(
size_t __p, _CharT __c)
 
 2251       { insert(__p, &__c, 1); }
 
 2256     _CharT __c = _CharT();
 
 2257     insert(__p, &__c, 1);
 
 2261       insert(
size_t __p, 
const _CharT* __i, 
const _CharT* __j)
 
 2268       insert(
size_t __p, 
const const_iterator& __i,
 
 2269          const const_iterator& __j)
 
 2276       insert(
size_t __p, 
const iterator& __i,
 
 2277          const iterator& __j)
 
 2286       replace(
size_t __p, 
size_t __n, 
const rope& __r)
 
 2288     _RopeRep* __result =
 
 2289       replace(this->_M_tree_ptr, __p, __p + __n, __r._M_tree_ptr);
 
 2290     _S_unref(this->_M_tree_ptr);
 
 2291     this->_M_tree_ptr = __result;
 
 2295       replace(
size_t __p, 
size_t __n,
 
 2296           const _CharT* __i, 
size_t __i_len)
 
 2298     rope __r(__i, __i_len);
 
 2299     replace(__p, __n, __r);
 
 2303       replace(
size_t __p, 
size_t __n, _CharT __c)
 
 2306     replace(__p, __n, __r);
 
 2310       replace(
size_t __p, 
size_t __n, 
const _CharT* __c_string)
 
 2312     rope __r(__c_string);
 
 2313     replace(__p, __n, __r);
 
 2317       replace(
size_t __p, 
size_t __n,
 
 2318           const _CharT* __i, 
const _CharT* __j)
 
 2321     replace(__p, __n, __r);
 
 2325       replace(
size_t __p, 
size_t __n,
 
 2326           const const_iterator& __i, 
const const_iterator& __j)
 
 2329     replace(__p, __n, __r);
 
 2333       replace(
size_t __p, 
size_t __n,
 
 2334           const iterator& __i, 
const iterator& __j)
 
 2337     replace(__p, __n, __r);
 
 2342       replace(
size_t __p, _CharT __c)
 
 2344     iterator __i(
this, __p);
 
 2349       replace(
size_t __p, 
const rope& __r)
 
 2350       { replace(__p, 1, __r); }
 
 2353       replace(
size_t __p, 
const _CharT* __i, 
size_t __i_len)
 
 2354       { replace(__p, 1, __i, __i_len); }
 
 2357       replace(
size_t __p, 
const _CharT* __c_string)
 
 2358       { replace(__p, 1, __c_string); }
 
 2361       replace(
size_t __p, 
const _CharT* __i, 
const _CharT* __j)
 
 2362       { replace(__p, 1, __i, __j); }
 
 2365       replace(
size_t __p, 
const const_iterator& __i,
 
 2366           const const_iterator& __j)
 
 2367       { replace(__p, 1, __i, __j); }
 
 2370       replace(
size_t __p, 
const iterator& __i,
 
 2371           const iterator& __j)
 
 2372       { replace(__p, 1, __i, __j); }
 
 2376       erase(
size_t __p, 
size_t __n)
 
 2378     _RopeRep* __result = replace(this->_M_tree_ptr, __p,
 
 2380     _S_unref(this->_M_tree_ptr);
 
 2381     this->_M_tree_ptr = __result;
 
 2387       { erase(__p, __p + 1); }
 
 2391       insert(
const iterator& __p, 
const rope& __r)
 
 2393     insert(__p.index(), __r);
 
 2398       insert(
const iterator& __p, 
size_t __n, _CharT __c)
 
 2400     insert(__p.index(), __n, __c);
 
 2404       iterator insert(
const iterator& __p, _CharT __c)
 
 2406     insert(__p.index(), __c);
 
 2411       insert(
const iterator& __p )
 
 2413     insert(__p.index());
 
 2418       insert(
const iterator& __p, 
const _CharT* c_string)
 
 2420     insert(__p.index(), c_string);
 
 2425       insert(
const iterator& __p, 
const _CharT* __i, 
size_t __n)
 
 2427     insert(__p.index(), __i, __n);
 
 2432       insert(
const iterator& __p, 
const _CharT* __i,
 
 2435     insert(__p.index(), __i, __j); 
 
 2440       insert(
const iterator& __p,
 
 2441          const const_iterator& __i, 
const const_iterator& __j)
 
 2443     insert(__p.index(), __i, __j);
 
 2448       insert(
const iterator& __p,
 
 2449          const iterator& __i, 
const iterator& __j)
 
 2451     insert(__p.index(), __i, __j);
 
 2457       replace(
const iterator& __p, 
const iterator& __q, 
const rope& __r)
 
 2458       { replace(__p.index(), __q.index() - __p.index(), __r); }
 
 2461       replace(
const iterator& __p, 
const iterator& __q, _CharT __c)
 
 2462       { replace(__p.index(), __q.index() - __p.index(), __c); }
 
 2465       replace(
const iterator& __p, 
const iterator& __q,
 
 2466           const _CharT* __c_string)
 
 2467       { replace(__p.index(), __q.index() - __p.index(), __c_string); }
 
 2470       replace(
const iterator& __p, 
const iterator& __q,
 
 2471           const _CharT* __i, 
size_t __n)
 
 2472       { replace(__p.index(), __q.index() - __p.index(), __i, __n); }
 
 2475       replace(
const iterator& __p, 
const iterator& __q,
 
 2476           const _CharT* __i, 
const _CharT* __j)
 
 2477       { replace(__p.index(), __q.index() - __p.index(), __i, __j); }
 
 2480       replace(
const iterator& __p, 
const iterator& __q,
 
 2481           const const_iterator& __i, 
const const_iterator& __j)
 
 2482       { replace(__p.index(), __q.index() - __p.index(), __i, __j); }
 
 2485       replace(
const iterator& __p, 
const iterator& __q,
 
 2486           const iterator& __i, 
const iterator& __j)
 
 2487       { replace(__p.index(), __q.index() - __p.index(), __i, __j); }
 
 2491       replace(
const iterator& __p, 
const rope& __r)
 
 2492       { replace(__p.index(), __r); }
 
 2495       replace(
const iterator& __p, _CharT __c)
 
 2496       { replace(__p.index(), __c); }
 
 2499       replace(
const iterator& __p, 
const _CharT* __c_string)
 
 2500       { replace(__p.index(), __c_string); }
 
 2503       replace(
const iterator& __p, 
const _CharT* __i, 
size_t __n)
 
 2504       { replace(__p.index(), __i, __n); }
 
 2507       replace(
const iterator& __p, 
const _CharT* __i, 
const _CharT* __j)
 
 2508       { replace(__p.index(), __i, __j); }
 
 2511       replace(
const iterator& __p, const_iterator __i, const_iterator __j)
 
 2512       { replace(__p.index(), __i, __j); }
 
 2515       replace(
const iterator& __p, iterator __i, iterator __j)
 
 2516       { replace(__p.index(), __i, __j); }
 
 2520       erase(
const iterator& __p, 
const iterator& __q)
 
 2522     size_t __p_index = __p.index();
 
 2523     erase(__p_index, __q.index() - __p_index);
 
 2524     return iterator(
this, __p_index);
 
 2528       erase(
const iterator& __p)
 
 2530     size_t __p_index = __p.index();
 
 2531     erase(__p_index, 1);
 
 2532     return iterator(
this, __p_index);
 
 2536       substr(
size_t __start, 
size_t __len = 1)
 const 
 2538     return rope<_CharT, _Alloc>(_S_substring(this->_M_tree_ptr,
 
 2544       substr(iterator __start, iterator __end)
 const 
 2546     return rope<_CharT, _Alloc>(_S_substring(this->_M_tree_ptr,
 
 2552       substr(iterator __start)
 const 
 2554     size_t __pos = __start.index();
 
 2555     return rope<_CharT, _Alloc>(_S_substring(this->_M_tree_ptr,
 
 2560       substr(const_iterator __start, const_iterator __end)
 const 
 2564     return rope<_CharT, _Alloc>(_S_substring(this->_M_tree_ptr,
 
 2569       rope<_CharT, _Alloc>
 
 2570       substr(const_iterator __start)
 
 2572     size_t __pos = __start.index();
 
 2573     return rope<_CharT, _Alloc>(_S_substring(this->_M_tree_ptr,
 
 2577       static const size_type npos;
 
 2579       size_type find(_CharT __c, size_type __pos = 0) 
const;
 
 2582       find(
const _CharT* __s, size_type __pos = 0)
 const 
 2584     size_type __result_pos;
 
 2585     const_iterator __result =
 
 2587               __s, __s + _S_char_ptr_len(__s));
 
 2588     __result_pos = __result.index();
 
 2589 #ifndef __STL_OLD_ROPE_SEMANTICS 
 2590     if (__result_pos == 
size())
 
 2591       __result_pos = npos;
 
 2593     return __result_pos;
 
 2598       { 
return(iterator(
this, 0)); }
 
 2602       { 
return(iterator(
this, 
size())); }
 
 2608       { 
return reverse_iterator(mutable_end()); }
 
 2612       { 
return reverse_iterator(mutable_begin()); }
 
 2615       mutable_reference_at(size_type __pos)
 
 2616       { 
return reference(
this, __pos); }
 
 2621       { 
return _char_ref_proxy(
this, __pos); }
 
 2627     return (*
this)[__pos];
 
 2630       void resize(size_type __n, _CharT __c) { }
 
 2631       void resize(size_type __n) { }
 
 2632       void reserve(size_type __res_arg = 0) { }
 
 2636       { 
return max_size(); }
 
 2642       copy(_CharT* __buffer, size_type __n,
 
 2643        size_type __pos = 0)
 const 
 2644       { 
return copy(__pos, __n, __buffer); }
 
 2648       { 
return mutable_end(); }
 
 2652       { 
return mutable_begin(); }
 
 2656       { 
return mutable_rend(); }
 
 2660       { 
return mutable_rbegin(); }
 
 2665       { 
return const_end(); }
 
 2669       { 
return const_begin(); }
 
 2671       const_reverse_iterator
 
 2673       { 
return const_rend(); }
 
 2675       const_reverse_iterator
 
 2677       { 
return const_rbegin(); }
 
 2682   template <
class _CharT, 
class _Alloc>
 
 2683     const typename rope<_CharT, _Alloc>::size_type
 
 2684     rope<_CharT, _Alloc>::npos = (size_type)(-1);
 
 2686   template <
class _CharT, 
class _Alloc>
 
 2687     inline bool operator==(
const _Rope_const_iterator<_CharT, _Alloc>& __x,
 
 2688                const _Rope_const_iterator<_CharT, _Alloc>& __y)
 
 2689     { 
return (__x._M_current_pos == __y._M_current_pos
 
 2690           && __x._M_root == __y._M_root); }
 
 2692   template <
class _CharT, 
class _Alloc>
 
 2693     inline bool operator<(const _Rope_const_iterator<_CharT, _Alloc>& __x,
 
 2694               const _Rope_const_iterator<_CharT, _Alloc>& __y)
 
 2695     { 
return (__x._M_current_pos < __y._M_current_pos); }
 
 2697   template <
class _CharT, 
class _Alloc>
 
 2698     inline bool operator!=(
const _Rope_const_iterator<_CharT, _Alloc>& __x,
 
 2699                const _Rope_const_iterator<_CharT, _Alloc>& __y)
 
 2700     { 
return !(__x == __y); }
 
 2702   template <
class _CharT, 
class _Alloc>
 
 2703     inline bool operator>(
const _Rope_const_iterator<_CharT, _Alloc>& __x,
 
 2704               const _Rope_const_iterator<_CharT, _Alloc>& __y)
 
 2705     { 
return __y < __x; }
 
 2707   template <
class _CharT, 
class _Alloc>
 
 2709     operator<=(const _Rope_const_iterator<_CharT, _Alloc>& __x,
 
 2710            const _Rope_const_iterator<_CharT, _Alloc>& __y)
 
 2711     { 
return !(__y < __x); }
 
 2713   template <
class _CharT, 
class _Alloc>
 
 2715     operator>=(
const _Rope_const_iterator<_CharT, _Alloc>& __x,
 
 2716            const _Rope_const_iterator<_CharT, _Alloc>& __y)
 
 2717     { 
return !(__x < __y); }
 
 2719   template <
class _CharT, 
class _Alloc>
 
 2721     operator-(
const _Rope_const_iterator<_CharT, _Alloc>& __x,
 
 2722           const _Rope_const_iterator<_CharT, _Alloc>& __y)
 
 2723     { 
return (ptrdiff_t)__x._M_current_pos - (ptrdiff_t)__y._M_current_pos; }
 
 2725   template <
class _CharT, 
class _Alloc>
 
 2726     inline _Rope_const_iterator<_CharT, _Alloc>
 
 2727     operator-(
const _Rope_const_iterator<_CharT, _Alloc>& __x, ptrdiff_t __n)
 
 2728     { 
return _Rope_const_iterator<_CharT, _Alloc>(__x._M_root,
 
 2729                           __x._M_current_pos - __n); }
 
 2731   template <
class _CharT, 
class _Alloc>
 
 2732     inline _Rope_const_iterator<_CharT, _Alloc>
 
 2733     operator+(
const _Rope_const_iterator<_CharT, _Alloc>& __x, ptrdiff_t __n)
 
 2734     { 
return _Rope_const_iterator<_CharT, _Alloc>(__x._M_root,
 
 2735                           __x._M_current_pos + __n); }
 
 2737   template <
class _CharT, 
class _Alloc>
 
 2738     inline _Rope_const_iterator<_CharT, _Alloc>
 
 2739     operator+(ptrdiff_t __n, 
const _Rope_const_iterator<_CharT, _Alloc>& __x)
 
 2740   { 
return _Rope_const_iterator<_CharT, _Alloc>(__x._M_root,
 
 2741                         __x._M_current_pos + __n); }
 
 2743   template <
class _CharT, 
class _Alloc>
 
 2745     operator==(
const _Rope_iterator<_CharT, _Alloc>& __x,
 
 2746            const _Rope_iterator<_CharT, _Alloc>& __y)
 
 2747     {
return (__x._M_current_pos == __y._M_current_pos
 
 2748          && __x._M_root_rope == __y._M_root_rope); }
 
 2750   template <
class _CharT, 
class _Alloc>
 
 2752     operator<(const _Rope_iterator<_CharT, _Alloc>& __x,
 
 2753           const _Rope_iterator<_CharT, _Alloc>& __y)
 
 2754     { 
return (__x._M_current_pos < __y._M_current_pos); }
 
 2756   template <
class _CharT, 
class _Alloc>
 
 2758     operator!=(
const _Rope_iterator<_CharT, _Alloc>& __x,
 
 2759            const _Rope_iterator<_CharT, _Alloc>& __y)
 
 2760     { 
return !(__x == __y); }
 
 2762   template <
class _CharT, 
class _Alloc>
 
 2764     operator>(
const _Rope_iterator<_CharT, _Alloc>& __x,
 
 2765           const _Rope_iterator<_CharT, _Alloc>& __y)
 
 2766     { 
return __y < __x; }
 
 2768   template <
class _CharT, 
class _Alloc>
 
 2770     operator<=(const _Rope_iterator<_CharT, _Alloc>& __x,
 
 2771            const _Rope_iterator<_CharT, _Alloc>& __y)
 
 2772     { 
return !(__y < __x); }
 
 2774   template <
class _CharT, 
class _Alloc>
 
 2776     operator>=(
const _Rope_iterator<_CharT, _Alloc>& __x,
 
 2777            const _Rope_iterator<_CharT, _Alloc>& __y)
 
 2778     { 
return !(__x < __y); }
 
 2780   template <
class _CharT, 
class _Alloc>
 
 2782     operator-(
const _Rope_iterator<_CharT, _Alloc>& __x,
 
 2783           const _Rope_iterator<_CharT, _Alloc>& __y)
 
 2784     { 
return ((ptrdiff_t)__x._M_current_pos
 
 2785           - (ptrdiff_t)__y._M_current_pos); }
 
 2787   template <
class _CharT, 
class _Alloc>
 
 2788     inline _Rope_iterator<_CharT, _Alloc>
 
 2789     operator-(
const _Rope_iterator<_CharT, _Alloc>& __x,
 
 2791     { 
return _Rope_iterator<_CharT, _Alloc>(__x._M_root_rope,
 
 2792                         __x._M_current_pos - __n); }
 
 2794   template <
class _CharT, 
class _Alloc>
 
 2795     inline _Rope_iterator<_CharT, _Alloc>
 
 2796     operator+(
const _Rope_iterator<_CharT, _Alloc>& __x, ptrdiff_t __n)
 
 2797     { 
return _Rope_iterator<_CharT, _Alloc>(__x._M_root_rope,
 
 2798                         __x._M_current_pos + __n); }
 
 2800   template <
class _CharT, 
class _Alloc>
 
 2801     inline _Rope_iterator<_CharT, _Alloc>
 
 2802     operator+(ptrdiff_t __n, 
const _Rope_iterator<_CharT, _Alloc>& __x)
 
 2803     { 
return _Rope_iterator<_CharT, _Alloc>(__x._M_root_rope,
 
 2804                         __x._M_current_pos + __n); }
 
 2806   template <
class _CharT, 
class _Alloc>
 
 2807     inline rope<_CharT, _Alloc>
 
 2808     operator+(
const rope<_CharT, _Alloc>& __left,
 
 2809           const rope<_CharT, _Alloc>& __right)
 
 2813       typedef rope<_CharT, _Alloc> rope_type;
 
 2814       return rope_type(rope_type::_S_concat(__left._M_tree_ptr, 
 
 2815                         __right._M_tree_ptr));
 
 2818   template <
class _CharT, 
class _Alloc>
 
 2819     inline rope<_CharT, _Alloc>&
 
 2820     operator+=(rope<_CharT, _Alloc>& __left,
 
 2821            const rope<_CharT, _Alloc>& __right)
 
 2823       __left.append(__right);
 
 2827   template <
class _CharT, 
class _Alloc>
 
 2828     inline rope<_CharT, _Alloc>
 
 2829     operator+(
const rope<_CharT, _Alloc>& __left,
 
 2830           const _CharT* __right)
 
 2832       typedef rope<_CharT, _Alloc> rope_type;
 
 2833       size_t __rlen = rope_type::_S_char_ptr_len(__right);
 
 2834       return rope_type(rope_type::_S_concat_char_iter(__left._M_tree_ptr,
 
 2838   template <
class _CharT, 
class _Alloc>
 
 2839     inline rope<_CharT, _Alloc>&
 
 2840     operator+=(rope<_CharT, _Alloc>& __left,
 
 2841            const _CharT* __right)
 
 2843       __left.append(__right);
 
 2847   template <
class _CharT, 
class _Alloc>
 
 2848     inline rope<_CharT, _Alloc>
 
 2849     operator+(
const rope<_CharT, _Alloc>& __left, _CharT __right)
 
 2851       typedef rope<_CharT, _Alloc> rope_type;
 
 2852       return rope_type(rope_type::_S_concat_char_iter(__left._M_tree_ptr,
 
 2856   template <
class _CharT, 
class _Alloc>
 
 2857     inline rope<_CharT, _Alloc>&
 
 2858     operator+=(rope<_CharT, _Alloc>& __left, _CharT __right)
 
 2860       __left.append(__right);
 
 2864   template <
class _CharT, 
class _Alloc>
 
 2866     operator<(const rope<_CharT, _Alloc>& __left,
 
 2867           const rope<_CharT, _Alloc>& __right)
 
 2868     { 
return __left.compare(__right) < 0; }
 
 2870   template <
class _CharT, 
class _Alloc>
 
 2872     operator==(
const rope<_CharT, _Alloc>& __left,
 
 2873            const rope<_CharT, _Alloc>& __right)
 
 2874     { 
return __left.compare(__right) == 0; }
 
 2876   template <
class _CharT, 
class _Alloc>
 
 2878     operator==(
const _Rope_char_ptr_proxy<_CharT, _Alloc>& __x,
 
 2879            const _Rope_char_ptr_proxy<_CharT, _Alloc>& __y)
 
 2880     { 
return (__x._M_pos == __y._M_pos && __x._M_root == __y._M_root); }
 
 2882   template <
class _CharT, 
class _Alloc>
 
 2884     operator!=(
const rope<_CharT, _Alloc>& __x,
 
 2885            const rope<_CharT, _Alloc>& __y)
 
 2886     { 
return !(__x == __y); }
 
 2888   template <
class _CharT, 
class _Alloc>
 
 2890     operator>(
const rope<_CharT, _Alloc>& __x,
 
 2891           const rope<_CharT, _Alloc>& __y)
 
 2892     { 
return __y < __x; }
 
 2894   template <
class _CharT, 
class _Alloc>
 
 2896     operator<=(const rope<_CharT, _Alloc>& __x,
 
 2897            const rope<_CharT, _Alloc>& __y)
 
 2898     { 
return !(__y < __x); }
 
 2900   template <
class _CharT, 
class _Alloc>
 
 2902     operator>=(
const rope<_CharT, _Alloc>& __x,
 
 2903            const rope<_CharT, _Alloc>& __y)
 
 2904     { 
return !(__x < __y); }
 
 2906   template <
class _CharT, 
class _Alloc>
 
 2908     operator!=(
const _Rope_char_ptr_proxy<_CharT, _Alloc>& __x,
 
 2909            const _Rope_char_ptr_proxy<_CharT, _Alloc>& __y)
 
 2910     { 
return !(__x == __y); }
 
 2912   template<
class _CharT, 
class _Traits, 
class _Alloc>
 
 2914     operator<<(std::basic_ostream<_CharT, _Traits>& __o,
 
 2915            const rope<_CharT, _Alloc>& __r);
 
 2917   typedef rope<char> crope;
 
 2918   typedef rope<wchar_t> wrope;
 
 2920   inline crope::reference
 
 2921   __mutable_reference_at(crope& __c, 
size_t __i)
 
 2922   { 
return __c.mutable_reference_at(__i); }
 
 2924   inline wrope::reference
 
 2925   __mutable_reference_at(wrope& __c, 
size_t __i)
 
 2926   { 
return __c.mutable_reference_at(__i); }
 
 2928   template <
class _CharT, 
class _Alloc>
 
 2930     swap(rope<_CharT, _Alloc>& __x, rope<_CharT, _Alloc>& __y)
 
 2933 _GLIBCXX_END_NAMESPACE_VERSION
 
 2937 namespace std _GLIBCXX_VISIBILITY(default)
 
 2941 _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
 2944     struct hash<__gnu_cxx::crope>
 
 2949     size_t __size = __str.size();
 
 2952     return 13 * __str[0] + 5 * __str[__size - 1] + __size;
 
 2958     struct hash<__gnu_cxx::wrope>
 
 2963     size_t __size = __str.size();
 
 2966     return 13 * __str[0] + 5 * __str[__size - 1] + __size;
 
 2970 _GLIBCXX_END_NAMESPACE_VERSION
 
constexpr const _Tp * begin(initializer_list< _Tp > __ils) noexcept
Return an iterator pointing to the first element of the initializer_list. 
constexpr size_t size() const noexcept
Returns the total number of bits. 
_ForwardIterator1 search(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2, _ForwardIterator2 __last2, _BinaryPredicate __predicate)
Search a sequence for a matching sub-sequence using a predicate. 
const _Tp & max(const _Tp &, const _Tp &)
This does what you think it does. 
The standard allocator, as per [20.4]. 
constexpr const _Tp * end(initializer_list< _Tp > __ils) noexcept
Return an iterator pointing to one past the last element of the initializer_list. ...
void swap(function< _Res(_Args...)> &__x, function< _Res(_Args...)> &__y)
Swap the targets of two polymorphic function object wrappers. 
void _Destroy(_Tp *__pointer)
bitset< _Nb > operator&(const bitset< _Nb > &__x, const bitset< _Nb > &__y) noexcept
Global bitwise operations on bitsets. 
_Siter_base< _Iterator >::iterator_type __base(_Iterator __it)
Template class basic_ostream. 
pair< _InputIter, _ForwardIter > uninitialized_copy_n(_InputIter __first, _Size __count, _ForwardIter __result)
Copies the range [first,last) into result. 
basic_ostream< _CharT, _Traits > & flush(basic_ostream< _CharT, _Traits > &__os)
Flushes the output stream. 
reference operator[](size_t __position)
Array-indexing support.