+2019-05-31 Jonathan Wakely <jwakely@redhat.com>
+
+ * include/backward/hashtable.h (size_t, ptrdiff_t)
+ (forward_iterator_tag, input_iterator_tag, _Construct, _Destroy)
+ (distance, vector, pair, __iterator_category): Remove
+ using-declarations that add these names to namespace __gnu_cxx.
+ * include/ext/bitmap_allocator.h (size_t, ptrdiff_t): Likewise.
+ * include/ext/debug_allocator.h (size_t): Likewise.
+ * include/ext/functional (size_t, unary_function, binary_function)
+ (mem_fun1_t, const_mem_fun1_t, mem_fun1_ref_t, const_mem_fun1_ref_t):
+ Likewise.
+ * include/ext/malloc_allocator.h (size_t, ptrdiff_t): Likewise.
+ * include/ext/memory (ptrdiff_t, pair, __iterator_category): Likewise.
+ * include/ext/mt_allocator.h (size_t, ptrdiff_t): Likewise.
+ * include/ext/new_allocator.h (size_t, ptrdiff_t): Likewise.
+ * include/ext/numeric (iota): Fix outdated comment.
+ * include/ext/pool_allocator.h (size_t, ptrdiff_t): Likewise.
+ * include/ext/rb_tree (_Rb_tree, allocator): Likewise.
+ * include/ext/rope (size_t, ptrdiff_t, allocator, _Destroy): Likewise.
+ * include/ext/ropeimpl.h (size_t, printf, basic_ostream)
+ (__throw_length_error, _Destroy, std::__uninitialized_fill_n_a):
+ Likewise.
+ * include/ext/slist (size_t, ptrdiff_t, _Construct, _Destroy)
+ (allocator, __true_type, __false_type): Likewise.
+
2019-05-31 Antony Polukhin <antoshkka@gmail.com>
PR libstdc++/71579
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
- using std::size_t;
- using std::ptrdiff_t;
- using std::forward_iterator_tag;
- using std::input_iterator_tag;
- using std::_Construct;
- using std::_Destroy;
- using std::distance;
- using std::vector;
- using std::pair;
- using std::__iterator_category;
-
template<class _Val>
struct _Hashtable_node
{
_ExtractKey, _EqualKey, _Alloc>
const_iterator;
typedef _Hashtable_node<_Val> _Node;
- typedef forward_iterator_tag iterator_category;
+ typedef std::forward_iterator_tag iterator_category;
typedef _Val value_type;
- typedef ptrdiff_t difference_type;
- typedef size_t size_type;
+ typedef std::ptrdiff_t difference_type;
+ typedef std::size_t size_type;
typedef _Val& reference;
typedef _Val* pointer;
const_iterator;
typedef _Hashtable_node<_Val> _Node;
- typedef forward_iterator_tag iterator_category;
+ typedef std::forward_iterator_tag iterator_category;
typedef _Val value_type;
- typedef ptrdiff_t difference_type;
- typedef size_t size_type;
+ typedef std::ptrdiff_t difference_type;
+ typedef std::size_t size_type;
typedef const _Val& reference;
typedef const _Val* pointer;
typedef _HashFcn hasher;
typedef _EqualKey key_equal;
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
+ typedef std::size_t size_type;
+ typedef std::ptrdiff_t difference_type;
typedef value_type* pointer;
typedef const value_type* const_pointer;
typedef value_type& reference;
private:
typedef typename _Alloc::template rebind<_Node>::other _Node_Alloc;
typedef typename _Alloc::template rebind<_Node*>::other _Nodeptr_Alloc;
- typedef vector<_Node*, _Nodeptr_Alloc> _Vector_type;
+ typedef std::vector<_Node*, _Nodeptr_Alloc> _Vector_type;
_Node_Alloc _M_node_allocator;
return __result;
}
- pair<iterator, bool>
+ std::pair<iterator, bool>
insert_unique(const value_type& __obj)
{
resize(_M_num_elements + 1);
return insert_equal_noresize(__obj);
}
- pair<iterator, bool>
+ std::pair<iterator, bool>
insert_unique_noresize(const value_type& __obj);
iterator
template<class _InputIterator>
void
insert_unique(_InputIterator __f, _InputIterator __l)
- { insert_unique(__f, __l, __iterator_category(__f)); }
+ { insert_unique(__f, __l, std::__iterator_category(__f)); }
template<class _InputIterator>
void
insert_equal(_InputIterator __f, _InputIterator __l)
- { insert_equal(__f, __l, __iterator_category(__f)); }
+ { insert_equal(__f, __l, std::__iterator_category(__f)); }
template<class _InputIterator>
void
insert_unique(_InputIterator __f, _InputIterator __l,
- input_iterator_tag)
+ std::input_iterator_tag)
{
for ( ; __f != __l; ++__f)
insert_unique(*__f);
template<class _InputIterator>
void
insert_equal(_InputIterator __f, _InputIterator __l,
- input_iterator_tag)
+ std::input_iterator_tag)
{
for ( ; __f != __l; ++__f)
insert_equal(*__f);
template<class _ForwardIterator>
void
insert_unique(_ForwardIterator __f, _ForwardIterator __l,
- forward_iterator_tag)
+ std::forward_iterator_tag)
{
- size_type __n = distance(__f, __l);
+ size_type __n = std::distance(__f, __l);
resize(_M_num_elements + __n);
for ( ; __n > 0; --__n, ++__f)
insert_unique_noresize(*__f);
template<class _ForwardIterator>
void
insert_equal(_ForwardIterator __f, _ForwardIterator __l,
- forward_iterator_tag)
+ std::forward_iterator_tag)
{
- size_type __n = distance(__f, __l);
+ size_type __n = std::distance(__f, __l);
resize(_M_num_elements + __n);
for ( ; __n > 0; --__n, ++__f)
insert_equal_noresize(*__f);
return __result;
}
- pair<iterator, iterator>
+ std::pair<iterator, iterator>
equal_range(const key_type& __key);
- pair<const_iterator, const_iterator>
+ std::pair<const_iterator, const_iterator>
equal_range(const key_type& __key) const;
size_type
{ return _M_bkt_num_key(_M_get_key(__obj)); }
size_type
- _M_bkt_num_key(const key_type& __key, size_t __n) const
+ _M_bkt_num_key(const key_type& __key, std::size_t __n) const
{ return _M_hash(__key) % __n; }
size_type
- _M_bkt_num(const value_type& __obj, size_t __n) const
+ _M_bkt_num(const value_type& __obj, std::size_t __n) const
{ return _M_bkt_num_key(_M_get_key(__obj), __n); }
_Node*
if (__ht1._M_buckets.size() != __ht2._M_buckets.size())
return false;
- for (size_t __n = 0; __n < __ht1._M_buckets.size(); ++__n)
+ for (std::size_t __n = 0; __n < __ht1._M_buckets.size(); ++__n)
{
_Node* __cur1 = __ht1._M_buckets[__n];
_Node* __cur2 = __ht2._M_buckets[__n];
{ __ht1.swap(__ht2); }
template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
- pair<typename hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::iterator, bool>
+ std::pair<typename hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::iterator,
+ bool>
hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::
insert_unique_noresize(const value_type& __obj)
{
for (_Node* __cur = __first; __cur; __cur = __cur->_M_next)
if (_M_equals(_M_get_key(__cur->_M_val), _M_get_key(__obj)))
- return pair<iterator, bool>(iterator(__cur, this), false);
+ return std::pair<iterator, bool>(iterator(__cur, this), false);
_Node* __tmp = _M_new_node(__obj);
__tmp->_M_next = __first;
_M_buckets[__n] = __tmp;
++_M_num_elements;
- return pair<iterator, bool>(iterator(__tmp, this), true);
+ return std::pair<iterator, bool>(iterator(__tmp, this), true);
}
template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
}
template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
- pair<typename hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::iterator,
- typename hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::iterator>
+ std::pair<typename hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::iterator,
+ typename hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::iterator>
hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::
equal_range(const key_type& __key)
{
- typedef pair<iterator, iterator> _Pii;
+ typedef std::pair<iterator, iterator> _Pii;
const size_type __n = _M_bkt_num_key(__key);
for (_Node* __first = _M_buckets[__n]; __first;
}
template<class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
- pair<typename hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::const_iterator,
- typename hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::const_iterator>
+ std::pair<
+ typename hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::const_iterator,
+ typename hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::const_iterator>
hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::
equal_range(const key_type& __key) const
{
- typedef pair<const_iterator, const_iterator> _Pii;
+ typedef std::pair<const_iterator, const_iterator> _Pii;
const size_type __n = _M_bkt_num_key(__key);
for (const _Node* __first = _M_buckets[__n]; __first;
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
- using std::size_t;
- using std::ptrdiff_t;
-
namespace __detail
{
/** @class __mini_vector bitmap_allocator.h bitmap_allocator.h
typedef _Tp* pointer;
typedef _Tp& reference;
typedef const _Tp& const_reference;
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
+ typedef std::size_t size_type;
+ typedef std::ptrdiff_t difference_type;
typedef pointer iterator;
private:
struct __mv_iter_traits<_Tp*>
{
typedef _Tp value_type;
- typedef ptrdiff_t difference_type;
+ typedef std::ptrdiff_t difference_type;
};
enum
{
bits_per_byte = 8,
- bits_per_block = sizeof(size_t) * size_t(bits_per_byte)
+ bits_per_block = sizeof(std::size_t) * std::size_t(bits_per_byte)
};
template<typename _ForwardIterator, typename _Tp, typename _Compare>
* passed to the function.
*/
template<typename _AddrPair>
- inline size_t
+ inline std::size_t
__num_blocks(_AddrPair __ap)
{ return (__ap.second - __ap.first) + 1; }
* passed to the function.
*/
template<typename _AddrPair>
- inline size_t
+ inline std::size_t
__num_bitmaps(_AddrPair __ap)
- { return __num_blocks(__ap) / size_t(bits_per_block); }
+ { return __num_blocks(__ap) / std::size_t(bits_per_block); }
// _Tp should be a pointer type.
template<typename _Tp>
typedef typename __detail::__mini_vector<_Block_pair> _BPVector;
typedef typename _BPVector::difference_type _Counter_type;
- size_t* _M_pbitmap;
+ std::size_t* _M_pbitmap;
_Counter_type _M_data_offset;
public:
bool
operator()(_Block_pair __bp) throw()
{
+ using std::size_t;
// Set the _rover to the last physical location bitmap,
// which is the bitmap which belongs to the first free
// block. Thus, the bitmaps are in exact reverse order of
return false;
}
- size_t*
+ std::size_t*
_M_get() const throw()
{ return _M_pbitmap; }
_Counter_type
_M_offset() const throw()
- { return _M_data_offset * size_t(bits_per_block); }
+ { return _M_data_offset * std::size_t(bits_per_block); }
};
/** @class _Bitmap_counter bitmap_allocator.h bitmap_allocator.h
typedef _Tp pointer;
_BPVector& _M_vbp;
- size_t* _M_curr_bmap;
- size_t* _M_last_bmap_in_block;
+ std::size_t* _M_curr_bmap;
+ std::size_t* _M_last_bmap_in_block;
_Index_type _M_curr_index;
public:
}
_M_curr_index = __index;
- _M_curr_bmap = reinterpret_cast<size_t*>
+ _M_curr_bmap = reinterpret_cast<std::size_t*>
(_M_vbp[_M_curr_index].first) - 1;
_GLIBCXX_DEBUG_ASSERT(__index <= (long)_M_vbp.size() - 1);
_M_last_bmap_in_block = _M_curr_bmap
- ((_M_vbp[_M_curr_index].second
- _M_vbp[_M_curr_index].first + 1)
- / size_t(bits_per_block) - 1);
+ / std::size_t(bits_per_block) - 1);
}
// Dangerous Function! Use with extreme care. Pass to this
// function ONLY those values that are known to be correct,
// otherwise this will mess up big time.
void
- _M_set_internal_bitmap(size_t* __new_internal_marker) throw()
+ _M_set_internal_bitmap(std::size_t* __new_internal_marker) throw()
{ _M_curr_bmap = __new_internal_marker; }
bool
return *this;
}
- size_t*
+ std::size_t*
_M_get() const throw()
{ return _M_curr_bmap; }
_Index_type
_M_offset() const throw()
{
- return size_t(bits_per_block)
- * ((reinterpret_cast<size_t*>(this->_M_base())
+ return std::size_t(bits_per_block)
+ * ((reinterpret_cast<std::size_t*>(this->_M_base())
- _M_curr_bmap) - 1);
}
* corresponding bit in the bit-map.
*/
inline void
- __bit_allocate(size_t* __pbmap, size_t __pos) throw()
+ __bit_allocate(std::size_t* __pbmap, std::size_t __pos) throw()
{
- size_t __mask = 1 << __pos;
+ std::size_t __mask = 1 << __pos;
__mask = ~__mask;
*__pbmap &= __mask;
}
* corresponding bit in the bit-map.
*/
inline void
- __bit_free(size_t* __pbmap, size_t __pos) throw()
+ __bit_free(std::size_t* __pbmap, std::size_t __pos) throw()
{
- size_t __mask = 1 << __pos;
+ std::size_t __mask = 1 << __pos;
*__pbmap |= __mask;
}
} // namespace __detail
/** @brief Generic Version of the bsf instruction.
*/
- inline size_t
- _Bit_scan_forward(size_t __num)
- { return static_cast<size_t>(__builtin_ctzl(__num)); }
+ inline std::size_t
+ _Bit_scan_forward(std::size_t __num)
+ { return static_cast<std::size_t>(__builtin_ctzl(__num)); }
/** @class free_list bitmap_allocator.h bitmap_allocator.h
*
class free_list
{
public:
- typedef size_t* value_type;
+ typedef std::size_t* value_type;
typedef __detail::__mini_vector<value_type> vector_type;
typedef vector_type::iterator iterator;
typedef __mutex __mutex_type;
struct _LT_pointer_compare
{
bool
- operator()(const size_t* __pui,
- const size_t __cui) const throw()
+ operator()(const std::size_t* __pui,
+ const std::size_t __cui) const throw()
{ return *__pui < __cui; }
};
* or larger blocks from the free list.
*/
void
- _M_validate(size_t* __addr) throw()
+ _M_validate(std::size_t* __addr) throw()
{
vector_type& __free_list = _M_get_free_list();
const vector_type::size_type __max_size = 64;
* false.
*/
bool
- _M_should_i_give(size_t __block_size,
- size_t __required_size) throw()
+ _M_should_i_give(std::size_t __block_size,
+ std::size_t __required_size) throw()
{
- const size_t __max_wastage_percentage = 36;
+ const std::size_t __max_wastage_percentage = 36;
if (__block_size >= __required_size &&
(((__block_size - __required_size) * 100 / __block_size)
< __max_wastage_percentage))
* by a call to the _M_get function.
*/
inline void
- _M_insert(size_t* __addr) throw()
+ _M_insert(std::size_t* __addr) throw()
{
#if defined __GTHREADS
__scoped_lock __bfl_lock(_M_get_mutex());
#endif
// Call _M_validate to decide what should be done with
// this particular free list.
- this->_M_validate(reinterpret_cast<size_t*>(__addr) - 1);
+ this->_M_validate(reinterpret_cast<std::size_t*>(__addr) - 1);
// See discussion as to why this is 1!
}
* @return A pointer to the new memory block of size at least
* equal to that requested.
*/
- size_t*
- _M_get(size_t __sz) _GLIBCXX_THROW(std::bad_alloc);
+ std::size_t*
+ _M_get(std::size_t __sz) _GLIBCXX_THROW(std::bad_alloc);
/** @brief This function just clears the internal Free List, and
* gives back all the memory to the OS.
class bitmap_allocator : private free_list
{
public:
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
+ typedef std::size_t size_type;
+ typedef std::ptrdiff_t difference_type;
typedef _Tp* pointer;
typedef const _Tp* const_pointer;
typedef _Tp& reference;
#endif
private:
- template<size_t _BSize, size_t _AlignSize>
+ template<std::size_t _BSize, std::size_t _AlignSize>
struct aligned_size
{
enum
void
_S_refill_pool() _GLIBCXX_THROW(std::bad_alloc)
{
+ using std::size_t;
#if defined _GLIBCXX_DEBUG
_S_check_for_free_blocks();
#endif
}
static _BPVector _S_mem_blocks;
- static size_t _S_block_size;
+ static std::size_t _S_block_size;
static __detail::_Bitmap_counter<_Alloc_block*> _S_last_request;
static typename _BPVector::size_type _S_last_dealloc_index;
#if defined __GTHREADS
pointer
_M_allocate_single_object() _GLIBCXX_THROW(std::bad_alloc)
{
+ using std::size_t;
#if defined __GTHREADS
__scoped_lock __bit_lock(_S_mut);
#endif
void
_M_deallocate_single_object(pointer __p) throw()
{
+ using std::size_t;
#if defined __GTHREADS
__scoped_lock __bit_lock(_S_mut);
#endif
bitmap_allocator<_Tp>::_S_mem_blocks;
template<typename _Tp>
- size_t bitmap_allocator<_Tp>::_S_block_size =
- 2 * size_t(__detail::bits_per_block);
+ std::size_t bitmap_allocator<_Tp>::_S_block_size
+ = 2 * std::size_t(__detail::bits_per_block);
template<typename _Tp>
typename bitmap_allocator<_Tp>::_BPVector::size_type
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
- using std::size_t;
-
/**
* @brief A meta-allocator with debugging bits.
* @ingroup allocators
size_type _S_extra()
{
- const size_t __obj_size = sizeof(value_type);
+ const std::size_t __obj_size = sizeof(value_type);
return (sizeof(size_type) + __obj_size - 1) / __obj_size;
}
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
- using std::size_t;
- using std::unary_function;
- using std::binary_function;
- using std::mem_fun1_t;
- using std::const_mem_fun1_t;
- using std::mem_fun1_ref_t;
- using std::const_mem_fun1_ref_t;
-
/** The @c identity_element functions are not part of the C++
* standard; SGI provided them as an extension. Its argument is an
* operation, and its return value is the identity element for that
/// An \link SGIextensions SGI extension \endlink.
template <class _Operation1, class _Operation2>
class unary_compose
- : public unary_function<typename _Operation2::argument_type,
- typename _Operation1::result_type>
+ : public std::unary_function<typename _Operation2::argument_type,
+ typename _Operation1::result_type>
{
protected:
_Operation1 _M_fn1;
/// An \link SGIextensions SGI extension \endlink.
template <class _Operation1, class _Operation2, class _Operation3>
class binary_compose
- : public unary_function<typename _Operation2::argument_type,
- typename _Operation1::result_type>
+ : public std::unary_function<typename _Operation2::argument_type,
+ typename _Operation1::result_type>
{
protected:
_Operation1 _M_fn1;
// extension documented next
template <class _Arg1, class _Arg2>
- struct _Project1st : public binary_function<_Arg1, _Arg2, _Arg1>
+ struct _Project1st : public std::binary_function<_Arg1, _Arg2, _Arg1>
{
_Arg1
operator()(const _Arg1& __x, const _Arg2&) const
};
template <class _Arg1, class _Arg2>
- struct _Project2nd : public binary_function<_Arg1, _Arg2, _Arg2>
+ struct _Project2nd : public std::binary_function<_Arg1, _Arg2, _Arg2>
{
_Arg2
operator()(const _Arg1&, const _Arg2& __y) const
* @ingroup SGIextensions
*/
class subtractive_rng
- : public unary_function<unsigned int, unsigned int>
+ : public std::unary_function<unsigned int, unsigned int>
{
private:
unsigned int _M_table[55];
- size_t _M_index1;
- size_t _M_index2;
+ std::size_t _M_index1;
+ std::size_t _M_index2;
public:
/// Returns a number less than the argument.
{
unsigned int __k = 1;
_M_table[54] = __seed;
- size_t __i;
+ std::size_t __i;
for (__i = 0; __i < 54; __i++)
{
- size_t __ii = (21 * (__i + 1) % 55) - 1;
+ std::size_t __ii = (21 * (__i + 1) % 55) - 1;
_M_table[__ii] = __k;
__k = __seed - __k;
__seed = _M_table[__ii];
// the C++ standard.
template <class _Ret, class _Tp, class _Arg>
- inline mem_fun1_t<_Ret, _Tp, _Arg>
+ inline std::mem_fun1_t<_Ret, _Tp, _Arg>
mem_fun1(_Ret (_Tp::*__f)(_Arg))
- { return mem_fun1_t<_Ret, _Tp, _Arg>(__f); }
+ { return std::mem_fun1_t<_Ret, _Tp, _Arg>(__f); }
template <class _Ret, class _Tp, class _Arg>
- inline const_mem_fun1_t<_Ret, _Tp, _Arg>
+ inline std::const_mem_fun1_t<_Ret, _Tp, _Arg>
mem_fun1(_Ret (_Tp::*__f)(_Arg) const)
- { return const_mem_fun1_t<_Ret, _Tp, _Arg>(__f); }
+ { return std::const_mem_fun1_t<_Ret, _Tp, _Arg>(__f); }
template <class _Ret, class _Tp, class _Arg>
- inline mem_fun1_ref_t<_Ret, _Tp, _Arg>
+ inline std::mem_fun1_ref_t<_Ret, _Tp, _Arg>
mem_fun1_ref(_Ret (_Tp::*__f)(_Arg))
- { return mem_fun1_ref_t<_Ret, _Tp, _Arg>(__f); }
+ { return std::mem_fun1_ref_t<_Ret, _Tp, _Arg>(__f); }
template <class _Ret, class _Tp, class _Arg>
- inline const_mem_fun1_ref_t<_Ret, _Tp, _Arg>
+ inline std::const_mem_fun1_ref_t<_Ret, _Tp, _Arg>
mem_fun1_ref(_Ret (_Tp::*__f)(_Arg) const)
- { return const_mem_fun1_ref_t<_Ret, _Tp, _Arg>(__f); }
+ { return std::const_mem_fun1_ref_t<_Ret, _Tp, _Arg>(__f); }
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
- using std::size_t;
- using std::ptrdiff_t;
-
/**
* @brief An allocator that uses malloc.
* @ingroup allocators
class malloc_allocator
{
public:
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
+ typedef std::size_t size_type;
+ typedef std::ptrdiff_t difference_type;
typedef _Tp* pointer;
typedef const _Tp* const_pointer;
typedef _Tp& reference;
max_size() const _GLIBCXX_USE_NOEXCEPT
{
#if __PTRDIFF_MAX__ < __SIZE_MAX__
- return size_t(__PTRDIFF_MAX__) / sizeof(_Tp);
+ return std::size_t(__PTRDIFF_MAX__) / sizeof(_Tp);
#else
- return size_t(-1) / sizeof(_Tp);
+ return std::size_t(-1) / sizeof(_Tp);
#endif
}
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
- using std::ptrdiff_t;
- using std::pair;
- using std::__iterator_category;
using std::_Temporary_buffer;
template<typename _InputIter, typename _Size, typename _ForwardIter>
- pair<_InputIter, _ForwardIter>
+ std::pair<_InputIter, _ForwardIter>
__uninitialized_copy_n(_InputIter __first, _Size __count,
_ForwardIter __result, std::input_iterator_tag)
{
{
for (; __count > 0 ; --__count, ++__first, ++__cur)
std::_Construct(&*__cur, *__first);
- return pair<_InputIter, _ForwardIter>(__first, __cur);
+ return std::pair<_InputIter, _ForwardIter>(__first, __cur);
}
__catch(...)
{
}
template<typename _RandomAccessIter, typename _Size, typename _ForwardIter>
- inline pair<_RandomAccessIter, _ForwardIter>
+ inline std::pair<_RandomAccessIter, _ForwardIter>
__uninitialized_copy_n(_RandomAccessIter __first, _Size __count,
_ForwardIter __result,
std::random_access_iterator_tag)
{
_RandomAccessIter __last = __first + __count;
- return (pair<_RandomAccessIter, _ForwardIter>
+ return (std::pair<_RandomAccessIter, _ForwardIter>
(__last, std::uninitialized_copy(__first, __last, __result)));
}
template<typename _InputIter, typename _Size, typename _ForwardIter>
- inline pair<_InputIter, _ForwardIter>
+ inline std::pair<_InputIter, _ForwardIter>
__uninitialized_copy_n(_InputIter __first, _Size __count,
_ForwardIter __result)
- { return __gnu_cxx::__uninitialized_copy_n(__first, __count, __result,
- __iterator_category(__first)); }
+ {
+ return __gnu_cxx::__uninitialized_copy_n(__first, __count, __result,
+ std::__iterator_category(__first));
+ }
/**
* @brief Copies the range [first,last) into result.
* Like copy(), but does not require an initialized output range.
*/
template<typename _InputIter, typename _Size, typename _ForwardIter>
- inline pair<_InputIter, _ForwardIter>
+ inline std::pair<_InputIter, _ForwardIter>
uninitialized_copy_n(_InputIter __first, _Size __count,
_ForwardIter __result)
- { return __gnu_cxx::__uninitialized_copy_n(__first, __count, __result,
- __iterator_category(__first)); }
+ {
+ return __gnu_cxx::__uninitialized_copy_n(__first, __count, __result,
+ std::__iterator_category(__first));
+ }
// An alternative version of uninitialized_copy_n that constructs
// and destroys objects with a user-provided allocator.
template<typename _InputIter, typename _Size, typename _ForwardIter,
typename _Allocator>
- pair<_InputIter, _ForwardIter>
+ std::pair<_InputIter, _ForwardIter>
__uninitialized_copy_n_a(_InputIter __first, _Size __count,
_ForwardIter __result,
_Allocator __alloc)
{
for (; __count > 0 ; --__count, ++__first, ++__cur)
__alloc.construct(&*__cur, *__first);
- return pair<_InputIter, _ForwardIter>(__first, __cur);
+ return std::pair<_InputIter, _ForwardIter>(__first, __cur);
}
__catch(...)
{
template<typename _InputIter, typename _Size, typename _ForwardIter,
typename _Tp>
- inline pair<_InputIter, _ForwardIter>
+ inline std::pair<_InputIter, _ForwardIter>
__uninitialized_copy_n_a(_InputIter __first, _Size __count,
_ForwardIter __result,
std::allocator<_Tp>)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
- using std::size_t;
- using std::ptrdiff_t;
typedef void (*__destroy_handler)(void*);
// Using short int as type for the binmap implies we are never
// caching blocks larger than 32768 with this allocator.
typedef unsigned short int _Binmap_type;
+ typedef std::size_t size_t;
// Variables used to configure the behavior of the allocator,
// assigned and explained in detail below.
struct _Tune
- {
+ {
// Compile time constants for the default _Tune values.
enum { _S_align = 8 };
enum { _S_max_bytes = 128 };
static pool_type&
_S_get_pool()
- {
+ {
+ using std::size_t;
// Sane defaults for the _PoolTp.
typedef typename pool_type::_Block_record _Block_record;
const static size_t __a = (__alignof__(_Tp) >= sizeof(_Block_record)
class __mt_alloc_base
{
public:
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
+ typedef std::size_t size_type;
+ typedef std::ptrdiff_t difference_type;
typedef _Tp* pointer;
typedef const _Tp* const_pointer;
typedef _Tp& reference;
size_type
max_size() const _GLIBCXX_USE_NOEXCEPT
- { return size_t(-1) / sizeof(_Tp); }
+ { return size_type(-1) / sizeof(_Tp); }
#if __cplusplus >= 201103L
template<typename _Up, typename... _Args>
class __mt_alloc : public __mt_alloc_base<_Tp>
{
public:
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
+ typedef std::size_t size_type;
+ typedef std::ptrdiff_t difference_type;
typedef _Tp* pointer;
typedef const _Tp* const_pointer;
typedef _Tp& reference;
// Requests larger than _M_max_bytes are handled by operator
// new/delete directly.
__pool_type& __pool = __policy_type::_S_get_pool();
- const size_t __bytes = __n * sizeof(_Tp);
+ const size_type __bytes = __n * sizeof(_Tp);
if (__pool._M_check_threshold(__bytes))
{
void* __ret = ::operator new(__bytes);
}
// Round up to power of 2 and figure out which bin to use.
- const size_t __which = __pool._M_get_binmap(__bytes);
- const size_t __thread_id = __pool._M_get_thread_id();
+ const size_type __which = __pool._M_get_binmap(__bytes);
+ const size_type __thread_id = __pool._M_get_thread_id();
// Find out if we have blocks on our freelist. If so, go ahead
// and use them directly without having to lock anything.
// Requests larger than _M_max_bytes are handled by
// operators new/delete directly.
__pool_type& __pool = __policy_type::_S_get_pool();
- const size_t __bytes = __n * sizeof(_Tp);
+ const size_type __bytes = __n * sizeof(_Tp);
if (__pool._M_check_threshold(__bytes))
::operator delete(__p);
else
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
- using std::size_t;
- using std::ptrdiff_t;
-
/**
* @brief An allocator that uses global new, as per [20.4].
* @ingroup allocators
class new_allocator
{
public:
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
+ typedef std::size_t size_type;
+ typedef std::ptrdiff_t difference_type;
typedef _Tp* pointer;
typedef const _Tp* const_pointer;
typedef _Tp& reference;
max_size() const _GLIBCXX_USE_NOEXCEPT
{
#if __PTRDIFF_MAX__ < __SIZE_MAX__
- return size_t(__PTRDIFF_MAX__) / sizeof(_Tp);
+ return std::size_t(__PTRDIFF_MAX__) / sizeof(_Tp);
#else
- return size_t(-1) / sizeof(_Tp);
+ return std::size_t(-1) / sizeof(_Tp);
#endif
}
* @ingroup SGIextensions
* @doctodo
*/
- // iota is not part of the C++ standard. It is an extension.
+ // iota is not part of the standard until C++11. It is an extension.
template<typename _ForwardIter, typename _Tp>
void
iota(_ForwardIter __first, _ForwardIter __last, _Tp __value)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
- using std::size_t;
- using std::ptrdiff_t;
-
/**
* @brief Base class for __pool_alloc.
*
*/
class __pool_alloc_base
{
+ typedef std::size_t size_t;
protected:
enum { _S_align = 8 };
static _Atomic_word _S_force_new;
public:
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
+ typedef std::size_t size_type;
+ typedef std::ptrdiff_t difference_type;
typedef _Tp* pointer;
typedef const _Tp* const_pointer;
typedef _Tp& reference;
size_type
max_size() const _GLIBCXX_USE_NOEXCEPT
- { return size_t(-1) / sizeof(_Tp); }
+ { return std::size_t(-1) / sizeof(_Tp); }
#if __cplusplus >= 201103L
template<typename _Up, typename... _Args>
_GLIBCXX_NODISCARD _Tp*
__pool_alloc<_Tp>::allocate(size_type __n, const void*)
{
+ using std::size_t;
pointer __ret = 0;
if (__builtin_expect(__n != 0, true))
{
void
__pool_alloc<_Tp>::deallocate(pointer __p, size_type __n)
{
+ using std::size_t;
if (__builtin_expect(__n != 0 && __p != 0, true))
{
#if __cpp_aligned_new
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
- using std::_Rb_tree;
- using std::allocator;
-
// Class rb_tree is not part of the C++ standard. It is provided for
// compatibility with the HP STL.
* @doctodo
*/
template <class _Key, class _Value, class _KeyOfValue, class _Compare,
- class _Alloc = allocator<_Value> >
+ class _Alloc = std::allocator<_Value> >
struct rb_tree
- : public _Rb_tree<_Key, _Value, _KeyOfValue, _Compare, _Alloc>
+ : public std::_Rb_tree<_Key, _Value, _KeyOfValue, _Compare, _Alloc>
{
- typedef _Rb_tree<_Key, _Value, _KeyOfValue, _Compare, _Alloc> _Base;
+ typedef std::_Rb_tree<_Key, _Value, _KeyOfValue, _Compare, _Alloc> _Base;
typedef typename _Base::allocator_type allocator_type;
rb_tree(const _Compare& __comp = _Compare(),
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::_Destroy;
-
// See libstdc++/36832.
template<typename _ForwardIterator, typename _Allocator>
void
template<typename _ForwardIterator, typename _Tp>
inline void
_Destroy_const(_ForwardIterator __first,
- _ForwardIterator __last, allocator<_Tp>)
- { _Destroy(__first, __last); }
+ _ForwardIterator __last, std::allocator<_Tp>)
+ { std::_Destroy(__first, __last); }
// The _S_eos function is used for those functions that
// convert to/from C-like strings to detect the end of the string.
virtual ~char_producer() { }
virtual void
- operator()(size_t __start_pos, size_t __len,
+ operator()(std::size_t __start_pos, std::size_t __len,
_CharT* __buffer) = 0;
// Buffer should really be an arbitrary output iterator.
// That way we could flatten directly into an ostream, etc.
// behave a little like basic_ostringstream<sequence::value_type> and a
// little like containers.
- template<class _Sequence, size_t _Buf_sz = 100>
+ template<class _Sequence, std::size_t _Buf_sz = 100>
class sequence_buffer
: public std::iterator<std::output_iterator_tag, void, void, void, void>
{
protected:
_Sequence* _M_prefix;
value_type _M_buffer[_Buf_sz];
- size_t _M_buf_count;
+ std::size_t _M_buf_count;
public:
void
}
void
- append(value_type* __s, size_t __len)
+ append(value_type* __s, std::size_t __len)
{
if (__len + _M_buf_count <= _Buf_sz)
{
- size_t __i = _M_buf_count;
- for (size_t __j = 0; __j < __len; __i++, __j++)
+ std::size_t __i = _M_buf_count;
+ for (std::size_t __j = 0; __j < __len; __i++, __j++)
_M_buffer[__i] = __s[__j];
_M_buf_count += __len;
}
}
sequence_buffer&
- write(value_type* __s, size_t __len)
+ write(value_type* __s, std::size_t __len)
{
append(__s, __len);
return *this;
virtual ~_Rope_char_consumer() { }
virtual bool
- operator()(const _CharT* __buffer, size_t __len) = 0;
+ operator()(const _CharT* __buffer, std::size_t __len) = 0;
};
// First a lot of forward declarations. The standard seems to require
// much stricter "declaration before use" than many of the implementations
// that preceded it.
- template<class _CharT, class _Alloc = allocator<_CharT> >
+ template<class _CharT, class _Alloc = std::allocator<_CharT> >
class rope;
template<class _CharT, class _Alloc>
template<class _CharT, class _Alloc>
_Rope_const_iterator<_CharT, _Alloc>
operator-(const _Rope_const_iterator<_CharT, _Alloc>& __x,
- ptrdiff_t __n);
+ std::ptrdiff_t __n);
template<class _CharT, class _Alloc>
_Rope_const_iterator<_CharT, _Alloc>
operator+(const _Rope_const_iterator<_CharT, _Alloc>& __x,
- ptrdiff_t __n);
+ std::ptrdiff_t __n);
template<class _CharT, class _Alloc>
_Rope_const_iterator<_CharT, _Alloc>
- operator+(ptrdiff_t __n,
+ operator+(std::ptrdiff_t __n,
const _Rope_const_iterator<_CharT, _Alloc>& __x);
template<class _CharT, class _Alloc>
const _Rope_const_iterator<_CharT, _Alloc>& __y);
template<class _CharT, class _Alloc>
- ptrdiff_t
+ std::ptrdiff_t
operator-(const _Rope_const_iterator<_CharT, _Alloc>& __x,
const _Rope_const_iterator<_CharT, _Alloc>& __y);
template<class _CharT, class _Alloc>
_Rope_iterator<_CharT, _Alloc>
- operator-(const _Rope_iterator<_CharT, _Alloc>& __x, ptrdiff_t __n);
+ operator-(const _Rope_iterator<_CharT, _Alloc>& __x, std::ptrdiff_t __n);
template<class _CharT, class _Alloc>
_Rope_iterator<_CharT, _Alloc>
- operator+(const _Rope_iterator<_CharT, _Alloc>& __x, ptrdiff_t __n);
+ operator+(const _Rope_iterator<_CharT, _Alloc>& __x, std::ptrdiff_t __n);
template<class _CharT, class _Alloc>
_Rope_iterator<_CharT, _Alloc>
- operator+(ptrdiff_t __n, const _Rope_iterator<_CharT, _Alloc>& __x);
+ operator+(std::ptrdiff_t __n, const _Rope_iterator<_CharT, _Alloc>& __x);
template<class _CharT, class _Alloc>
bool
const _Rope_iterator<_CharT, _Alloc>& __y);
template<class _CharT, class _Alloc>
- ptrdiff_t
+ std::ptrdiff_t
operator-(const _Rope_iterator<_CharT, _Alloc>& __x,
const _Rope_iterator<_CharT, _Alloc>& __y);
struct _Refcount_Base
{
// The type _RC_t
- typedef size_t _RC_t;
+ typedef std::size_t _RC_t;
// The data member _M_ref_count
volatile _RC_t _M_ref_count;
struct _Rope_rep_base
: public _Alloc
{
+ typedef std::size_t size_type;
typedef _Alloc allocator_type;
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_type __size, const allocator_type&)
: _M_size(__size) { }
- size_t _M_size;
+ size_type _M_size;
# define __ROPE_DEFINE_ALLOC(_Tp, __name) \
typedef typename \
_Alloc::template rebind<_Tp>::other __name##Alloc; \
- static _Tp* __name##_allocate(size_t __n) \
+ static _Tp* __name##_allocate(size_type __n) \
{ return __name##Alloc().allocate(__n); } \
- static void __name##_deallocate(_Tp *__p, size_t __n) \
+ static void __name##_deallocate(_Tp *__p, size_type __n) \
{ __name##Alloc().deallocate(__p, __n); }
__ROPE_DEFINE_ALLOCS(_Alloc)
# undef __ROPE_DEFINE_ALLOC
/* the same memory as the data field. */
typedef typename _Rope_rep_base<_CharT, _Alloc>::allocator_type
allocator_type;
+ typedef std::size_t size_type;
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_type __size,
const allocator_type& __a)
: _Rope_rep_base<_CharT, _Alloc>(__size, __a),
#ifndef __GC
_M_incr () { }
#endif
static void
- _S_free_string(__GC_CONST _CharT*, size_t __len,
+ _S_free_string(__GC_CONST _CharT*, size_type __len,
allocator_type& __a);
#define __STL_FREE_STRING(__s, __l, __a) _S_free_string(__s, __l, __a);
// Deallocate data section of a leaf.
struct _Rope_RopeLeaf
: public _Rope_RopeRep<_CharT, _Alloc>
{
+ typedef std::size_t size_type;
public:
// Apparently needed by VC++
// The data fields of leaves are allocated with some
// character types, to hold a trailing eos character.
enum { _S_alloc_granularity = 8 };
- static size_t
- _S_rounded_up_size(size_t __n)
+ static size_type
+ _S_rounded_up_size(size_type __n)
{
- size_t __size_with_eos;
+ size_type __size_with_eos;
if (_S_is_basic_char_type((_CharT*)0))
__size_with_eos = __n + 1;
return __size_with_eos;
#else
// Allow slop for in-place expansion.
- return ((__size_with_eos + size_t(_S_alloc_granularity) - 1)
- &~ (size_t(_S_alloc_granularity) - 1));
+ return ((__size_with_eos + size_type(_S_alloc_granularity) - 1)
+ &~ (size_type(_S_alloc_granularity) - 1));
#endif
}
__GC_CONST _CharT* _M_data; /* Not necessarily 0 terminated. */
typedef typename _Rope_rep_base<_CharT,_Alloc>::allocator_type
allocator_type;
- _Rope_RopeLeaf(__GC_CONST _CharT* __d, size_t __size,
+ _Rope_RopeLeaf(__GC_CONST _CharT* __d, size_type __size,
const allocator_type& __a)
: _Rope_RopeRep<_CharT, _Alloc>(__detail::_S_leaf, 0, true,
__size, __a), _M_data(__d)
typedef typename _Rope_rep_base<_CharT, _Alloc>::allocator_type
allocator_type;
- _Rope_RopeFunction(char_producer<_CharT>* __f, size_t __size,
+ _Rope_RopeFunction(char_producer<_CharT>* __f, std::size_t __size,
bool __d, const allocator_type& __a)
: _Rope_RopeRep<_CharT, _Alloc>(__detail::_S_function, 0, true, __size, __a)
, _M_fn(__f)
: public _Rope_RopeFunction<_CharT, _Alloc>,
public char_producer<_CharT>
{
+ typedef std::size_t size_type;
public:
// XXX this whole class should be rewritten.
_Rope_RopeRep<_CharT,_Alloc>* _M_base; // not 0
- size_t _M_start;
+ size_type _M_start;
virtual void
- operator()(size_t __start_pos, size_t __req_len,
+ operator()(size_type __start_pos, size_type __req_len,
_CharT* __buffer)
{
switch(_M_base->_M_tag)
typedef typename _Rope_rep_base<_CharT, _Alloc>::allocator_type
allocator_type;
- _Rope_RopeSubstring(_Rope_RopeRep<_CharT, _Alloc>* __b, size_t __s,
- size_t __l, const allocator_type& __a)
+ _Rope_RopeSubstring(_Rope_RopeRep<_CharT, _Alloc>* __b, size_type __s,
+ size_type __l, const allocator_type& __a)
: _Rope_RopeFunction<_CharT, _Alloc>(this, __l, false, __a),
char_producer<_CharT>(), _M_base(__b), _M_start(__s)
{
#endif
typedef _Rope_RopeRep<_CharT, _Alloc> _RopeRep;
typedef rope<_CharT, _Alloc> _My_rope;
- size_t _M_pos;
+ std::size_t _M_pos;
_CharT _M_current;
bool _M_current_valid;
_My_rope* _M_root; // The whole rope.
public:
- _Rope_char_ref_proxy(_My_rope* __r, size_t __p)
+ _Rope_char_ref_proxy(_My_rope* __r, std::size_t __p)
: _M_pos(__p), _M_current(), _M_current_valid(false), _M_root(__r) { }
_Rope_char_ref_proxy(const _Rope_char_ref_proxy& __x)
// 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)
+ _Rope_char_ref_proxy(_My_rope* __r, std::size_t __p, _CharT __c)
: _M_pos(__p), _M_current(__c), _M_current_valid(true), _M_root(__r) { }
inline operator _CharT () const;
{
// XXX this class should be rewritten.
friend class _Rope_char_ref_proxy<_CharT, _Alloc>;
- size_t _M_pos;
+ std::size_t _M_pos;
rope<_CharT,_Alloc>* _M_root; // The whole rope.
public:
_Rope_char_ptr_proxy(const _Rope_char_ref_proxy<_CharT,_Alloc>& __x)
protected:
enum { _S_path_cache_len = 4 }; // Must be <= 9.
enum { _S_iterator_buf_len = 15 };
- size_t _M_current_pos;
+ std::size_t _M_current_pos;
_RopeRep* _M_root; // The whole rope.
- size_t _M_leaf_pos; // Starting position for current leaf
+ std::size_t _M_leaf_pos; // Starting position for current leaf
__GC_CONST _CharT* _M_buf_start;
// Buffer possibly
// containing current char.
// cache is valid for previous posn.
_Rope_iterator_base() { }
- _Rope_iterator_base(_RopeRep* __root, size_t __pos)
+ _Rope_iterator_base(_RopeRep* __root, std::size_t __pos)
: _M_current_pos(__pos), _M_root(__root), _M_buf_ptr(0) { }
- void _M_incr(size_t __n);
- void _M_decr(size_t __n);
+ void _M_incr(std::size_t __n);
+ void _M_decr(std::size_t __n);
public:
- size_t
+ std::size_t
index() const
{ return _M_current_pos; }
protected:
typedef _Rope_RopeRep<_CharT, _Alloc> _RopeRep;
// The one from the base class may not be directly visible.
- _Rope_const_iterator(const _RopeRep* __root, size_t __pos)
+ _Rope_const_iterator(const _RopeRep* __root, std::size_t __pos)
: _Rope_iterator_base<_CharT, _Alloc>(const_cast<_RopeRep*>(__root),
__pos)
// Only nonconst iterators modify root ref count
_Rope_const_iterator(const _Rope_iterator<_CharT,_Alloc>& __x);
- _Rope_const_iterator(const rope<_CharT, _Alloc>& __r, size_t __pos)
+ _Rope_const_iterator(const rope<_CharT, _Alloc>& __r, std::size_t __pos)
: _Rope_iterator_base<_CharT,_Alloc>(__r._M_tree_ptr, __pos) { }
_Rope_const_iterator&
}
_Rope_const_iterator&
- operator+=(ptrdiff_t __n)
+ operator+=(std::ptrdiff_t __n)
{
if (__n >= 0)
this->_M_incr(__n);
}
_Rope_const_iterator&
- operator-=(ptrdiff_t __n)
+ operator-=(std::ptrdiff_t __n)
{
if (__n >= 0)
this->_M_decr(__n);
_Rope_const_iterator
operator++(int)
{
- size_t __old_pos = this->_M_current_pos;
+ std::size_t __old_pos = this->_M_current_pos;
this->_M_incr(1);
return _Rope_const_iterator<_CharT,_Alloc>(this->_M_root, __old_pos);
// This makes a subsequent dereference expensive.
_Rope_const_iterator
operator--(int)
{
- size_t __old_pos = this->_M_current_pos;
+ std::size_t __old_pos = this->_M_current_pos;
this->_M_decr(1);
return _Rope_const_iterator<_CharT,_Alloc>(this->_M_root, __old_pos);
}
template<class _CharT2, class _Alloc2>
friend _Rope_const_iterator<_CharT2, _Alloc2>
operator-(const _Rope_const_iterator<_CharT2, _Alloc2>& __x,
- ptrdiff_t __n);
+ std::ptrdiff_t __n);
template<class _CharT2, class _Alloc2>
friend _Rope_const_iterator<_CharT2, _Alloc2>
operator+(const _Rope_const_iterator<_CharT2, _Alloc2>& __x,
- ptrdiff_t __n);
+ std::ptrdiff_t __n);
template<class _CharT2, class _Alloc2>
friend _Rope_const_iterator<_CharT2, _Alloc2>
- operator+(ptrdiff_t __n,
+ operator+(std::ptrdiff_t __n,
const _Rope_const_iterator<_CharT2, _Alloc2>& __x);
reference
- operator[](size_t __n)
+ operator[](std::size_t __n)
{ return rope<_CharT, _Alloc>::_S_fetch(this->_M_root,
this->_M_current_pos + __n); }
const _Rope_const_iterator<_CharT2, _Alloc2>& __y);
template<class _CharT2, class _Alloc2>
- friend ptrdiff_t
+ friend std::ptrdiff_t
operator-(const _Rope_const_iterator<_CharT2, _Alloc2>& __x,
const _Rope_const_iterator<_CharT2, _Alloc2>& __y);
};
// 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(rope<_CharT, _Alloc>* __r, std::size_t __pos)
: _Rope_iterator_base<_CharT, _Alloc>(__r->_M_tree_ptr, __pos),
_M_root_rope(__r)
{ _RopeRep::_S_ref(this->_M_root);
_RopeRep::_S_ref(this->_M_root);
}
- _Rope_iterator(rope<_CharT, _Alloc>& __r, size_t __pos);
+ _Rope_iterator(rope<_CharT, _Alloc>& __r, std::size_t __pos);
~_Rope_iterator()
{ _RopeRep::_S_unref(this->_M_root); }
}
_Rope_iterator&
- operator+=(ptrdiff_t __n)
+ operator+=(std::ptrdiff_t __n)
{
if (__n >= 0)
this->_M_incr(__n);
}
_Rope_iterator&
- operator-=(ptrdiff_t __n)
+ operator-=(std::ptrdiff_t __n)
{
if (__n >= 0)
this->_M_decr(__n);
_Rope_iterator
operator++(int)
{
- size_t __old_pos = this->_M_current_pos;
+ std::size_t __old_pos = this->_M_current_pos;
this->_M_incr(1);
return _Rope_iterator<_CharT,_Alloc>(_M_root_rope, __old_pos);
}
_Rope_iterator
operator--(int)
{
- size_t __old_pos = this->_M_current_pos;
+ std::size_t __old_pos = this->_M_current_pos;
this->_M_decr(1);
return _Rope_iterator<_CharT,_Alloc>(_M_root_rope, __old_pos);
}
reference
- operator[](ptrdiff_t __n)
+ operator[](std::ptrdiff_t __n)
{ return _Rope_char_ref_proxy<_CharT, _Alloc>(_M_root_rope,
this->_M_current_pos
+ __n); }
const _Rope_iterator<_CharT2, _Alloc2>& __y);
template<class _CharT2, class _Alloc2>
- friend ptrdiff_t
+ friend std::ptrdiff_t
operator-(const _Rope_iterator<_CharT2, _Alloc2>& __x,
const _Rope_iterator<_CharT2, _Alloc2>& __y);
template<class _CharT2, class _Alloc2>
friend _Rope_iterator<_CharT2, _Alloc2>
- operator-(const _Rope_iterator<_CharT2, _Alloc2>& __x, ptrdiff_t __n);
+ operator-(const _Rope_iterator<_CharT2, _Alloc2>& __x,
+ std::ptrdiff_t __n);
template<class _CharT2, class _Alloc2>
friend _Rope_iterator<_CharT2, _Alloc2>
- operator+(const _Rope_iterator<_CharT2, _Alloc2>& __x, ptrdiff_t __n);
+ operator+(const _Rope_iterator<_CharT2, _Alloc2>& __x,
+ std::ptrdiff_t __n);
template<class _CharT2, class _Alloc2>
friend _Rope_iterator<_CharT2, _Alloc2>
- operator+(ptrdiff_t __n, const _Rope_iterator<_CharT2, _Alloc2>& __x);
+ operator+(std::ptrdiff_t __n,
+ const _Rope_iterator<_CharT2, _Alloc2>& __x);
};
#define __ROPE_DEFINE_ALLOC(_Tp, __name) \
typedef typename \
_Alloc::template rebind<_Tp>::other __name##Alloc; \
- static _Tp* __name##_allocate(size_t __n) \
+ static _Tp* __name##_allocate(std::size_t __n) \
{ return __name##Alloc().allocate(__n); } \
- static void __name##_deallocate(_Tp *__p, size_t __n) \
+ static void __name##_deallocate(_Tp *__p, std::size_t __n) \
{ __name##Alloc().deallocate(__p, __n); }
__ROPE_DEFINE_ALLOCS(_Alloc)
#undef __ROPE_DEFINE_ALLOC
{
public:
typedef _CharT value_type;
- typedef ptrdiff_t difference_type;
- typedef size_t size_type;
+ typedef std::ptrdiff_t difference_type;
+ typedef std::size_t size_type;
typedef _CharT const_reference;
typedef const _CharT* const_pointer;
typedef _Rope_iterator<_CharT, _Alloc> iterator;
_S_apply_to_pieces(// should be template parameter
_Rope_char_consumer<_CharT>& __c,
const _RopeRep* __r,
- size_t __begin, size_t __end);
+ size_type __begin, size_type __end);
// begin and end are assumed to be in range.
#ifndef __GC
// _Result is counted in refcount.
static _RopeRep* _S_substring(_RopeRep* __base,
- size_t __start, size_t __endp1);
+ size_type __start, size_type __endp1);
static _RopeRep* _S_concat_char_iter(_RopeRep* __r,
- const _CharT* __iter, size_t __slen);
+ const _CharT* __iter,
+ size_type __slen);
// Concatenate rope and char ptr, copying __s.
// Should really take an arbitrary iterator.
// Result is counted in refcount.
static _RopeRep* _S_destr_concat_char_iter(_RopeRep* __r,
const _CharT* __iter,
- size_t __slen)
+ size_type __slen)
// As above, but one reference to __r is about to be
// destroyed. Thus the pieces may be recycled if all
// relevant reference counts are 1.
public:
void
- apply_to_pieces(size_t __begin, size_t __end,
+ apply_to_pieces(size_type __begin, size_type __end,
_Rope_char_consumer<_CharT>& __c) const
{ _S_apply_to_pieces(__c, this->_M_tree_ptr, __begin, __end); }
protected:
- static size_t
- _S_rounded_up_size(size_t __n)
+ static size_type
+ _S_rounded_up_size(size_type __n)
{ return _RopeLeaf::_S_rounded_up_size(__n); }
- static size_t
- _S_allocated_capacity(size_t __n)
+ static size_type
+ _S_allocated_capacity(size_type __n)
{
if (_S_is_basic_char_type((_CharT*)0))
return _S_rounded_up_size(__n) - 1;
// Takes ownership of s instead of copying.
static _RopeLeaf*
_S_new_RopeLeaf(__GC_CONST _CharT *__s,
- size_t __size, allocator_type& __a)
+ size_type __size, allocator_type& __a)
{
_RopeLeaf* __space = typename _Base::_LAlloc(__a).allocate(1);
return new(__space) _RopeLeaf(__s, __size, __a);
static _RopeFunction*
_S_new_RopeFunction(char_producer<_CharT>* __f,
- size_t __size, bool __d, allocator_type& __a)
+ size_type __size, bool __d, allocator_type& __a)
{
_RopeFunction* __space = typename _Base::_FAlloc(__a).allocate(1);
return new(__space) _RopeFunction(__f, __size, __d, __a);
}
static _RopeSubstring*
- _S_new_RopeSubstring(_Rope_RopeRep<_CharT,_Alloc>* __b, size_t __s,
- size_t __l, allocator_type& __a)
+ _S_new_RopeSubstring(_Rope_RopeRep<_CharT,_Alloc>* __b, size_type __s,
+ size_type __l, allocator_type& __a)
{
_RopeSubstring* __space = typename _Base::_SAlloc(__a).allocate(1);
return new(__space) _RopeSubstring(__b, __s, __l, __a);
static _RopeLeaf*
_S_RopeLeaf_from_unowned_char_ptr(const _CharT *__s,
- size_t __size, allocator_type& __a)
+ size_type __size, allocator_type& __a)
#define __STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __size, __a) \
_S_RopeLeaf_from_unowned_char_ptr(__s, __size, __a)
{
// Concatenation helper functions
static _RopeLeaf*
_S_leaf_concat_char_iter(_RopeLeaf* __r,
- const _CharT* __iter, size_t __slen);
+ const _CharT* __iter, size_type __slen);
// Concatenate by copying leaf.
// should take an arbitrary iterator
// result has refcount 1.
#ifndef __GC
static _RopeLeaf*
_S_destr_leaf_concat_char_iter(_RopeLeaf* __r,
- const _CharT* __iter, size_t __slen);
+ const _CharT* __iter, size_type __slen);
// A version that potentially clobbers __r if __r->_M_ref_count == 1.
#endif
private:
- static size_t _S_char_ptr_len(const _CharT* __s);
+ static size_type _S_char_ptr_len(const _CharT* __s);
// slightly generalized strlen
rope(_RopeRep* __t, const allocator_type& __a = allocator_type())
// Again, with explicit starting position and length.
// Assumes that buffer is uninitialized.
static _CharT* _S_flatten(_RopeRep* __r,
- size_t __start, size_t __len,
+ size_type __start, size_type __len,
_CharT* __buffer);
static const unsigned long
_M_get_allocator());
}
- rope(const _CharT* __s, size_t __len,
+ rope(const _CharT* __s, size_type __len,
const allocator_type& __a = allocator_type())
: _Base(__a)
{
}
}
- rope(size_t __n, _CharT __c,
+ rope(size_type __n, _CharT __c,
const allocator_type& __a = allocator_type());
rope(const allocator_type& __a = allocator_type())
: _Base(0, __a) { }
// Construct a rope from a function that can compute its members
- rope(char_producer<_CharT> *__fn, size_t __len, bool __delete_fn,
+ rope(char_producer<_CharT> *__fn, size_type __len, bool __delete_fn,
const allocator_type& __a = allocator_type())
: _Base(__a)
{
size_type
copy(size_type __pos, size_type __n, _CharT* __buffer) const
{
- size_t __size = size();
- size_t __len = (__pos + __n > __size? __size - __pos : __n);
+ size_type __size = size();
+ size_type __len = (__pos + __n > __size? __size - __pos : __n);
_Destroy_const(__buffer, __buffer + __len, _M_get_allocator());
_S_flatten(this->_M_tree_ptr, __pos, __len, __buffer);
// argument should be an input iterator or forward iterator with
// value_type _CharT.
rope&
- append(const _CharT* __iter, size_t __n)
+ append(const _CharT* __iter, size_type __n)
{
_RopeRep* __result =
_S_destr_concat_char_iter(this->_M_tree_ptr, __iter, __n);
rope&
append(const _CharT* __c_string)
{
- size_t __len = _S_char_ptr_len(__c_string);
+ size_type __len = _S_char_ptr_len(__c_string);
append(__c_string, __len);
return(*this);
}
}
rope&
- append(size_t __n, _CharT __c)
+ append(size_type __n, _CharT __c)
{
rope<_CharT,_Alloc> __last(__n, __c);
return append(__last);
protected:
// Result is included in refcount.
static _RopeRep*
- replace(_RopeRep* __old, size_t __pos1,
- size_t __pos2, _RopeRep* __r)
+ replace(_RopeRep* __old, size_type __pos1,
+ size_type __pos2, _RopeRep* __r)
{
if (0 == __old)
{
public:
void
- insert(size_t __p, const rope& __r)
+ insert(size_type __p, const rope& __r)
{
_RopeRep* __result =
replace(this->_M_tree_ptr, __p, __p, __r._M_tree_ptr);
}
void
- insert(size_t __p, size_t __n, _CharT __c)
+ insert(size_type __p, size_type __n, _CharT __c)
{
rope<_CharT,_Alloc> __r(__n,__c);
insert(__p, __r);
}
void
- insert(size_t __p, const _CharT* __i, size_t __n)
+ insert(size_type __p, const _CharT* __i, size_type __n)
{
_Self_destruct_ptr __left(_S_substring(this->_M_tree_ptr, 0, __p));
_Self_destruct_ptr __right(_S_substring(this->_M_tree_ptr,
}
void
- insert(size_t __p, const _CharT* __c_string)
+ insert(size_type __p, const _CharT* __c_string)
{ insert(__p, __c_string, _S_char_ptr_len(__c_string)); }
void
- insert(size_t __p, _CharT __c)
+ insert(size_type __p, _CharT __c)
{ insert(__p, &__c, 1); }
void
- insert(size_t __p)
+ insert(size_type __p)
{
_CharT __c = _CharT();
insert(__p, &__c, 1);
}
void
- insert(size_t __p, const _CharT* __i, const _CharT* __j)
+ insert(size_type __p, const _CharT* __i, const _CharT* __j)
{
rope __r(__i, __j);
insert(__p, __r);
}
void
- insert(size_t __p, const const_iterator& __i,
+ insert(size_type __p, const const_iterator& __i,
const const_iterator& __j)
{
rope __r(__i, __j);
}
void
- insert(size_t __p, const iterator& __i,
+ insert(size_type __p, const iterator& __i,
const iterator& __j)
{
rope __r(__i, __j);
// (position, length) versions of replace operations:
void
- replace(size_t __p, size_t __n, const rope& __r)
+ replace(size_type __p, size_type __n, const rope& __r)
{
_RopeRep* __result =
replace(this->_M_tree_ptr, __p, __p + __n, __r._M_tree_ptr);
}
void
- replace(size_t __p, size_t __n,
- const _CharT* __i, size_t __i_len)
+ replace(size_type __p, size_type __n,
+ const _CharT* __i, size_type __i_len)
{
rope __r(__i, __i_len);
replace(__p, __n, __r);
}
void
- replace(size_t __p, size_t __n, _CharT __c)
+ replace(size_type __p, size_type __n, _CharT __c)
{
rope __r(__c);
replace(__p, __n, __r);
}
void
- replace(size_t __p, size_t __n, const _CharT* __c_string)
+ replace(size_type __p, size_type __n, const _CharT* __c_string)
{
rope __r(__c_string);
replace(__p, __n, __r);
}
void
- replace(size_t __p, size_t __n,
+ replace(size_type __p, size_type __n,
const _CharT* __i, const _CharT* __j)
{
rope __r(__i, __j);
}
void
- replace(size_t __p, size_t __n,
+ replace(size_type __p, size_type __n,
const const_iterator& __i, const const_iterator& __j)
{
rope __r(__i, __j);
}
void
- replace(size_t __p, size_t __n,
+ replace(size_type __p, size_type __n,
const iterator& __i, const iterator& __j)
{
rope __r(__i, __j);
// Single character variants:
void
- replace(size_t __p, _CharT __c)
+ replace(size_type __p, _CharT __c)
{
iterator __i(this, __p);
*__i = __c;
}
void
- replace(size_t __p, const rope& __r)
+ replace(size_type __p, const rope& __r)
{ replace(__p, 1, __r); }
void
- replace(size_t __p, const _CharT* __i, size_t __i_len)
+ replace(size_type __p, const _CharT* __i, size_type __i_len)
{ replace(__p, 1, __i, __i_len); }
void
- replace(size_t __p, const _CharT* __c_string)
+ replace(size_type __p, const _CharT* __c_string)
{ replace(__p, 1, __c_string); }
void
- replace(size_t __p, const _CharT* __i, const _CharT* __j)
+ replace(size_type __p, const _CharT* __i, const _CharT* __j)
{ replace(__p, 1, __i, __j); }
void
- replace(size_t __p, const const_iterator& __i,
+ replace(size_type __p, const const_iterator& __i,
const const_iterator& __j)
{ replace(__p, 1, __i, __j); }
void
- replace(size_t __p, const iterator& __i,
+ replace(size_type __p, const iterator& __i,
const iterator& __j)
{ replace(__p, 1, __i, __j); }
// Erase, (position, size) variant.
void
- erase(size_t __p, size_t __n)
+ erase(size_type __p, size_type __n)
{
_RopeRep* __result = replace(this->_M_tree_ptr, __p,
__p + __n, 0);
// Erase, single character
void
- erase(size_t __p)
+ erase(size_type __p)
{ erase(__p, __p + 1); }
// Insert, iterator variants.
}
iterator
- insert(const iterator& __p, size_t __n, _CharT __c)
+ insert(const iterator& __p, size_type __n, _CharT __c)
{
insert(__p.index(), __n, __c);
return __p;
}
iterator
- insert(const iterator& __p, const _CharT* __i, size_t __n)
+ insert(const iterator& __p, const _CharT* __i, size_type __n)
{
insert(__p.index(), __i, __n);
return __p;
void
replace(const iterator& __p, const iterator& __q,
- const _CharT* __i, size_t __n)
+ const _CharT* __i, size_type __n)
{ replace(__p.index(), __q.index() - __p.index(), __i, __n); }
void
{ replace(__p.index(), __c_string); }
void
- replace(const iterator& __p, const _CharT* __i, size_t __n)
+ replace(const iterator& __p, const _CharT* __i, size_type __n)
{ replace(__p.index(), __i, __n); }
void
iterator
erase(const iterator& __p, const iterator& __q)
{
- size_t __p_index = __p.index();
+ size_type __p_index = __p.index();
erase(__p_index, __q.index() - __p_index);
return iterator(this, __p_index);
}
iterator
erase(const iterator& __p)
{
- size_t __p_index = __p.index();
+ size_type __p_index = __p.index();
erase(__p_index, 1);
return iterator(this, __p_index);
}
rope
- substr(size_t __start, size_t __len = 1) const
+ substr(size_type __start, size_type __len = 1) const
{
return rope<_CharT, _Alloc>(_S_substring(this->_M_tree_ptr,
__start,
rope
substr(iterator __start) const
{
- size_t __pos = __start.index();
+ size_type __pos = __start.index();
return rope<_CharT, _Alloc>(_S_substring(this->_M_tree_ptr,
__pos, __pos + 1));
}
rope<_CharT, _Alloc>
substr(const_iterator __start)
{
- size_t __pos = __start.index();
+ size_type __pos = __start.index();
return rope<_CharT, _Alloc>(_S_substring(this->_M_tree_ptr,
__pos, __pos + 1));
}
{ return !(__x < __y); }
template <class _CharT, class _Alloc>
- inline ptrdiff_t
+ inline std::ptrdiff_t
operator-(const _Rope_const_iterator<_CharT, _Alloc>& __x,
const _Rope_const_iterator<_CharT, _Alloc>& __y)
- { return (ptrdiff_t)__x._M_current_pos - (ptrdiff_t)__y._M_current_pos; }
+ {
+ return (std::ptrdiff_t)__x._M_current_pos
+ - (std::ptrdiff_t)__y._M_current_pos;
+ }
template <class _CharT, class _Alloc>
inline _Rope_const_iterator<_CharT, _Alloc>
- operator-(const _Rope_const_iterator<_CharT, _Alloc>& __x, ptrdiff_t __n)
+ operator-(const _Rope_const_iterator<_CharT, _Alloc>& __x,
+ std::ptrdiff_t __n)
{ return _Rope_const_iterator<_CharT, _Alloc>(__x._M_root,
__x._M_current_pos - __n); }
template <class _CharT, class _Alloc>
inline _Rope_const_iterator<_CharT, _Alloc>
- operator+(const _Rope_const_iterator<_CharT, _Alloc>& __x, ptrdiff_t __n)
+ operator+(const _Rope_const_iterator<_CharT, _Alloc>& __x,
+ std::ptrdiff_t __n)
{ return _Rope_const_iterator<_CharT, _Alloc>(__x._M_root,
__x._M_current_pos + __n); }
template <class _CharT, class _Alloc>
inline _Rope_const_iterator<_CharT, _Alloc>
- operator+(ptrdiff_t __n, const _Rope_const_iterator<_CharT, _Alloc>& __x)
+ operator+(std::ptrdiff_t __n,
+ const _Rope_const_iterator<_CharT, _Alloc>& __x)
{ return _Rope_const_iterator<_CharT, _Alloc>(__x._M_root,
__x._M_current_pos + __n); }
{ return !(__x < __y); }
template <class _CharT, class _Alloc>
- inline ptrdiff_t
+ inline std::ptrdiff_t
operator-(const _Rope_iterator<_CharT, _Alloc>& __x,
const _Rope_iterator<_CharT, _Alloc>& __y)
- { return ((ptrdiff_t)__x._M_current_pos
- - (ptrdiff_t)__y._M_current_pos); }
+ { return ((std::ptrdiff_t)__x._M_current_pos
+ - (std::ptrdiff_t)__y._M_current_pos); }
template <class _CharT, class _Alloc>
inline _Rope_iterator<_CharT, _Alloc>
operator-(const _Rope_iterator<_CharT, _Alloc>& __x,
- ptrdiff_t __n)
+ std::ptrdiff_t __n)
{ return _Rope_iterator<_CharT, _Alloc>(__x._M_root_rope,
__x._M_current_pos - __n); }
template <class _CharT, class _Alloc>
inline _Rope_iterator<_CharT, _Alloc>
- operator+(const _Rope_iterator<_CharT, _Alloc>& __x, ptrdiff_t __n)
+ operator+(const _Rope_iterator<_CharT, _Alloc>& __x, std::ptrdiff_t __n)
{ return _Rope_iterator<_CharT, _Alloc>(__x._M_root_rope,
__x._M_current_pos + __n); }
template <class _CharT, class _Alloc>
inline _Rope_iterator<_CharT, _Alloc>
- operator+(ptrdiff_t __n, const _Rope_iterator<_CharT, _Alloc>& __x)
+ operator+(std::ptrdiff_t __n, const _Rope_iterator<_CharT, _Alloc>& __x)
{ return _Rope_iterator<_CharT, _Alloc>(__x._M_root_rope,
__x._M_current_pos + __n); }
const _CharT* __right)
{
typedef rope<_CharT, _Alloc> rope_type;
- size_t __rlen = rope_type::_S_char_ptr_len(__right);
+ std::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));
}
typedef rope<wchar_t> wrope;
inline crope::reference
- __mutable_reference_at(crope& __c, size_t __i)
+ __mutable_reference_at(crope& __c, std::size_t __i)
{ return __c.mutable_reference_at(__i); }
inline wrope::reference
- __mutable_reference_at(wrope& __c, size_t __i)
+ __mutable_reference_at(wrope& __c, std::size_t __i)
{ return __c.mutable_reference_at(__i); }
template <class _CharT, class _Alloc>
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
- using std::size_t;
- using std::printf;
- using std::basic_ostream;
- using std::__throw_length_error;
- using std::_Destroy;
- using std::__uninitialized_fill_n_a;
-
// Set buf_start, buf_end, and buf_ptr appropriately, filling tmp_buf
// if necessary. Assumes _M_path_end[leaf_index] and leaf_pos are correct.
// Results in a valid buf_ptr if the iterator can be legitimately
_Rope_iterator_base<_CharT, _Alloc>::
_S_setbuf(_Rope_iterator_base<_CharT, _Alloc>& __x)
{
+ using std::size_t;
const _RopeRep* __leaf = __x._M_path_end[__x._M_leaf_index];
size_t __leaf_pos = __x._M_leaf_pos;
size_t __pos = __x._M_current_pos;
_Rope_iterator_base<_CharT, _Alloc>::
_S_setcache(_Rope_iterator_base<_CharT, _Alloc>& __x)
{
+ using std::size_t;
const _RopeRep* __path[int(__detail::_S_max_rope_depth) + 1];
const _RopeRep* __curr_rope;
int __curr_depth = -1; /* index into path */
_Rope_iterator_base<_CharT, _Alloc>::
_S_setcache_for_incr(_Rope_iterator_base<_CharT, _Alloc>& __x)
{
+ using std::size_t;
int __current_index = __x._M_leaf_index;
const _RopeRep* __current_node = __x._M_path_end[__current_index];
size_t __len = __current_node->_M_size;
template <class _CharT, class _Alloc>
void
_Rope_iterator_base<_CharT, _Alloc>::
- _M_incr(size_t __n)
+ _M_incr(std::size_t __n)
{
_M_current_pos += __n;
if (0 != _M_buf_ptr)
{
- size_t __chars_left = _M_buf_end - _M_buf_ptr;
+ std::size_t __chars_left = _M_buf_end - _M_buf_ptr;
if (__chars_left > __n)
_M_buf_ptr += __n;
else if (__chars_left == __n)
template <class _CharT, class _Alloc>
void
_Rope_iterator_base<_CharT, _Alloc>::
- _M_decr(size_t __n)
+ _M_decr(std::size_t __n)
{
if (0 != _M_buf_ptr)
{
- size_t __chars_left = _M_buf_ptr - _M_buf_start;
+ std::size_t __chars_left = _M_buf_ptr - _M_buf_start;
if (__chars_left >= __n)
_M_buf_ptr -= __n;
else
template <class _CharT, class _Alloc>
inline
_Rope_iterator<_CharT, _Alloc>::
- _Rope_iterator(rope<_CharT, _Alloc>& __r, size_t __pos)
+ _Rope_iterator(rope<_CharT, _Alloc>& __r, std::size_t __pos)
: _Rope_iterator_base<_CharT,_Alloc>(__r._M_tree_ptr, __pos),
_M_root_rope(&__r)
{ _RopeRep::_S_ref(this->_M_root); }
template <class _CharT, class _Alloc>
- inline size_t
+ inline std::size_t
rope<_CharT, _Alloc>::
_S_char_ptr_len(const _CharT* __s)
{
_CharT* __cstr = _M_c_string;
if (0 != __cstr)
{
- size_t __size = this->_M_size + 1;
- _Destroy(__cstr, __cstr + __size, _M_get_allocator());
+ std::size_t __size = this->_M_size + 1;
+ std::_Destroy(__cstr, __cstr + __size, _M_get_allocator());
this->_Data_deallocate(__cstr, __size);
}
}
template <class _CharT, class _Alloc>
inline void
_Rope_RopeRep<_CharT, _Alloc>::
- _S_free_string(_CharT* __s, size_t __n, allocator_type& __a)
+ _S_free_string(_CharT* __s, std::size_t __n, allocator_type& __a)
{
if (!_S_is_basic_char_type((_CharT*)0))
- _Destroy(__s, __s + __n, __a);
+ std::_Destroy(__s, __s + __n, __a);
// This has to be a static member, so this gets a bit messy
__a.deallocate(__s,
template <class _CharT, class _Alloc>
inline void
_Rope_RopeRep<_CharT, _Alloc>::
- _S_free_string(const _CharT*, size_t, allocator_type)
+ _S_free_string(const _CharT*, std::size_t, allocator_type)
{ }
#endif
template <class _CharT, class _Alloc>
typename rope<_CharT, _Alloc>::_RopeLeaf*
rope<_CharT, _Alloc>::
- _S_leaf_concat_char_iter(_RopeLeaf* __r, const _CharT* __iter, size_t __len)
+ _S_leaf_concat_char_iter(_RopeLeaf* __r, const _CharT* __iter,
+ std::size_t __len)
{
- size_t __old_len = __r->_M_size;
+ std::size_t __old_len = __r->_M_size;
_CharT* __new_data = (_CharT*)
rope::_Data_allocate(_S_rounded_up_size(__old_len + __len));
_RopeLeaf* __result;
typename rope<_CharT,_Alloc>::_RopeLeaf*
rope<_CharT, _Alloc>::
_S_destr_leaf_concat_char_iter(_RopeLeaf* __r, const _CharT* __iter,
- size_t __len)
+ std::size_t __len)
{
if (__r->_M_ref_count > 1)
return _S_leaf_concat_char_iter(__r, __iter, __len);
- size_t __old_len = __r->_M_size;
+ std::size_t __old_len = __r->_M_size;
if (_S_allocated_capacity(__old_len) >= __old_len + __len)
{
// The space has been partially initialized for the standard
rope<_CharT, _Alloc>::
_S_tree_concat(_RopeRep* __left, _RopeRep* __right)
{
+ using std::size_t;
_RopeConcatenation* __result = _S_new_RopeConcatenation(__left, __right,
__left->
_M_get_allocator());
template <class _CharT, class _Alloc>
typename rope<_CharT, _Alloc>::_RopeRep*
rope<_CharT, _Alloc>::
- _S_concat_char_iter(_RopeRep* __r, const _CharT*__s, size_t __slen)
+ _S_concat_char_iter(_RopeRep* __r, const _CharT*__s, std::size_t __slen)
{
+ using std::size_t;
_RopeRep* __result;
if (0 == __slen)
{
template <class _CharT, class _Alloc>
typename rope<_CharT,_Alloc>::_RopeRep*
rope<_CharT,_Alloc>::
- _S_destr_concat_char_iter(_RopeRep* __r, const _CharT* __s, size_t __slen)
+ _S_destr_concat_char_iter(_RopeRep* __r, const _CharT* __s,
+ std::size_t __slen)
{
+ using std::size_t;
_RopeRep* __result;
if (0 == __r)
return __STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __slen,
rope<_CharT, _Alloc>::
_S_concat(_RopeRep* __left, _RopeRep* __right)
{
+ using std::size_t;
if (0 == __left)
{
_S_ref(__right);
template <class _CharT, class _Alloc>
typename rope<_CharT, _Alloc>::_RopeRep*
rope<_CharT, _Alloc>::
- _S_substring(_RopeRep* __base, size_t __start, size_t __endp1)
+ _S_substring(_RopeRep* __base, std::size_t __start, std::size_t __endp1)
{
+ using std::size_t;
if (0 == __base)
return 0;
size_t __len = __base->_M_size;
~_Rope_flatten_char_consumer() {}
bool
- operator()(const _CharT* __leaf, size_t __n)
+ operator()(const _CharT* __leaf, std::size_t __n)
{
uninitialized_copy_n(__leaf, __n, _M_buf_ptr);
_M_buf_ptr += __n;
private:
_CharT _M_pattern;
public:
- size_t _M_count; // Number of nonmatching characters
+ std::size_t _M_count; // Number of nonmatching characters
_Rope_find_char_char_consumer(_CharT __p)
: _M_pattern(__p), _M_count(0) {}
~_Rope_find_char_char_consumer() {}
bool
- operator()(const _CharT* __leaf, size_t __n)
+ operator()(const _CharT* __leaf, std::size_t __n)
{
- size_t __i;
+ std::size_t __i;
for (__i = 0; __i < __n; __i++)
{
if (__leaf[__i] == _M_pattern)
: public _Rope_char_consumer<_CharT>
{
private:
- typedef basic_ostream<_CharT,_Traits> _Insert_ostream;
+ typedef std::basic_ostream<_CharT,_Traits> _Insert_ostream;
_Insert_ostream& _M_o;
public:
_Rope_insert_char_consumer(_Insert_ostream& __writer)
: _M_o(__writer) {}
~_Rope_insert_char_consumer() { }
// Caller is presumed to own the ostream
- bool operator() (const _CharT* __leaf, size_t __n);
+ bool operator() (const _CharT* __leaf, std::size_t __n);
// Returns true to continue traversal.
};
template<class _CharT, class _Traits>
bool
_Rope_insert_char_consumer<_CharT, _Traits>::
- operator()(const _CharT* __leaf, size_t __n)
+ operator()(const _CharT* __leaf, std::size_t __n)
{
- size_t __i;
+ std::size_t __i;
// We assume that formatting is set up correctly for each element.
for (__i = 0; __i < __n; __i++)
_M_o.put(__leaf[__i]);
template <class _CharT, class _Alloc>
bool
rope<_CharT, _Alloc>::
- _S_apply_to_pieces(_Rope_char_consumer<_CharT>& __c,
- const _RopeRep* __r, size_t __begin, size_t __end)
+ _S_apply_to_pieces(_Rope_char_consumer<_CharT>& __c, const _RopeRep* __r,
+ std::size_t __begin, std::size_t __end)
{
+ using std::size_t;
if (0 == __r)
return true;
switch(__r->_M_tag)
template<class _CharT, class _Traits>
inline void
- _Rope_fill(basic_ostream<_CharT, _Traits>& __o, size_t __n)
+ _Rope_fill(std::basic_ostream<_CharT, _Traits>& __o, std::size_t __n)
{
char __f = __o.fill();
- size_t __i;
+ std::size_t __i;
for (__i = 0; __i < __n; __i++)
__o.put(__f);
{ return true; }
template<class _CharT, class _Traits, class _Alloc>
- basic_ostream<_CharT, _Traits>&
- operator<<(basic_ostream<_CharT, _Traits>& __o,
+ std::basic_ostream<_CharT, _Traits>&
+ operator<<(std::basic_ostream<_CharT, _Traits>& __o,
const rope<_CharT, _Alloc>& __r)
{
+ using std::size_t;
size_t __w = __o.width();
bool __left = bool(__o.flags() & std::ios::left);
size_t __pad_len;
template <class _CharT, class _Alloc>
_CharT*
rope<_CharT, _Alloc>::
- _S_flatten(_RopeRep* __r, size_t __start, size_t __len,
+ _S_flatten(_RopeRep* __r, std::size_t __start, std::size_t __len,
_CharT* __buffer)
{
_Rope_flatten_char_consumer<_CharT> __c(__buffer);
}
template <class _CharT, class _Alloc>
- size_t
+ std::size_t
rope<_CharT, _Alloc>::
- find(_CharT __pattern, size_t __start) const
+ find(_CharT __pattern, std::size_t __start) const
{
_Rope_find_char_char_consumer<_CharT> __c(__pattern);
_S_apply_to_pieces(__c, this->_M_tree_ptr, __start, size());
rope<_CharT, _Alloc>::
_S_dump(_RopeRep* __r, int __indent)
{
+ using std::printf;
for (int __i = 0; __i < __indent; __i++)
putchar(' ');
if (0 == __r)
}
if (__result->_M_depth > int(__detail::_S_max_rope_depth))
- __throw_length_error(__N("rope::_S_balance"));
+ std::__throw_length_error(__N("rope::_S_balance"));
return(__result);
}
_RopeRep* __insertee; // included in refcount
_RopeRep* __too_tiny = 0; // included in refcount
int __i; // forest[0..__i-1] is empty
- size_t __s = __r->_M_size;
+ std::size_t __s = __r->_M_size;
for (__i = 0; __s >= _S_min_len[__i+1]/* not this bucket */; ++__i)
{
{
_RopeConcatenation* __c = (_RopeConcatenation*)__r;
_RopeRep* __left = __c->_M_left;
- size_t __left_len = __left->_M_size;
+ std::size_t __left_len = __left->_M_size;
if (__i >= __left_len)
{
_S_fetch_ptr(_RopeRep* __r, size_type __i)
{
_RopeRep* __clrstack[__detail::_S_max_rope_depth];
- size_t __csptr = 0;
+ std::size_t __csptr = 0;
for(;;)
{
{
_RopeConcatenation* __c = (_RopeConcatenation*)__r;
_RopeRep* __left = __c->_M_left;
- size_t __left_len = __left->_M_size;
+ std::size_t __left_len = __left->_M_size;
if (__c->_M_c_string != 0)
__clrstack[__csptr++] = __c;
rope<_CharT, _Alloc>::
_S_compare (const _RopeRep* __left, const _RopeRep* __right)
{
- size_t __left_len;
- size_t __right_len;
+ std::size_t __left_len;
+ std::size_t __right_len;
if (0 == __right)
return 0 != __left;
template <class _CharT, class _Alloc>
rope<_CharT, _Alloc>::
- rope(size_t __n, _CharT __c, const allocator_type& __a)
+ rope(std::size_t __n, _CharT __c, const allocator_type& __a)
: _Base(__a)
{
+ using std::__uninitialized_fill_n_a;
+
rope<_CharT,_Alloc> __result;
- const size_t __exponentiate_threshold = 32;
- size_t __exponent;
- size_t __rest;
+ const std::size_t __exponentiate_threshold = 32;
+ std::size_t __exponent;
+ std::size_t __rest;
_CharT* __rest_buffer;
_RopeRep* __remainder;
rope<_CharT, _Alloc> __remainder_rope;
__GC_CONST _CharT* __result = this->_M_tree_ptr->_M_c_string;
if (0 == __result)
{
- size_t __s = size();
+ std::size_t __s = size();
__result = this->_Data_allocate(__s + 1);
_S_flatten(this->_M_tree_ptr, __result);
__result[__s] = _S_eos((_CharT*)0);
if (__detail::_S_leaf == this->_M_tree_ptr->_M_tag
&& 0 != __old_c_string)
return(__old_c_string);
- size_t __s = size();
+ std::size_t __s = size();
_CharT* __result = this->_Data_allocate(_S_rounded_up_size(__s));
_S_flatten(this->_M_tree_ptr, __result);
__result[__s] = _S_eos((_CharT*)0);
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
- using std::size_t;
- using std::ptrdiff_t;
- using std::_Construct;
- using std::_Destroy;
- using std::allocator;
- using std::__true_type;
- using std::__false_type;
-
struct _Slist_node_base
{
_Slist_node_base* _M_next;
return __result;
}
- inline size_t
+ inline std::size_t
__slist_size(_Slist_node_base* __node)
{
- size_t __result = 0;
+ std::size_t __result = 0;
for (; __node != 0; __node = __node->_M_next)
++__result;
return __result;
struct _Slist_iterator_base
{
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
+ typedef std::size_t size_type;
+ typedef std::ptrdiff_t difference_type;
typedef std::forward_iterator_tag iterator_category;
_Slist_node_base* _M_node;
* @ingroup SGIextensions
* @doctodo
*/
- template <class _Tp, class _Alloc = allocator<_Tp> >
+ template <class _Tp, class _Alloc = std::allocator<_Tp> >
class slist : private _Slist_base<_Tp,_Alloc>
{
// concept requirements
typedef const value_type* const_pointer;
typedef value_type& reference;
typedef const value_type& const_reference;
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
+ typedef std::size_t size_type;
+ typedef std::ptrdiff_t difference_type;
typedef _Slist_iterator<_Tp, _Tp&, _Tp*> iterator;
typedef _Slist_iterator<_Tp, const _Tp&, const _Tp*> const_iterator;
template <class _Integer>
void
- _M_assign_dispatch(_Integer __n, _Integer __val, __true_type)
+ _M_assign_dispatch(_Integer __n, _Integer __val, std::__true_type)
{ _M_fill_assign((size_type) __n, (_Tp) __val); }
template <class _InputIterator>
void
_M_assign_dispatch(_InputIterator __first, _InputIterator __last,
- __false_type);
+ std::__false_type);
public:
template <class _Integer>
void
_M_insert_after_range(_Node_base* __pos, _Integer __n, _Integer __x,
- __true_type)
+ std::__true_type)
{ _M_insert_after_fill(__pos, __n, __x); }
template <class _InIterator>
void
_M_insert_after_range(_Node_base* __pos,
_InIterator __first, _InIterator __last,
- __false_type)
+ std::__false_type)
{
while (__first != __last)
{
void
slist<_Tp, _Alloc>::_M_assign_dispatch(_InputIterator __first,
_InputIterator __last,
- __false_type)
+ std::__false_type)
{
_Node_base* __prev = &this->_M_head;
_Node* __node = (_Node*) this->_M_head._M_next;