stl_construct.h (_Destroy(_ForwardIterator, _ForwardIterator __last, _Allocator)): Change the last parameter to _Allocator&.
2007-05-04 Paolo Carlini <pcarlini@suse.de> * include/bits/stl_construct.h (_Destroy(_ForwardIterator, _ForwardIterator __last, _Allocator)): Change the last parameter to _Allocator&. * include/bits/stl_uninitialized.h (__uninitialized_copy_a, __uninitialized_fill_a, __uninitialized_fill_n_a, __uninitialized_fill_copy, __uninitialized_copy_fill, __uninitialized_copy_copy): Likewise. * include/ext/rope: Adjust everywhere. * include/ext/ropeimpl.h: Likewise. From-SVN: r124427
This commit is contained in:
parent
b2890f04bd
commit
c531371e87
@ -1,3 +1,15 @@
|
|||||||
|
2007-05-04 Paolo Carlini <pcarlini@suse.de>
|
||||||
|
|
||||||
|
* include/bits/stl_construct.h (_Destroy(_ForwardIterator,
|
||||||
|
_ForwardIterator __last, _Allocator)): Change the last parameter
|
||||||
|
to _Allocator&.
|
||||||
|
* include/bits/stl_uninitialized.h (__uninitialized_copy_a,
|
||||||
|
__uninitialized_fill_a, __uninitialized_fill_n_a,
|
||||||
|
__uninitialized_fill_copy, __uninitialized_copy_fill,
|
||||||
|
__uninitialized_copy_copy): Likewise.
|
||||||
|
* include/ext/rope: Adjust everywhere.
|
||||||
|
* include/ext/ropeimpl.h: Likewise.
|
||||||
|
|
||||||
2007-05-03 Benjamin Kosnik <bkoz@redhat.com>
|
2007-05-03 Benjamin Kosnik <bkoz@redhat.com>
|
||||||
|
|
||||||
* include/std/type_traits (enable_if): New.
|
* include/std/type_traits (enable_if): New.
|
||||||
|
@ -137,7 +137,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
|
|||||||
template<typename _ForwardIterator, typename _Allocator>
|
template<typename _ForwardIterator, typename _Allocator>
|
||||||
void
|
void
|
||||||
_Destroy(_ForwardIterator __first, _ForwardIterator __last,
|
_Destroy(_ForwardIterator __first, _ForwardIterator __last,
|
||||||
_Allocator __alloc)
|
_Allocator& __alloc)
|
||||||
{
|
{
|
||||||
for (; __first != __last; ++__first)
|
for (; __first != __last; ++__first)
|
||||||
__alloc.destroy(&*__first);
|
__alloc.destroy(&*__first);
|
||||||
@ -146,7 +146,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
|
|||||||
template<typename _ForwardIterator, typename _Tp>
|
template<typename _ForwardIterator, typename _Tp>
|
||||||
inline void
|
inline void
|
||||||
_Destroy(_ForwardIterator __first, _ForwardIterator __last,
|
_Destroy(_ForwardIterator __first, _ForwardIterator __last,
|
||||||
allocator<_Tp>)
|
allocator<_Tp>&)
|
||||||
{
|
{
|
||||||
_Destroy(__first, __last);
|
_Destroy(__first, __last);
|
||||||
}
|
}
|
||||||
|
@ -198,8 +198,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
|
|||||||
typename _Allocator>
|
typename _Allocator>
|
||||||
_ForwardIterator
|
_ForwardIterator
|
||||||
__uninitialized_copy_a(_InputIterator __first, _InputIterator __last,
|
__uninitialized_copy_a(_InputIterator __first, _InputIterator __last,
|
||||||
_ForwardIterator __result,
|
_ForwardIterator __result, _Allocator& __alloc)
|
||||||
_Allocator __alloc)
|
|
||||||
{
|
{
|
||||||
_ForwardIterator __cur = __result;
|
_ForwardIterator __cur = __result;
|
||||||
try
|
try
|
||||||
@ -218,14 +217,13 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
|
|||||||
template<typename _InputIterator, typename _ForwardIterator, typename _Tp>
|
template<typename _InputIterator, typename _ForwardIterator, typename _Tp>
|
||||||
inline _ForwardIterator
|
inline _ForwardIterator
|
||||||
__uninitialized_copy_a(_InputIterator __first, _InputIterator __last,
|
__uninitialized_copy_a(_InputIterator __first, _InputIterator __last,
|
||||||
_ForwardIterator __result,
|
_ForwardIterator __result, allocator<_Tp>&)
|
||||||
allocator<_Tp>)
|
|
||||||
{ return std::uninitialized_copy(__first, __last, __result); }
|
{ return std::uninitialized_copy(__first, __last, __result); }
|
||||||
|
|
||||||
template<typename _ForwardIterator, typename _Tp, typename _Allocator>
|
template<typename _ForwardIterator, typename _Tp, typename _Allocator>
|
||||||
void
|
void
|
||||||
__uninitialized_fill_a(_ForwardIterator __first, _ForwardIterator __last,
|
__uninitialized_fill_a(_ForwardIterator __first, _ForwardIterator __last,
|
||||||
const _Tp& __x, _Allocator __alloc)
|
const _Tp& __x, _Allocator& __alloc)
|
||||||
{
|
{
|
||||||
_ForwardIterator __cur = __first;
|
_ForwardIterator __cur = __first;
|
||||||
try
|
try
|
||||||
@ -243,15 +241,14 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
|
|||||||
template<typename _ForwardIterator, typename _Tp, typename _Tp2>
|
template<typename _ForwardIterator, typename _Tp, typename _Tp2>
|
||||||
inline void
|
inline void
|
||||||
__uninitialized_fill_a(_ForwardIterator __first, _ForwardIterator __last,
|
__uninitialized_fill_a(_ForwardIterator __first, _ForwardIterator __last,
|
||||||
const _Tp& __x, allocator<_Tp2>)
|
const _Tp& __x, allocator<_Tp2>&)
|
||||||
{ std::uninitialized_fill(__first, __last, __x); }
|
{ std::uninitialized_fill(__first, __last, __x); }
|
||||||
|
|
||||||
template<typename _ForwardIterator, typename _Size, typename _Tp,
|
template<typename _ForwardIterator, typename _Size, typename _Tp,
|
||||||
typename _Allocator>
|
typename _Allocator>
|
||||||
void
|
void
|
||||||
__uninitialized_fill_n_a(_ForwardIterator __first, _Size __n,
|
__uninitialized_fill_n_a(_ForwardIterator __first, _Size __n,
|
||||||
const _Tp& __x,
|
const _Tp& __x, _Allocator& __alloc)
|
||||||
_Allocator __alloc)
|
|
||||||
{
|
{
|
||||||
_ForwardIterator __cur = __first;
|
_ForwardIterator __cur = __first;
|
||||||
try
|
try
|
||||||
@ -270,8 +267,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
|
|||||||
typename _Tp2>
|
typename _Tp2>
|
||||||
inline void
|
inline void
|
||||||
__uninitialized_fill_n_a(_ForwardIterator __first, _Size __n,
|
__uninitialized_fill_n_a(_ForwardIterator __first, _Size __n,
|
||||||
const _Tp& __x,
|
const _Tp& __x, allocator<_Tp2>&)
|
||||||
allocator<_Tp2>)
|
|
||||||
{ std::uninitialized_fill_n(__first, __n, __x); }
|
{ std::uninitialized_fill_n(__first, __n, __x); }
|
||||||
|
|
||||||
|
|
||||||
@ -292,7 +288,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
|
|||||||
_InputIterator2 __first2,
|
_InputIterator2 __first2,
|
||||||
_InputIterator2 __last2,
|
_InputIterator2 __last2,
|
||||||
_ForwardIterator __result,
|
_ForwardIterator __result,
|
||||||
_Allocator __alloc)
|
_Allocator& __alloc)
|
||||||
{
|
{
|
||||||
_ForwardIterator __mid = std::__uninitialized_copy_a(__first1, __last1,
|
_ForwardIterator __mid = std::__uninitialized_copy_a(__first1, __last1,
|
||||||
__result,
|
__result,
|
||||||
@ -316,8 +312,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
|
|||||||
inline _ForwardIterator
|
inline _ForwardIterator
|
||||||
__uninitialized_fill_copy(_ForwardIterator __result, _ForwardIterator __mid,
|
__uninitialized_fill_copy(_ForwardIterator __result, _ForwardIterator __mid,
|
||||||
const _Tp& __x, _InputIterator __first,
|
const _Tp& __x, _InputIterator __first,
|
||||||
_InputIterator __last,
|
_InputIterator __last, _Allocator& __alloc)
|
||||||
_Allocator __alloc)
|
|
||||||
{
|
{
|
||||||
std::__uninitialized_fill_a(__result, __mid, __x, __alloc);
|
std::__uninitialized_fill_a(__result, __mid, __x, __alloc);
|
||||||
try
|
try
|
||||||
@ -340,7 +335,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
|
|||||||
__uninitialized_copy_fill(_InputIterator __first1, _InputIterator __last1,
|
__uninitialized_copy_fill(_InputIterator __first1, _InputIterator __last1,
|
||||||
_ForwardIterator __first2,
|
_ForwardIterator __first2,
|
||||||
_ForwardIterator __last2, const _Tp& __x,
|
_ForwardIterator __last2, const _Tp& __x,
|
||||||
_Allocator __alloc)
|
_Allocator& __alloc)
|
||||||
{
|
{
|
||||||
_ForwardIterator __mid2 = std::__uninitialized_copy_a(__first1, __last1,
|
_ForwardIterator __mid2 = std::__uninitialized_copy_a(__first1, __last1,
|
||||||
__first2,
|
__first2,
|
||||||
|
@ -533,6 +533,14 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
|
|||||||
get_allocator() const
|
get_allocator() const
|
||||||
{ return *static_cast<const _Alloc*>(this); }
|
{ 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&)
|
_Rope_rep_base(size_t __size, const allocator_type&)
|
||||||
: _M_size(__size) { }
|
: _M_size(__size) { }
|
||||||
|
|
||||||
@ -572,9 +580,10 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
|
|||||||
allocator_type;
|
allocator_type;
|
||||||
|
|
||||||
using _Rope_rep_base<_CharT, _Alloc>::get_allocator;
|
using _Rope_rep_base<_CharT, _Alloc>::get_allocator;
|
||||||
|
using _Rope_rep_base<_CharT, _Alloc>::_M_get_allocator;
|
||||||
|
|
||||||
_Rope_RopeRep(__detail::_Tag __t, int __d, bool __b, size_t __size,
|
_Rope_RopeRep(__detail::_Tag __t, int __d, bool __b, size_t __size,
|
||||||
allocator_type __a)
|
const allocator_type& __a)
|
||||||
: _Rope_rep_base<_CharT, _Alloc>(__size, __a),
|
: _Rope_rep_base<_CharT, _Alloc>(__size, __a),
|
||||||
#ifndef __GC
|
#ifndef __GC
|
||||||
_Refcount_Base(1),
|
_Refcount_Base(1),
|
||||||
@ -595,7 +604,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
|
|||||||
#endif
|
#endif
|
||||||
static void
|
static void
|
||||||
_S_free_string(__GC_CONST _CharT*, size_t __len,
|
_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);
|
#define __STL_FREE_STRING(__s, __l, __a) _S_free_string(__s, __l, __a);
|
||||||
// Deallocate data section of a leaf.
|
// Deallocate data section of a leaf.
|
||||||
// This shouldn't be a member function.
|
// This shouldn't be a member function.
|
||||||
@ -689,7 +698,7 @@ protected:
|
|||||||
allocator_type;
|
allocator_type;
|
||||||
|
|
||||||
_Rope_RopeLeaf(__GC_CONST _CharT* __d, size_t __size,
|
_Rope_RopeLeaf(__GC_CONST _CharT* __d, size_t __size,
|
||||||
allocator_type __a)
|
const allocator_type& __a)
|
||||||
: _Rope_RopeRep<_CharT, _Alloc>(__detail::_S_leaf, 0, true,
|
: _Rope_RopeRep<_CharT, _Alloc>(__detail::_S_leaf, 0, true,
|
||||||
__size, __a), _M_data(__d)
|
__size, __a), _M_data(__d)
|
||||||
{
|
{
|
||||||
@ -708,7 +717,7 @@ protected:
|
|||||||
if (_M_data != this->_M_c_string)
|
if (_M_data != this->_M_c_string)
|
||||||
this->_M_free_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
|
#endif
|
||||||
protected:
|
protected:
|
||||||
@ -731,7 +740,7 @@ protected:
|
|||||||
|
|
||||||
_Rope_RopeConcatenation(_Rope_RopeRep<_CharT, _Alloc>* __l,
|
_Rope_RopeConcatenation(_Rope_RopeRep<_CharT, _Alloc>* __l,
|
||||||
_Rope_RopeRep<_CharT, _Alloc>* __r,
|
_Rope_RopeRep<_CharT, _Alloc>* __r,
|
||||||
allocator_type __a)
|
const allocator_type& __a)
|
||||||
: _Rope_RopeRep<_CharT, _Alloc>(__detail::_S_concat,
|
: _Rope_RopeRep<_CharT, _Alloc>(__detail::_S_concat,
|
||||||
std::max(__l->_M_depth,
|
std::max(__l->_M_depth,
|
||||||
__r->_M_depth) + 1,
|
__r->_M_depth) + 1,
|
||||||
@ -779,7 +788,7 @@ protected:
|
|||||||
allocator_type;
|
allocator_type;
|
||||||
|
|
||||||
_Rope_RopeFunction(char_producer<_CharT>* __f, size_t __size,
|
_Rope_RopeFunction(char_producer<_CharT>* __f, size_t __size,
|
||||||
bool __d, allocator_type __a)
|
bool __d, const allocator_type& __a)
|
||||||
: _Rope_RopeRep<_CharT, _Alloc>(__detail::_S_function, 0, true, __size, __a)
|
: _Rope_RopeRep<_CharT, _Alloc>(__detail::_S_function, 0, true, __size, __a)
|
||||||
, _M_fn(__f)
|
, _M_fn(__f)
|
||||||
#ifndef __GC
|
#ifndef __GC
|
||||||
@ -856,7 +865,7 @@ protected:
|
|||||||
allocator_type;
|
allocator_type;
|
||||||
|
|
||||||
_Rope_RopeSubstring(_Rope_RopeRep<_CharT, _Alloc>* __b, size_t __s,
|
_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),
|
: _Rope_RopeFunction<_CharT, _Alloc>(this, __l, false, __a),
|
||||||
char_producer<_CharT>(), _M_base(__b), _M_start(__s)
|
char_producer<_CharT>(), _M_base(__b), _M_start(__s)
|
||||||
{
|
{
|
||||||
@ -1444,6 +1453,14 @@ protected:
|
|||||||
get_allocator() const
|
get_allocator() const
|
||||||
{ return *static_cast<const _Alloc*>(this); }
|
{ 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;
|
typedef _Rope_RopeRep<_CharT, _Alloc> _RopeRep;
|
||||||
// The one in _Base may not be visible due to template rules.
|
// The one in _Base may not be visible due to template rules.
|
||||||
|
|
||||||
@ -1504,6 +1521,7 @@ protected:
|
|||||||
typedef typename _Base::allocator_type allocator_type;
|
typedef typename _Base::allocator_type allocator_type;
|
||||||
using _Base::_M_tree_ptr;
|
using _Base::_M_tree_ptr;
|
||||||
using _Base::get_allocator;
|
using _Base::get_allocator;
|
||||||
|
using _Base::_M_get_allocator;
|
||||||
typedef __GC_CONST _CharT* _Cstrptr;
|
typedef __GC_CONST _CharT* _Cstrptr;
|
||||||
|
|
||||||
static _CharT _S_empty_c_str[1];
|
static _CharT _S_empty_c_str[1];
|
||||||
@ -1614,7 +1632,7 @@ protected:
|
|||||||
// Takes ownership of s instead of copying.
|
// Takes ownership of s instead of copying.
|
||||||
static _RopeLeaf*
|
static _RopeLeaf*
|
||||||
_S_new_RopeLeaf(__GC_CONST _CharT *__s,
|
_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);
|
_RopeLeaf* __space = typename _Base::_LAlloc(__a).allocate(1);
|
||||||
return new(__space) _RopeLeaf(__s, __size, __a);
|
return new(__space) _RopeLeaf(__s, __size, __a);
|
||||||
@ -1622,7 +1640,7 @@ protected:
|
|||||||
|
|
||||||
static _RopeConcatenation*
|
static _RopeConcatenation*
|
||||||
_S_new_RopeConcatenation(_RopeRep* __left, _RopeRep* __right,
|
_S_new_RopeConcatenation(_RopeRep* __left, _RopeRep* __right,
|
||||||
allocator_type __a)
|
allocator_type& __a)
|
||||||
{
|
{
|
||||||
_RopeConcatenation* __space = typename _Base::_CAlloc(__a).allocate(1);
|
_RopeConcatenation* __space = typename _Base::_CAlloc(__a).allocate(1);
|
||||||
return new(__space) _RopeConcatenation(__left, __right, __a);
|
return new(__space) _RopeConcatenation(__left, __right, __a);
|
||||||
@ -1630,7 +1648,7 @@ protected:
|
|||||||
|
|
||||||
static _RopeFunction*
|
static _RopeFunction*
|
||||||
_S_new_RopeFunction(char_producer<_CharT>* __f,
|
_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);
|
_RopeFunction* __space = typename _Base::_FAlloc(__a).allocate(1);
|
||||||
return new(__space) _RopeFunction(__f, __size, __d, __a);
|
return new(__space) _RopeFunction(__f, __size, __d, __a);
|
||||||
@ -1638,7 +1656,7 @@ protected:
|
|||||||
|
|
||||||
static _RopeSubstring*
|
static _RopeSubstring*
|
||||||
_S_new_RopeSubstring(_Rope_RopeRep<_CharT,_Alloc>* __b, size_t __s,
|
_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);
|
_RopeSubstring* __space = typename _Base::_SAlloc(__a).allocate(1);
|
||||||
return new(__space) _RopeSubstring(__b, __s, __l, __a);
|
return new(__space) _RopeSubstring(__b, __s, __l, __a);
|
||||||
@ -1646,7 +1664,7 @@ protected:
|
|||||||
|
|
||||||
static _RopeLeaf*
|
static _RopeLeaf*
|
||||||
_S_RopeLeaf_from_unowned_char_ptr(const _CharT *__s,
|
_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) \
|
#define __STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __size, __a) \
|
||||||
_S_RopeLeaf_from_unowned_char_ptr(__s, __size, __a)
|
_S_RopeLeaf_from_unowned_char_ptr(__s, __size, __a)
|
||||||
{
|
{
|
||||||
@ -1768,22 +1786,31 @@ protected:
|
|||||||
{ return _S_compare(this->_M_tree_ptr, __y._M_tree_ptr); }
|
{ return _S_compare(this->_M_tree_ptr, __y._M_tree_ptr); }
|
||||||
|
|
||||||
rope(const _CharT* __s, const allocator_type& __a = allocator_type())
|
rope(const _CharT* __s, const allocator_type& __a = allocator_type())
|
||||||
: _Base(__STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, _S_char_ptr_len(__s),
|
: _Base(__a)
|
||||||
__a), __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,
|
rope(const _CharT* __s, size_t __len,
|
||||||
const allocator_type& __a = allocator_type())
|
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
|
// Should perhaps be templatized with respect to the iterator type
|
||||||
// and use Sequence_buffer. (It should perhaps use sequence_buffer
|
// and use Sequence_buffer. (It should perhaps use sequence_buffer
|
||||||
// even now.)
|
// even now.)
|
||||||
rope(const _CharT *__s, const _CharT *__e,
|
rope(const _CharT* __s, const _CharT* __e,
|
||||||
const allocator_type& __a = allocator_type())
|
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,
|
rope(const const_iterator& __s, const const_iterator& __e,
|
||||||
const allocator_type& __a = allocator_type())
|
const allocator_type& __a = allocator_type())
|
||||||
@ -1802,12 +1829,15 @@ protected:
|
|||||||
{
|
{
|
||||||
_CharT* __buf = this->_Data_allocate(_S_rounded_up_size(1));
|
_CharT* __buf = this->_Data_allocate(_S_rounded_up_size(1));
|
||||||
|
|
||||||
get_allocator().construct(__buf, __c);
|
_M_get_allocator().construct(__buf, __c);
|
||||||
try
|
try
|
||||||
{ this->_M_tree_ptr = _S_new_RopeLeaf(__buf, 1, __a); }
|
{
|
||||||
|
this->_M_tree_ptr = _S_new_RopeLeaf(__buf, 1,
|
||||||
|
_M_get_allocator());
|
||||||
|
}
|
||||||
catch(...)
|
catch(...)
|
||||||
{
|
{
|
||||||
_RopeRep::__STL_FREE_STRING(__buf, 1, __a);
|
_RopeRep::__STL_FREE_STRING(__buf, 1, _M_get_allocator());
|
||||||
__throw_exception_again;
|
__throw_exception_again;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1878,7 +1908,7 @@ protected:
|
|||||||
{
|
{
|
||||||
_RopeRep* __old = this->_M_tree_ptr;
|
_RopeRep* __old = this->_M_tree_ptr;
|
||||||
_RopeRep* __left =
|
_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
|
try
|
||||||
{
|
{
|
||||||
this->_M_tree_ptr = _S_concat(__left, this->_M_tree_ptr);
|
this->_M_tree_ptr = _S_concat(__left, this->_M_tree_ptr);
|
||||||
@ -1916,7 +1946,7 @@ protected:
|
|||||||
void
|
void
|
||||||
copy(_CharT* __buffer) const
|
copy(_CharT* __buffer) const
|
||||||
{
|
{
|
||||||
_Destroy(__buffer, __buffer + size(), get_allocator());
|
_Destroy(__buffer, __buffer + size(), _M_get_allocator());
|
||||||
_S_flatten(this->_M_tree_ptr, __buffer);
|
_S_flatten(this->_M_tree_ptr, __buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1931,7 +1961,7 @@ protected:
|
|||||||
size_t __size = size();
|
size_t __size = size();
|
||||||
size_t __len = (__pos + __n > __size? __size - __pos : __n);
|
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);
|
_S_flatten(this->_M_tree_ptr, __pos, __len, __buffer);
|
||||||
return __len;
|
return __len;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// SGI's rope class implementation -*- C++ -*-
|
// SGI's rope class implementation -*- C++ -*-
|
||||||
|
|
||||||
// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006
|
// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007
|
||||||
// Free Software Foundation, Inc.
|
// Free Software Foundation, Inc.
|
||||||
//
|
//
|
||||||
// This file is part of the GNU ISO C++ Library. This library is free
|
// This file is part of the GNU ISO C++ Library. This library is free
|
||||||
@ -347,7 +347,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
|
|||||||
if (0 != __cstr)
|
if (0 != __cstr)
|
||||||
{
|
{
|
||||||
size_t __size = this->_M_size + 1;
|
size_t __size = this->_M_size + 1;
|
||||||
_Destroy(__cstr, __cstr + __size, get_allocator());
|
_Destroy(__cstr, __cstr + __size, _M_get_allocator());
|
||||||
this->_Data_deallocate(__cstr, __size);
|
this->_Data_deallocate(__cstr, __size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -355,7 +355,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
|
|||||||
template <class _CharT, class _Alloc>
|
template <class _CharT, class _Alloc>
|
||||||
inline void
|
inline void
|
||||||
_Rope_RopeRep<_CharT, _Alloc>::
|
_Rope_RopeRep<_CharT, _Alloc>::
|
||||||
_S_free_string(_CharT* __s, size_t __n, allocator_type __a)
|
_S_free_string(_CharT* __s, size_t __n, allocator_type& __a)
|
||||||
{
|
{
|
||||||
if (!_S_is_basic_char_type((_CharT*)0))
|
if (!_S_is_basic_char_type((_CharT*)0))
|
||||||
_Destroy(__s, __s + __n, __a);
|
_Destroy(__s, __s + __n, __a);
|
||||||
@ -442,12 +442,12 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
__result = _S_new_RopeLeaf(__new_data, __old_len + __len,
|
__result = _S_new_RopeLeaf(__new_data, __old_len + __len,
|
||||||
__r->get_allocator());
|
__r->_M_get_allocator());
|
||||||
}
|
}
|
||||||
catch(...)
|
catch(...)
|
||||||
{
|
{
|
||||||
_RopeRep::__STL_FREE_STRING(__new_data, __old_len + __len,
|
_RopeRep::__STL_FREE_STRING(__new_data, __old_len + __len,
|
||||||
__r->get_allocator());
|
__r->_M_get_allocator());
|
||||||
__throw_exception_again;
|
__throw_exception_again;
|
||||||
}
|
}
|
||||||
return __result;
|
return __result;
|
||||||
@ -498,7 +498,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
|
|||||||
{
|
{
|
||||||
_RopeConcatenation* __result = _S_new_RopeConcatenation(__left, __right,
|
_RopeConcatenation* __result = _S_new_RopeConcatenation(__left, __right,
|
||||||
__left->
|
__left->
|
||||||
get_allocator());
|
_M_get_allocator());
|
||||||
size_t __depth = __result->_M_depth;
|
size_t __depth = __result->_M_depth;
|
||||||
|
|
||||||
if (__depth > 20
|
if (__depth > 20
|
||||||
@ -540,7 +540,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
|
|||||||
}
|
}
|
||||||
if (0 == __r)
|
if (0 == __r)
|
||||||
return __STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __slen,
|
return __STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __slen,
|
||||||
__r->get_allocator());
|
__r->_M_get_allocator());
|
||||||
if (__r->_M_tag == __detail::_S_leaf
|
if (__r->_M_tag == __detail::_S_leaf
|
||||||
&& __r->_M_size + __slen <= size_t(_S_copy_max))
|
&& __r->_M_size + __slen <= size_t(_S_copy_max))
|
||||||
{
|
{
|
||||||
@ -570,7 +570,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
_RopeRep* __nright =
|
_RopeRep* __nright =
|
||||||
__STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __slen, __r->get_allocator());
|
__STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __slen, __r->_M_get_allocator());
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
__r->_M_ref_nonnil();
|
__r->_M_ref_nonnil();
|
||||||
@ -594,7 +594,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
|
|||||||
_RopeRep* __result;
|
_RopeRep* __result;
|
||||||
if (0 == __r)
|
if (0 == __r)
|
||||||
return __STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __slen,
|
return __STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __slen,
|
||||||
__r->get_allocator());
|
__r->_M_get_allocator());
|
||||||
size_t __count = __r->_M_ref_count;
|
size_t __count = __r->_M_ref_count;
|
||||||
size_t __orig_size = __r->_M_size;
|
size_t __orig_size = __r->_M_size;
|
||||||
if (__count > 1)
|
if (__count > 1)
|
||||||
@ -636,7 +636,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
_RopeRep* __right =
|
_RopeRep* __right =
|
||||||
__STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __slen, __r->get_allocator());
|
__STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __slen, __r->_M_get_allocator());
|
||||||
__r->_M_ref_nonnil();
|
__r->_M_ref_nonnil();
|
||||||
try
|
try
|
||||||
{ __result = _S_tree_concat(__r, __right); }
|
{ __result = _S_tree_concat(__r, __right); }
|
||||||
@ -775,14 +775,14 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
|
|||||||
#ifdef __GC
|
#ifdef __GC
|
||||||
const _CharT* __section = __l->_M_data + __start;
|
const _CharT* __section = __l->_M_data + __start;
|
||||||
__result = _S_new_RopeLeaf(__section, __result_len,
|
__result = _S_new_RopeLeaf(__section, __result_len,
|
||||||
__base->get_allocator());
|
__base->_M_get_allocator());
|
||||||
__result->_M_c_string = 0; // Not eos terminated.
|
__result->_M_c_string = 0; // Not eos terminated.
|
||||||
#else
|
#else
|
||||||
// We should sometimes create substring node instead.
|
// We should sometimes create substring node instead.
|
||||||
__result = __STL_ROPE_FROM_UNOWNED_CHAR_PTR(__l->_M_data + __start,
|
__result = __STL_ROPE_FROM_UNOWNED_CHAR_PTR(__l->_M_data + __start,
|
||||||
__result_len,
|
__result_len,
|
||||||
__base->
|
__base->
|
||||||
get_allocator());
|
_M_get_allocator());
|
||||||
#endif
|
#endif
|
||||||
return __result;
|
return __result;
|
||||||
}
|
}
|
||||||
@ -800,7 +800,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
|
|||||||
_S_new_RopeSubstring(__old->_M_base,
|
_S_new_RopeSubstring(__old->_M_base,
|
||||||
__start + __old->_M_start,
|
__start + __old->_M_start,
|
||||||
__adj_endp1 - __start,
|
__adj_endp1 - __start,
|
||||||
__base->get_allocator());
|
__base->_M_get_allocator());
|
||||||
return __result;
|
return __result;
|
||||||
|
|
||||||
} // *** else fall through: ***
|
} // *** else fall through: ***
|
||||||
@ -823,19 +823,19 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
|
|||||||
catch(...)
|
catch(...)
|
||||||
{
|
{
|
||||||
_RopeRep::__STL_FREE_STRING(__section, __result_len,
|
_RopeRep::__STL_FREE_STRING(__section, __result_len,
|
||||||
__base->get_allocator());
|
__base->_M_get_allocator());
|
||||||
__throw_exception_again;
|
__throw_exception_again;
|
||||||
}
|
}
|
||||||
_S_cond_store_eos(__section[__result_len]);
|
_S_cond_store_eos(__section[__result_len]);
|
||||||
return _S_new_RopeLeaf(__section, __result_len,
|
return _S_new_RopeLeaf(__section, __result_len,
|
||||||
__base->get_allocator());
|
__base->_M_get_allocator());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
lazy:
|
lazy:
|
||||||
{
|
{
|
||||||
// Create substring node.
|
// Create substring node.
|
||||||
return _S_new_RopeSubstring(__base, __start, __adj_endp1 - __start,
|
return _S_new_RopeSubstring(__base, __start, __adj_endp1 - __start,
|
||||||
__base->get_allocator());
|
__base->_M_get_allocator());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1550,13 +1550,15 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
|
|||||||
{
|
{
|
||||||
__rest_buffer = this->_Data_allocate(_S_rounded_up_size(__rest));
|
__rest_buffer = this->_Data_allocate(_S_rounded_up_size(__rest));
|
||||||
__uninitialized_fill_n_a(__rest_buffer, __rest, __c,
|
__uninitialized_fill_n_a(__rest_buffer, __rest, __c,
|
||||||
get_allocator());
|
_M_get_allocator());
|
||||||
_S_cond_store_eos(__rest_buffer[__rest]);
|
_S_cond_store_eos(__rest_buffer[__rest]);
|
||||||
try
|
try
|
||||||
{ __remainder = _S_new_RopeLeaf(__rest_buffer, __rest, __a); }
|
{ __remainder = _S_new_RopeLeaf(__rest_buffer, __rest,
|
||||||
|
_M_get_allocator()); }
|
||||||
catch(...)
|
catch(...)
|
||||||
{
|
{
|
||||||
_RopeRep::__STL_FREE_STRING(__rest_buffer, __rest, __a);
|
_RopeRep::__STL_FREE_STRING(__rest_buffer, __rest,
|
||||||
|
_M_get_allocator());
|
||||||
__throw_exception_again;
|
__throw_exception_again;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1568,17 +1570,19 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
|
|||||||
_RopeLeaf* __base_leaf;
|
_RopeLeaf* __base_leaf;
|
||||||
rope __base_rope;
|
rope __base_rope;
|
||||||
__uninitialized_fill_n_a(__base_buffer, __exponentiate_threshold, __c,
|
__uninitialized_fill_n_a(__base_buffer, __exponentiate_threshold, __c,
|
||||||
get_allocator());
|
_M_get_allocator());
|
||||||
_S_cond_store_eos(__base_buffer[__exponentiate_threshold]);
|
_S_cond_store_eos(__base_buffer[__exponentiate_threshold]);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
__base_leaf = _S_new_RopeLeaf(__base_buffer,
|
__base_leaf = _S_new_RopeLeaf(__base_buffer,
|
||||||
__exponentiate_threshold, __a);
|
__exponentiate_threshold,
|
||||||
|
_M_get_allocator());
|
||||||
}
|
}
|
||||||
catch(...)
|
catch(...)
|
||||||
{
|
{
|
||||||
_RopeRep::__STL_FREE_STRING(__base_buffer,
|
_RopeRep::__STL_FREE_STRING(__base_buffer,
|
||||||
__exponentiate_threshold, __a);
|
__exponentiate_threshold,
|
||||||
|
_M_get_allocator());
|
||||||
__throw_exception_again;
|
__throw_exception_again;
|
||||||
}
|
}
|
||||||
__base_rope._M_tree_ptr = __base_leaf;
|
__base_rope._M_tree_ptr = __base_leaf;
|
||||||
@ -1646,7 +1650,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
|
|||||||
__result[__s] = _S_eos((_CharT*)0);
|
__result[__s] = _S_eos((_CharT*)0);
|
||||||
this->_M_tree_ptr->_M_unref_nonnil();
|
this->_M_tree_ptr->_M_unref_nonnil();
|
||||||
this->_M_tree_ptr = _S_new_RopeLeaf(__result, __s,
|
this->_M_tree_ptr = _S_new_RopeLeaf(__result, __s,
|
||||||
this->get_allocator());
|
this->_M_get_allocator());
|
||||||
return(__result);
|
return(__result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user