aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/include/ext/rope
diff options
context:
space:
mode:
authorAndrea Ornstein <andrea.ornstein@st.com>2007-11-20 17:00:46 +0000
committerAndrea Ornstein <andrea.ornstein@st.com>2007-11-20 17:00:46 +0000
commit659096c96926ba7726401bc7180b9997638b11c2 (patch)
treefee5a5288dbbeabbab76331112f056cb82869e8f /libstdc++-v3/include/ext/rope
parent0f58613b59d33df915bf86603279f5a401b91229 (diff)
................
Merged revisions 116474-127002 via svnmerge from svn+ssh://gcc.gnu.org/svn/gcc/trunk remove obsolete lang hook merge changes in langhooks adapt to new structure of CALL_EXPR handle POINTER_PLUS_EXPR handle GIMPLE_MODIFY_STMT in the same way we do for MODIFY_EXPR generate new POINTER_PLUS_EXPR instead of PLUS_EXPR generate GIMPLE_MODIFY_STMT instead of MODIFY_EXPR use new function get_calee_fndecl, use build_call_list insteadof build3 (CALL_EXPR,... ................ update contact info ................ mv target dependent file bb-layout.c to cil32 dir ................ avoid use of 'struct with no fields', is not standard C ................ do not run mudflap_2 for cli ................ Fix generation of calls to functions without prototype ................ move to a new file code related to removal of stloc ldloc ................ add missing Makefile rules in libcilsupport and libgcc4net ................ added handling of cil_strattr attribute and JitCompilationHints (frequencies and probabilities) ................ Early switch simplification pass added ................ add missing call to Environment.Exit in body of StartupHelper::Shutdown in libgcc4net ................ git-svn-id: https://gcc.gnu.org/svn/gcc/branches/st/cli@130317 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/include/ext/rope')
-rw-r--r--libstdc++-v3/include/ext/rope250
1 files changed, 138 insertions, 112 deletions
diff --git a/libstdc++-v3/include/ext/rope b/libstdc++-v3/include/ext/rope
index 059342f22a5..e0f0aa39036 100644
--- a/libstdc++-v3/include/ext/rope
+++ b/libstdc++-v3/include/ext/rope
@@ -1,6 +1,6 @@
// SGI's rope class -*- C++ -*-
-// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006
+// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@@ -57,29 +57,28 @@
#include <bits/stl_numeric.h>
#include <bits/allocator.h>
#include <ext/hash_fun.h>
+#include <iosfwd>
+#include <bits/gthr.h>
# ifdef __GC
# define __GC_CONST const
# else
-# include <bits/gthr.h>
# define __GC_CONST // constant except for deallocation
# endif
#include <ext/memory> // For uninitialized_copy_n
-namespace
-{
- enum { _S_max_rope_depth = 45 };
- enum _Tag {_S_leaf, _S_concat, _S_substringfn, _S_function};
-}
-
_GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
+ namespace __detail
+ {
+ enum { _S_max_rope_depth = 45 };
+ enum _Tag {_S_leaf, _S_concat, _S_substringfn, _S_function};
+ } // namespace __detail
+
using std::size_t;
using std::ptrdiff_t;
using std::allocator;
- using std::iterator;
- using std::reverse_iterator;
using std::_Destroy;
// The _S_eos function is used for those functions that
@@ -138,7 +137,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
class char_producer
{
public:
- virtual ~char_producer() {};
+ virtual ~char_producer() { };
virtual void
operator()(size_t __start_pos, size_t __len,
@@ -165,7 +164,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
template<class _Sequence, size_t _Buf_sz = 100>
class sequence_buffer
- : public iterator<std::output_iterator_tag, void, void, void, void>
+ : public std::iterator<std::output_iterator_tag, void, void, void, void>
{
public:
typedef typename _Sequence::value_type value_type;
@@ -302,7 +301,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
// compile-time would do. Hence this should all be private
// for now.
// The symmetry with char_producer is accidental and temporary.
- virtual ~_Rope_char_consumer() {};
+ virtual ~_Rope_char_consumer() { };
virtual bool
operator()(const _CharT* __buffer, size_t __len) = 0;
@@ -534,8 +533,16 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
get_allocator() const
{ return *static_cast<const _Alloc*>(this); }
+ allocator_type&
+ _M_get_allocator()
+ { return *static_cast<_Alloc*>(this); }
+
+ const allocator_type&
+ _M_get_allocator() const
+ { return *static_cast<const _Alloc*>(this); }
+
_Rope_rep_base(size_t __size, const allocator_type&)
- : _M_size(__size) {}
+ : _M_size(__size) { }
size_t _M_size;
@@ -558,7 +565,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
# endif
{
public:
- _Tag _M_tag:8;
+ __detail::_Tag _M_tag:8;
bool _M_is_balanced:8;
unsigned char _M_depth;
__GC_CONST _CharT* _M_c_string;
@@ -573,9 +580,10 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
allocator_type;
using _Rope_rep_base<_CharT, _Alloc>::get_allocator;
+ using _Rope_rep_base<_CharT, _Alloc>::_M_get_allocator;
- _Rope_RopeRep(_Tag __t, int __d, bool __b, size_t __size,
- allocator_type __a)
+ _Rope_RopeRep(__detail::_Tag __t, int __d, bool __b, size_t __size,
+ const allocator_type& __a)
: _Rope_rep_base<_CharT, _Alloc>(__size, __a),
#ifndef __GC
_Refcount_Base(1),
@@ -592,11 +600,11 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
#endif
#ifdef __GC
void
- _M_incr () {}
+ _M_incr () { }
#endif
static void
_S_free_string(__GC_CONST _CharT*, size_t __len,
- allocator_type __a);
+ allocator_type& __a);
#define __STL_FREE_STRING(__s, __l, __a) _S_free_string(__s, __l, __a);
// Deallocate data section of a leaf.
// This shouldn't be a member function.
@@ -640,11 +648,11 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
__t->_M_free_tree();
}
# else /* __GC */
- void _M_unref_nonnil() {}
- void _M_ref_nonnil() {}
- static void _S_unref(_Rope_RopeRep*) {}
- static void _S_ref(_Rope_RopeRep*) {}
- static void _S_free_if_unref(_Rope_RopeRep*) {}
+ void _M_unref_nonnil() { }
+ void _M_ref_nonnil() { }
+ static void _S_unref(_Rope_RopeRep*) { }
+ static void _S_ref(_Rope_RopeRep*) { }
+ static void _S_free_if_unref(_Rope_RopeRep*) { }
# endif
protected:
_Rope_RopeRep&
@@ -690,8 +698,8 @@ protected:
allocator_type;
_Rope_RopeLeaf(__GC_CONST _CharT* __d, size_t __size,
- allocator_type __a)
- : _Rope_RopeRep<_CharT, _Alloc>(_S_leaf, 0, true,
+ const allocator_type& __a)
+ : _Rope_RopeRep<_CharT, _Alloc>(__detail::_S_leaf, 0, true,
__size, __a), _M_data(__d)
{
if (_S_is_basic_char_type((_CharT *)0))
@@ -709,7 +717,7 @@ protected:
if (_M_data != this->_M_c_string)
this->_M_free_c_string();
- __STL_FREE_STRING(_M_data, this->_M_size, this->get_allocator());
+ __STL_FREE_STRING(_M_data, this->_M_size, this->_M_get_allocator());
}
#endif
protected:
@@ -732,8 +740,8 @@ protected:
_Rope_RopeConcatenation(_Rope_RopeRep<_CharT, _Alloc>* __l,
_Rope_RopeRep<_CharT, _Alloc>* __r,
- allocator_type __a)
- : _Rope_RopeRep<_CharT, _Alloc>(::_S_concat,
+ const allocator_type& __a)
+ : _Rope_RopeRep<_CharT, _Alloc>(__detail::_S_concat,
std::max(__l->_M_depth,
__r->_M_depth) + 1,
false,
@@ -780,8 +788,8 @@ protected:
allocator_type;
_Rope_RopeFunction(char_producer<_CharT>* __f, size_t __size,
- bool __d, allocator_type __a)
- : _Rope_RopeRep<_CharT, _Alloc>(::_S_function, 0, true, __size, __a)
+ bool __d, const allocator_type& __a)
+ : _Rope_RopeRep<_CharT, _Alloc>(__detail::_S_function, 0, true, __size, __a)
, _M_fn(__f)
#ifndef __GC
, _M_delete_when_done(__d)
@@ -832,15 +840,15 @@ protected:
{
switch(_M_base->_M_tag)
{
- case ::_S_function:
- case ::_S_substringfn:
+ case __detail::_S_function:
+ case __detail::_S_substringfn:
{
char_producer<_CharT>* __fn =
((_Rope_RopeFunction<_CharT,_Alloc>*)_M_base)->_M_fn;
(*__fn)(__start_pos + _M_start, __req_len, __buffer);
}
break;
- case ::_S_leaf:
+ case __detail::_S_leaf:
{
__GC_CONST _CharT* __s =
((_Rope_RopeLeaf<_CharT,_Alloc>*)_M_base)->_M_data;
@@ -857,14 +865,14 @@ protected:
allocator_type;
_Rope_RopeSubstring(_Rope_RopeRep<_CharT, _Alloc>* __b, size_t __s,
- size_t __l, allocator_type __a)
+ size_t __l, const allocator_type& __a)
: _Rope_RopeFunction<_CharT, _Alloc>(this, __l, false, __a),
char_producer<_CharT>(), _M_base(__b), _M_start(__s)
{
#ifndef __GC
_M_base->_M_ref_nonnil();
#endif
- this->_M_tag = ::_S_substringfn;
+ this->_M_tag = __detail::_S_substringfn;
}
virtual ~_Rope_RopeSubstring() throw()
{
@@ -893,12 +901,12 @@ protected:
~_Rope_self_destruct_ptr()
{ _Rope_RopeRep<_CharT, _Alloc>::_S_unref(_M_ptr); }
#ifdef __EXCEPTIONS
- _Rope_self_destruct_ptr() : _M_ptr(0) {};
+ _Rope_self_destruct_ptr() : _M_ptr(0) { };
#else
- _Rope_self_destruct_ptr() {};
+ _Rope_self_destruct_ptr() { };
#endif
_Rope_self_destruct_ptr(_Rope_RopeRep<_CharT, _Alloc>* __p)
- : _M_ptr(__p) {}
+ : _M_ptr(__p) { }
_Rope_RopeRep<_CharT, _Alloc>&
operator*()
@@ -941,18 +949,18 @@ protected:
_My_rope* _M_root; // The whole rope.
public:
_Rope_char_ref_proxy(_My_rope* __r, size_t __p)
- : _M_pos(__p), _M_current(), _M_current_valid(false), _M_root(__r) {}
+ : _M_pos(__p), _M_current(), _M_current_valid(false), _M_root(__r) { }
_Rope_char_ref_proxy(const _Rope_char_ref_proxy& __x)
- : _M_pos(__x._M_pos), _M_current(__x._M_current), _M_current_valid(false),
- _M_root(__x._M_root) {}
+ : _M_pos(__x._M_pos), _M_current(__x._M_current),
+ _M_current_valid(false), _M_root(__x._M_root) { }
// Don't preserve cache if the reference can outlive the
// expression. We claim that's not possible without calling
// a copy constructor or generating reference to a proxy
// reference. We declare the latter to have undefined semantics.
_Rope_char_ref_proxy(_My_rope* __r, size_t __p, _CharT __c)
- : _M_pos(__p), _M_current(__c), _M_current_valid(true), _M_root(__r) {}
+ : _M_pos(__p), _M_current(__c), _M_current_valid(true), _M_root(__r) { }
inline operator _CharT () const;
@@ -985,12 +993,12 @@ protected:
rope<_CharT,_Alloc>* _M_root; // The whole rope.
public:
_Rope_char_ptr_proxy(const _Rope_char_ref_proxy<_CharT,_Alloc>& __x)
- : _M_pos(__x._M_pos), _M_root(__x._M_root) {}
+ : _M_pos(__x._M_pos), _M_root(__x._M_root) { }
_Rope_char_ptr_proxy(const _Rope_char_ptr_proxy& __x)
- : _M_pos(__x._M_pos), _M_root(__x._M_root) {}
+ : _M_pos(__x._M_pos), _M_root(__x._M_root) { }
- _Rope_char_ptr_proxy() {}
+ _Rope_char_ptr_proxy() { }
_Rope_char_ptr_proxy(_CharT* __x)
: _M_root(0), _M_pos(0) { }
@@ -1023,7 +1031,7 @@ protected:
template<class _CharT, class _Alloc>
class _Rope_iterator_base
- : public iterator<std::random_access_iterator_tag, _CharT>
+ : public std::iterator<std::random_access_iterator_tag, _CharT>
{
friend class rope<_CharT, _Alloc>;
public:
@@ -1074,10 +1082,10 @@ protected:
static void _S_setcache_for_incr(_Rope_iterator_base& __x);
// As above, but assumes path
// cache is valid for previous posn.
- _Rope_iterator_base() {}
+ _Rope_iterator_base() { }
_Rope_iterator_base(_RopeRep* __root, size_t __pos)
- : _M_current_pos(__pos), _M_root(__root), _M_buf_ptr(0) {}
+ : _M_current_pos(__pos), _M_root(__root), _M_buf_ptr(0) { }
void _M_incr(size_t __n);
void _M_decr(size_t __n);
@@ -1114,7 +1122,7 @@ protected:
: _Rope_iterator_base<_CharT, _Alloc>(const_cast<_RopeRep*>(__root),
__pos)
// Only nonconst iterators modify root ref count
- {}
+ { }
public:
typedef _CharT reference; // Really a value. Returning a reference
// Would be a mess, since it would have
@@ -1122,7 +1130,7 @@ protected:
typedef const _CharT* pointer;
public:
- _Rope_const_iterator() {};
+ _Rope_const_iterator() { };
_Rope_const_iterator(const _Rope_const_iterator& __x)
: _Rope_iterator_base<_CharT,_Alloc>(__x) { }
@@ -1267,13 +1275,13 @@ protected:
protected:
typedef typename _Rope_iterator_base<_CharT, _Alloc>::_RopeRep _RopeRep;
rope<_CharT, _Alloc>* _M_root_rope;
- // root is treated as a cached version of this,
- // and is used to detect changes to the underlying
- // rope.
- // Root is included in the reference count.
- // This is necessary so that we can detect changes reliably.
- // Unfortunately, it requires careful bookkeeping for the
- // nonGC case.
+
+ // root is treated as a cached version of this, and is used to
+ // detect changes to the underlying rope.
+
+ // Root is included in the reference count. This is necessary
+ // so that we can detect changes reliably. Unfortunately, it
+ // requires careful bookkeeping for the nonGC case.
_Rope_iterator(rope<_CharT, _Alloc>* __r, size_t __pos)
: _Rope_iterator_base<_CharT, _Alloc>(__r->_M_tree_ptr, __pos),
_M_root_rope(__r)
@@ -1287,7 +1295,6 @@ protected:
typedef _Rope_char_ref_proxy<_CharT, _Alloc> reference;
typedef _Rope_char_ref_proxy<_CharT, _Alloc>* pointer;
- public:
rope<_CharT, _Alloc>&
container()
{ return *_M_root_rope; }
@@ -1446,13 +1453,21 @@ protected:
get_allocator() const
{ return *static_cast<const _Alloc*>(this); }
+ allocator_type&
+ _M_get_allocator()
+ { return *static_cast<_Alloc*>(this); }
+
+ const allocator_type&
+ _M_get_allocator() const
+ { return *static_cast<const _Alloc*>(this); }
+
typedef _Rope_RopeRep<_CharT, _Alloc> _RopeRep;
// The one in _Base may not be visible due to template rules.
_Rope_base(_RopeRep* __t, const allocator_type&)
- : _M_tree_ptr(__t) {}
+ : _M_tree_ptr(__t) { }
- _Rope_base(const allocator_type&) {}
+ _Rope_base(const allocator_type&) { }
// The only data member of a rope:
_RopeRep *_M_tree_ptr;
@@ -1506,6 +1521,7 @@ protected:
typedef typename _Base::allocator_type allocator_type;
using _Base::_M_tree_ptr;
using _Base::get_allocator;
+ using _Base::_M_get_allocator;
typedef __GC_CONST _CharT* _Cstrptr;
static _CharT _S_empty_c_str[1];
@@ -1554,8 +1570,8 @@ protected:
{ _RopeRep::_S_ref(__t); }
#else /* __GC */
- static void _S_unref(_RopeRep*) {}
- static void _S_ref(_RopeRep*) {}
+ static void _S_unref(_RopeRep*) { }
+ static void _S_ref(_RopeRep*) { }
#endif
#ifdef __GC
@@ -1616,7 +1632,7 @@ protected:
// Takes ownership of s instead of copying.
static _RopeLeaf*
_S_new_RopeLeaf(__GC_CONST _CharT *__s,
- size_t __size, allocator_type __a)
+ size_t __size, allocator_type& __a)
{
_RopeLeaf* __space = typename _Base::_LAlloc(__a).allocate(1);
return new(__space) _RopeLeaf(__s, __size, __a);
@@ -1624,7 +1640,7 @@ protected:
static _RopeConcatenation*
_S_new_RopeConcatenation(_RopeRep* __left, _RopeRep* __right,
- allocator_type __a)
+ allocator_type& __a)
{
_RopeConcatenation* __space = typename _Base::_CAlloc(__a).allocate(1);
return new(__space) _RopeConcatenation(__left, __right, __a);
@@ -1632,7 +1648,7 @@ protected:
static _RopeFunction*
_S_new_RopeFunction(char_producer<_CharT>* __f,
- size_t __size, bool __d, allocator_type __a)
+ size_t __size, bool __d, allocator_type& __a)
{
_RopeFunction* __space = typename _Base::_FAlloc(__a).allocate(1);
return new(__space) _RopeFunction(__f, __size, __d, __a);
@@ -1640,7 +1656,7 @@ protected:
static _RopeSubstring*
_S_new_RopeSubstring(_Rope_RopeRep<_CharT,_Alloc>* __b, size_t __s,
- size_t __l, allocator_type __a)
+ size_t __l, allocator_type& __a)
{
_RopeSubstring* __space = typename _Base::_SAlloc(__a).allocate(1);
return new(__space) _RopeSubstring(__b, __s, __l, __a);
@@ -1648,7 +1664,7 @@ protected:
static _RopeLeaf*
_S_RopeLeaf_from_unowned_char_ptr(const _CharT *__s,
- size_t __size, allocator_type __a)
+ size_t __size, allocator_type& __a)
#define __STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __size, __a) \
_S_RopeLeaf_from_unowned_char_ptr(__s, __size, __a)
{
@@ -1711,7 +1727,7 @@ protected:
_CharT* __buffer);
static const unsigned long
- _S_min_len[::_S_max_rope_depth + 1];
+ _S_min_len[__detail::_S_max_rope_depth + 1];
static bool
_S_is_balanced(_RopeRep* __r)
@@ -1770,22 +1786,31 @@ protected:
{ return _S_compare(this->_M_tree_ptr, __y._M_tree_ptr); }
rope(const _CharT* __s, const allocator_type& __a = allocator_type())
- : _Base(__STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, _S_char_ptr_len(__s),
- __a), __a)
- { }
+ : _Base(__a)
+ {
+ this->_M_tree_ptr =
+ __STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, _S_char_ptr_len(__s),
+ _M_get_allocator());
+ }
rope(const _CharT* __s, size_t __len,
const allocator_type& __a = allocator_type())
- : _Base(__STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __len, __a), __a)
- { }
+ : _Base(__a)
+ {
+ this->_M_tree_ptr =
+ __STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __len, _M_get_allocator());
+ }
// Should perhaps be templatized with respect to the iterator type
// and use Sequence_buffer. (It should perhaps use sequence_buffer
// even now.)
- rope(const _CharT *__s, const _CharT *__e,
+ rope(const _CharT* __s, const _CharT* __e,
const allocator_type& __a = allocator_type())
- : _Base(__STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __e - __s, __a), __a)
- { }
+ : _Base(__a)
+ {
+ this->_M_tree_ptr =
+ __STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __e - __s, _M_get_allocator());
+ }
rope(const const_iterator& __s, const const_iterator& __e,
const allocator_type& __a = allocator_type())
@@ -1804,12 +1829,15 @@ protected:
{
_CharT* __buf = this->_Data_allocate(_S_rounded_up_size(1));
- get_allocator().construct(__buf, __c);
+ _M_get_allocator().construct(__buf, __c);
try
- { this->_M_tree_ptr = _S_new_RopeLeaf(__buf, 1, __a); }
+ {
+ this->_M_tree_ptr = _S_new_RopeLeaf(__buf, 1,
+ _M_get_allocator());
+ }
catch(...)
{
- _RopeRep::__STL_FREE_STRING(__buf, 1, __a);
+ _RopeRep::__STL_FREE_STRING(__buf, 1, _M_get_allocator());
__throw_exception_again;
}
}
@@ -1818,9 +1846,9 @@ protected:
const allocator_type& __a = allocator_type());
rope(const allocator_type& __a = allocator_type())
- : _Base(0, __a) {}
+ : _Base(0, __a) { }
- // Construct a rope from a function that can compute its members
+ // Construct a rope from a function that can compute its members
rope(char_producer<_CharT> *__fn, size_t __len, bool __delete_fn,
const allocator_type& __a = allocator_type())
: _Base(__a)
@@ -1866,9 +1894,8 @@ protected:
pop_back()
{
_RopeRep* __old = this->_M_tree_ptr;
- this->_M_tree_ptr =
- _S_substring(this->_M_tree_ptr,
- 0, this->_M_tree_ptr->_M_size - 1);
+ this->_M_tree_ptr = _S_substring(this->_M_tree_ptr,
+ 0, this->_M_tree_ptr->_M_size - 1);
_S_unref(__old);
}
@@ -1881,7 +1908,7 @@ protected:
{
_RopeRep* __old = this->_M_tree_ptr;
_RopeRep* __left =
- __STL_ROPE_FROM_UNOWNED_CHAR_PTR(&__x, 1, this->get_allocator());
+ __STL_ROPE_FROM_UNOWNED_CHAR_PTR(&__x, 1, _M_get_allocator());
try
{
this->_M_tree_ptr = _S_concat(__left, this->_M_tree_ptr);
@@ -1919,7 +1946,7 @@ protected:
void
copy(_CharT* __buffer) const
{
- _Destroy(__buffer, __buffer + size(), get_allocator());
+ _Destroy(__buffer, __buffer + size(), _M_get_allocator());
_S_flatten(this->_M_tree_ptr, __buffer);
}
@@ -1934,7 +1961,7 @@ protected:
size_t __size = size();
size_t __len = (__pos + __n > __size? __size - __pos : __n);
- _Destroy(__buffer, __buffer + __len, get_allocator());
+ _Destroy(__buffer, __buffer + __len, _M_get_allocator());
_S_flatten(this->_M_tree_ptr, __pos, __len, __buffer);
return __len;
}
@@ -1961,7 +1988,7 @@ protected:
{
if (0 == this->_M_tree_ptr)
return;
- if (::_S_leaf == this->_M_tree_ptr->_M_tag &&
+ if (__detail::_S_leaf == this->_M_tree_ptr->_M_tag &&
((_RopeLeaf*)this->_M_tree_ptr)->_M_data ==
this->_M_tree_ptr->_M_c_string)
{
@@ -2013,13 +2040,13 @@ protected:
size_type
max_size() const
{
- return _S_min_len[int(::_S_max_rope_depth) - 1] - 1;
+ return _S_min_len[int(__detail::_S_max_rope_depth) - 1] - 1;
// Guarantees that the result can be sufficirntly
// balanced. Longer ropes will probably still work,
// but it's harder to make guarantees.
}
- typedef reverse_iterator<const_iterator> const_reverse_iterator;
+ typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
const_reverse_iterator
rbegin() const
@@ -2049,12 +2076,13 @@ protected:
template<class _CharT2, class _Alloc2>
friend rope<_CharT2, _Alloc2>
operator+(const rope<_CharT2, _Alloc2>& __left, _CharT2 __right);
- // The symmetric cases are intentionally omitted, since they're presumed
- // to be less common, and we don't handle them as well.
- // The following should really be templatized.
- // The first argument should be an input iterator or
- // forward iterator with value_type _CharT.
+ // The symmetric cases are intentionally omitted, since they're
+ // presumed to be less common, and we don't handle them as well.
+
+ // The following should really be templatized. The first
+ // argument should be an input iterator or forward iterator with
+ // value_type _CharT.
rope&
append(const _CharT* __iter, size_t __n)
{
@@ -2550,7 +2578,7 @@ protected:
mutable_end()
{ return(iterator(this, size())); }
- typedef reverse_iterator<iterator> reverse_iterator;
+ typedef std::reverse_iterator<iterator> reverse_iterator;
reverse_iterator
mutable_rbegin()
@@ -2576,9 +2604,9 @@ protected:
return (*this)[__pos];
}
- void resize(size_type __n, _CharT __c) {}
- void resize(size_type __n) {}
- void reserve(size_type __res_arg = 0) {}
+ void resize(size_type __n, _CharT __c) { }
+ void resize(size_type __n) { }
+ void reserve(size_type __res_arg = 0) { }
size_type
capacity() const
@@ -2747,21 +2775,21 @@ protected:
__x._M_current_pos + __n); }
template <class _CharT, class _Alloc>
- inline _Rope_iterator<_CharT,_Alloc>
+ inline _Rope_iterator<_CharT, _Alloc>
operator+(ptrdiff_t __n, const _Rope_iterator<_CharT, _Alloc>& __x)
{ return _Rope_iterator<_CharT, _Alloc>(__x._M_root_rope,
__x._M_current_pos + __n); }
template <class _CharT, class _Alloc>
- inline rope<_CharT,_Alloc>
+ inline rope<_CharT, _Alloc>
operator+(const rope<_CharT, _Alloc>& __left,
const rope<_CharT, _Alloc>& __right)
{
- return rope<_CharT, _Alloc>(rope<_CharT, _Alloc>::
- _S_concat(__left._M_tree_ptr,
- __right._M_tree_ptr));
// Inlining this should make it possible to keep __left and
// __right in registers.
+ typedef rope<_CharT, _Alloc> rope_type;
+ return rope_type(rope_type::_S_concat(__left._M_tree_ptr,
+ __right._M_tree_ptr));
}
template <class _CharT, class _Alloc>
@@ -2778,9 +2806,9 @@ protected:
operator+(const rope<_CharT, _Alloc>& __left,
const _CharT* __right)
{
- size_t __rlen = rope<_CharT,_Alloc>::_S_char_ptr_len(__right);
- return rope<_CharT, _Alloc>(rope<_CharT, _Alloc>::
- _S_concat_char_iter(__left._M_tree_ptr,
+ typedef rope<_CharT, _Alloc> rope_type;
+ size_t __rlen = rope_type::_S_char_ptr_len(__right);
+ return rope_type(rope_type::_S_concat_char_iter(__left._M_tree_ptr,
__right, __rlen));
}
@@ -2797,8 +2825,8 @@ protected:
inline rope<_CharT, _Alloc>
operator+(const rope<_CharT, _Alloc>& __left, _CharT __right)
{
- return rope<_CharT, _Alloc>(rope<_CharT, _Alloc>::
- _S_concat_char_iter(__left._M_tree_ptr,
+ typedef rope<_CharT, _Alloc> rope_type;
+ return rope_type(rope_type::_S_concat_char_iter(__left._M_tree_ptr,
&__right, 1));
}
@@ -2887,7 +2915,6 @@ protected:
operator()(const crope& __str) const
{
size_t __size = __str.size();
-
if (0 == __size)
return 0;
return 13 * __str[0] + 5 * __str[__size - 1] + __size;
@@ -2902,7 +2929,6 @@ protected:
operator()(const wrope& __str) const
{
size_t __size = __str.size();
-
if (0 == __size)
return 0;
return 13 * __str[0] + 5 * __str[__size - 1] + __size;