-}
-
-template <class _CharT, class _Alloc>
-const unsigned long
-rope<_CharT,_Alloc>::_S_min_len[
- _Rope_RopeRep<_CharT,_Alloc>::_S_max_rope_depth + 1] = {
-/* 0 */1, /* 1 */2, /* 2 */3, /* 3 */5, /* 4 */8, /* 5 */13, /* 6 */21,
-/* 7 */34, /* 8 */55, /* 9 */89, /* 10 */144, /* 11 */233, /* 12 */377,
-/* 13 */610, /* 14 */987, /* 15 */1597, /* 16 */2584, /* 17 */4181,
-/* 18 */6765, /* 19 */10946, /* 20 */17711, /* 21 */28657, /* 22 */46368,
-/* 23 */75025, /* 24 */121393, /* 25 */196418, /* 26 */317811,
-/* 27 */514229, /* 28 */832040, /* 29 */1346269, /* 30 */2178309,
-/* 31 */3524578, /* 32 */5702887, /* 33 */9227465, /* 34 */14930352,
-/* 35 */24157817, /* 36 */39088169, /* 37 */63245986, /* 38 */102334155,
-/* 39 */165580141, /* 40 */267914296, /* 41 */433494437,
-/* 42 */701408733, /* 43 */1134903170, /* 44 */1836311903,
-/* 45 */2971215073u };
-// These are Fibonacci numbers < 2**32.
-
-template <class _CharT, class _Alloc>
-typename rope<_CharT,_Alloc>::_RopeRep*
-rope<_CharT,_Alloc>::_S_balance(_RopeRep* __r)
-{
- _RopeRep* __forest[_RopeRep::_S_max_rope_depth + 1];
- _RopeRep* __result = 0;
- int __i;
- // Invariant:
- // The concatenation of forest in descending order is equal to __r.
- // __forest[__i]._M_size >= _S_min_len[__i]
- // __forest[__i]._M_depth = __i
- // References from forest are included in refcount.
-
- for (__i = 0; __i <= _RopeRep::_S_max_rope_depth; ++__i)
- __forest[__i] = 0;
- try {
- _S_add_to_forest(__r, __forest);
- for (__i = 0; __i <= _RopeRep::_S_max_rope_depth; ++__i)
- if (0 != __forest[__i]) {
-# ifndef __GC
- _Self_destruct_ptr __old(__result);
-# endif
- __result = _S_concat(__forest[__i], __result);
- __forest[__i]->_M_unref_nonnil();
-# if !defined(__GC) && defined(__EXCEPTIONS)
- __forest[__i] = 0;
-# endif
- }
- }
- catch(...)
- {
- for(__i = 0; __i <= _RopeRep::_S_max_rope_depth; __i++)
- _S_unref(__forest[__i]);
- __throw_exception_again;
- }