Commit 3263fb9c by Jonathan Wakely Committed by Jonathan Wakely

Remove using-declarations that add std names to __gnu_cxx

These using-declarations appear to have been added for simplicity when
moving the non-standard extensions from namespace std to namespace
__gnu_cxx. Dumping all these names into namespace __gnu_cxx allows
unportable uses like __gnu_cxx::size_t and __gnu_cxx::pair, which serve
no useful purpose.

This patch removes most of the using-declarations from namespace scope,
then either qualifies names as needed or adds using-declarations at
block scope or typedefs at class scope.

	* 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.

From-SVN: r271807
parent 608a080c
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> 2019-05-31 Antony Polukhin <antoshkka@gmail.com>
PR libstdc++/71579 PR libstdc++/71579
......
...@@ -69,17 +69,6 @@ namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) ...@@ -69,17 +69,6 @@ namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
{ {
_GLIBCXX_BEGIN_NAMESPACE_VERSION _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> template<class _Val>
struct _Hashtable_node struct _Hashtable_node
{ {
...@@ -112,10 +101,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -112,10 +101,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_ExtractKey, _EqualKey, _Alloc> _ExtractKey, _EqualKey, _Alloc>
const_iterator; const_iterator;
typedef _Hashtable_node<_Val> _Node; typedef _Hashtable_node<_Val> _Node;
typedef forward_iterator_tag iterator_category; typedef std::forward_iterator_tag iterator_category;
typedef _Val value_type; typedef _Val value_type;
typedef ptrdiff_t difference_type; typedef std::ptrdiff_t difference_type;
typedef size_t size_type; typedef std::size_t size_type;
typedef _Val& reference; typedef _Val& reference;
typedef _Val* pointer; typedef _Val* pointer;
...@@ -164,10 +153,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -164,10 +153,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
const_iterator; const_iterator;
typedef _Hashtable_node<_Val> _Node; typedef _Hashtable_node<_Val> _Node;
typedef forward_iterator_tag iterator_category; typedef std::forward_iterator_tag iterator_category;
typedef _Val value_type; typedef _Val value_type;
typedef ptrdiff_t difference_type; typedef std::ptrdiff_t difference_type;
typedef size_t size_type; typedef std::size_t size_type;
typedef const _Val& reference; typedef const _Val& reference;
typedef const _Val* pointer; typedef const _Val* pointer;
...@@ -272,8 +261,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -272,8 +261,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
typedef _HashFcn hasher; typedef _HashFcn hasher;
typedef _EqualKey key_equal; typedef _EqualKey key_equal;
typedef size_t size_type; typedef std::size_t size_type;
typedef ptrdiff_t difference_type; typedef std::ptrdiff_t difference_type;
typedef value_type* pointer; typedef value_type* pointer;
typedef const value_type* const_pointer; typedef const value_type* const_pointer;
typedef value_type& reference; typedef value_type& reference;
...@@ -299,7 +288,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -299,7 +288,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
private: private:
typedef typename _Alloc::template rebind<_Node>::other _Node_Alloc; typedef typename _Alloc::template rebind<_Node>::other _Node_Alloc;
typedef typename _Alloc::template rebind<_Node*>::other _Nodeptr_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; _Node_Alloc _M_node_allocator;
...@@ -445,7 +434,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -445,7 +434,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
return __result; return __result;
} }
pair<iterator, bool> std::pair<iterator, bool>
insert_unique(const value_type& __obj) insert_unique(const value_type& __obj)
{ {
resize(_M_num_elements + 1); resize(_M_num_elements + 1);
...@@ -459,7 +448,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -459,7 +448,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
return insert_equal_noresize(__obj); return insert_equal_noresize(__obj);
} }
pair<iterator, bool> std::pair<iterator, bool>
insert_unique_noresize(const value_type& __obj); insert_unique_noresize(const value_type& __obj);
iterator iterator
...@@ -468,17 +457,17 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -468,17 +457,17 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<class _InputIterator> template<class _InputIterator>
void void
insert_unique(_InputIterator __f, _InputIterator __l) insert_unique(_InputIterator __f, _InputIterator __l)
{ insert_unique(__f, __l, __iterator_category(__f)); } { insert_unique(__f, __l, std::__iterator_category(__f)); }
template<class _InputIterator> template<class _InputIterator>
void void
insert_equal(_InputIterator __f, _InputIterator __l) insert_equal(_InputIterator __f, _InputIterator __l)
{ insert_equal(__f, __l, __iterator_category(__f)); } { insert_equal(__f, __l, std::__iterator_category(__f)); }
template<class _InputIterator> template<class _InputIterator>
void void
insert_unique(_InputIterator __f, _InputIterator __l, insert_unique(_InputIterator __f, _InputIterator __l,
input_iterator_tag) std::input_iterator_tag)
{ {
for ( ; __f != __l; ++__f) for ( ; __f != __l; ++__f)
insert_unique(*__f); insert_unique(*__f);
...@@ -487,7 +476,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -487,7 +476,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<class _InputIterator> template<class _InputIterator>
void void
insert_equal(_InputIterator __f, _InputIterator __l, insert_equal(_InputIterator __f, _InputIterator __l,
input_iterator_tag) std::input_iterator_tag)
{ {
for ( ; __f != __l; ++__f) for ( ; __f != __l; ++__f)
insert_equal(*__f); insert_equal(*__f);
...@@ -496,9 +485,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -496,9 +485,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<class _ForwardIterator> template<class _ForwardIterator>
void void
insert_unique(_ForwardIterator __f, _ForwardIterator __l, 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); resize(_M_num_elements + __n);
for ( ; __n > 0; --__n, ++__f) for ( ; __n > 0; --__n, ++__f)
insert_unique_noresize(*__f); insert_unique_noresize(*__f);
...@@ -507,9 +496,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -507,9 +496,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<class _ForwardIterator> template<class _ForwardIterator>
void void
insert_equal(_ForwardIterator __f, _ForwardIterator __l, 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); resize(_M_num_elements + __n);
for ( ; __n > 0; --__n, ++__f) for ( ; __n > 0; --__n, ++__f)
insert_equal_noresize(*__f); insert_equal_noresize(*__f);
...@@ -555,10 +544,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -555,10 +544,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
return __result; return __result;
} }
pair<iterator, iterator> std::pair<iterator, iterator>
equal_range(const key_type& __key); equal_range(const key_type& __key);
pair<const_iterator, const_iterator> std::pair<const_iterator, const_iterator>
equal_range(const key_type& __key) const; equal_range(const key_type& __key) const;
size_type size_type
...@@ -605,11 +594,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -605,11 +594,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ return _M_bkt_num_key(_M_get_key(__obj)); } { return _M_bkt_num_key(_M_get_key(__obj)); }
size_type 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; } { return _M_hash(__key) % __n; }
size_type 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); } { return _M_bkt_num_key(_M_get_key(__obj), __n); }
_Node* _Node*
...@@ -712,7 +701,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -712,7 +701,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
if (__ht1._M_buckets.size() != __ht2._M_buckets.size()) if (__ht1._M_buckets.size() != __ht2._M_buckets.size())
return false; 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* __cur1 = __ht1._M_buckets[__n];
_Node* __cur2 = __ht2._M_buckets[__n]; _Node* __cur2 = __ht2._M_buckets[__n];
...@@ -757,7 +746,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -757,7 +746,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ __ht1.swap(__ht2); } { __ht1.swap(__ht2); }
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, bool> std::pair<typename hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::iterator,
bool>
hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>:: hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::
insert_unique_noresize(const value_type& __obj) insert_unique_noresize(const value_type& __obj)
{ {
...@@ -766,13 +756,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -766,13 +756,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
for (_Node* __cur = __first; __cur; __cur = __cur->_M_next) for (_Node* __cur = __first; __cur; __cur = __cur->_M_next)
if (_M_equals(_M_get_key(__cur->_M_val), _M_get_key(__obj))) 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); _Node* __tmp = _M_new_node(__obj);
__tmp->_M_next = __first; __tmp->_M_next = __first;
_M_buckets[__n] = __tmp; _M_buckets[__n] = __tmp;
++_M_num_elements; ++_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>
...@@ -822,12 +812,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -822,12 +812,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
} }
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, std::pair<typename hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::iterator,
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>:: hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::
equal_range(const key_type& __key) 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); const size_type __n = _M_bkt_num_key(__key);
for (_Node* __first = _M_buckets[__n]; __first; for (_Node* __first = _M_buckets[__n]; __first;
...@@ -848,12 +838,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -848,12 +838,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
} }
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>::const_iterator, std::pair<
typename hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::const_iterator> 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>:: hashtable<_Val, _Key, _HF, _Ex, _Eq, _All>::
equal_range(const key_type& __key) const 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); const size_type __n = _M_bkt_num_key(__key);
for (const _Node* __first = _M_buckets[__n]; __first; for (const _Node* __first = _M_buckets[__n]; __first;
......
...@@ -46,9 +46,6 @@ namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) ...@@ -46,9 +46,6 @@ namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
{ {
_GLIBCXX_BEGIN_NAMESPACE_VERSION _GLIBCXX_BEGIN_NAMESPACE_VERSION
using std::size_t;
using std::ptrdiff_t;
namespace __detail namespace __detail
{ {
/** @class __mini_vector bitmap_allocator.h bitmap_allocator.h /** @class __mini_vector bitmap_allocator.h bitmap_allocator.h
...@@ -77,8 +74,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -77,8 +74,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
typedef _Tp* pointer; typedef _Tp* pointer;
typedef _Tp& reference; typedef _Tp& reference;
typedef const _Tp& const_reference; typedef const _Tp& const_reference;
typedef size_t size_type; typedef std::size_t size_type;
typedef ptrdiff_t difference_type; typedef std::ptrdiff_t difference_type;
typedef pointer iterator; typedef pointer iterator;
private: private:
...@@ -223,13 +220,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -223,13 +220,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
struct __mv_iter_traits<_Tp*> struct __mv_iter_traits<_Tp*>
{ {
typedef _Tp value_type; typedef _Tp value_type;
typedef ptrdiff_t difference_type; typedef std::ptrdiff_t difference_type;
}; };
enum enum
{ {
bits_per_byte = 8, 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> template<typename _ForwardIterator, typename _Tp, typename _Compare>
...@@ -265,7 +262,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -265,7 +262,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* passed to the function. * passed to the function.
*/ */
template<typename _AddrPair> template<typename _AddrPair>
inline size_t inline std::size_t
__num_blocks(_AddrPair __ap) __num_blocks(_AddrPair __ap)
{ return (__ap.second - __ap.first) + 1; } { return (__ap.second - __ap.first) + 1; }
...@@ -273,9 +270,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -273,9 +270,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* passed to the function. * passed to the function.
*/ */
template<typename _AddrPair> template<typename _AddrPair>
inline size_t inline std::size_t
__num_bitmaps(_AddrPair __ap) __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. // _Tp should be a pointer type.
template<typename _Tp> template<typename _Tp>
...@@ -336,7 +333,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -336,7 +333,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
typedef typename __detail::__mini_vector<_Block_pair> _BPVector; typedef typename __detail::__mini_vector<_Block_pair> _BPVector;
typedef typename _BPVector::difference_type _Counter_type; typedef typename _BPVector::difference_type _Counter_type;
size_t* _M_pbitmap; std::size_t* _M_pbitmap;
_Counter_type _M_data_offset; _Counter_type _M_data_offset;
public: public:
...@@ -346,6 +343,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -346,6 +343,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
bool bool
operator()(_Block_pair __bp) throw() operator()(_Block_pair __bp) throw()
{ {
using std::size_t;
// Set the _rover to the last physical location bitmap, // Set the _rover to the last physical location bitmap,
// which is the bitmap which belongs to the first free // which is the bitmap which belongs to the first free
// block. Thus, the bitmaps are in exact reverse order of // block. Thus, the bitmaps are in exact reverse order of
...@@ -377,13 +375,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -377,13 +375,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
return false; return false;
} }
size_t* std::size_t*
_M_get() const throw() _M_get() const throw()
{ return _M_pbitmap; } { return _M_pbitmap; }
_Counter_type _Counter_type
_M_offset() const throw() _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 /** @class _Bitmap_counter bitmap_allocator.h bitmap_allocator.h
...@@ -402,8 +400,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -402,8 +400,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
typedef _Tp pointer; typedef _Tp pointer;
_BPVector& _M_vbp; _BPVector& _M_vbp;
size_t* _M_curr_bmap; std::size_t* _M_curr_bmap;
size_t* _M_last_bmap_in_block; std::size_t* _M_last_bmap_in_block;
_Index_type _M_curr_index; _Index_type _M_curr_index;
public: public:
...@@ -424,7 +422,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -424,7 +422,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
} }
_M_curr_index = __index; _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; (_M_vbp[_M_curr_index].first) - 1;
_GLIBCXX_DEBUG_ASSERT(__index <= (long)_M_vbp.size() - 1); _GLIBCXX_DEBUG_ASSERT(__index <= (long)_M_vbp.size() - 1);
...@@ -432,14 +430,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -432,14 +430,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_M_last_bmap_in_block = _M_curr_bmap _M_last_bmap_in_block = _M_curr_bmap
- ((_M_vbp[_M_curr_index].second - ((_M_vbp[_M_curr_index].second
- _M_vbp[_M_curr_index].first + 1) - _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 // Dangerous Function! Use with extreme care. Pass to this
// function ONLY those values that are known to be correct, // function ONLY those values that are known to be correct,
// otherwise this will mess up big time. // otherwise this will mess up big time.
void 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; } { _M_curr_bmap = __new_internal_marker; }
bool bool
...@@ -461,7 +459,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -461,7 +459,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
return *this; return *this;
} }
size_t* std::size_t*
_M_get() const throw() _M_get() const throw()
{ return _M_curr_bmap; } { return _M_curr_bmap; }
...@@ -472,8 +470,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -472,8 +470,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_Index_type _Index_type
_M_offset() const throw() _M_offset() const throw()
{ {
return size_t(bits_per_block) return std::size_t(bits_per_block)
* ((reinterpret_cast<size_t*>(this->_M_base()) * ((reinterpret_cast<std::size_t*>(this->_M_base())
- _M_curr_bmap) - 1); - _M_curr_bmap) - 1);
} }
...@@ -486,9 +484,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -486,9 +484,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* corresponding bit in the bit-map. * corresponding bit in the bit-map.
*/ */
inline void 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; __mask = ~__mask;
*__pbmap &= __mask; *__pbmap &= __mask;
} }
...@@ -497,18 +495,18 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -497,18 +495,18 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* corresponding bit in the bit-map. * corresponding bit in the bit-map.
*/ */
inline void 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; *__pbmap |= __mask;
} }
} // namespace __detail } // namespace __detail
/** @brief Generic Version of the bsf instruction. /** @brief Generic Version of the bsf instruction.
*/ */
inline size_t inline std::size_t
_Bit_scan_forward(size_t __num) _Bit_scan_forward(std::size_t __num)
{ return static_cast<size_t>(__builtin_ctzl(__num)); } { return static_cast<std::size_t>(__builtin_ctzl(__num)); }
/** @class free_list bitmap_allocator.h bitmap_allocator.h /** @class free_list bitmap_allocator.h bitmap_allocator.h
* *
...@@ -518,7 +516,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -518,7 +516,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
class free_list class free_list
{ {
public: public:
typedef size_t* value_type; typedef std::size_t* value_type;
typedef __detail::__mini_vector<value_type> vector_type; typedef __detail::__mini_vector<value_type> vector_type;
typedef vector_type::iterator iterator; typedef vector_type::iterator iterator;
typedef __mutex __mutex_type; typedef __mutex __mutex_type;
...@@ -527,8 +525,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -527,8 +525,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
struct _LT_pointer_compare struct _LT_pointer_compare
{ {
bool bool
operator()(const size_t* __pui, operator()(const std::size_t* __pui,
const size_t __cui) const throw() const std::size_t __cui) const throw()
{ return *__pui < __cui; } { return *__pui < __cui; }
}; };
...@@ -559,7 +557,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -559,7 +557,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* or larger blocks from the free list. * or larger blocks from the free list.
*/ */
void void
_M_validate(size_t* __addr) throw() _M_validate(std::size_t* __addr) throw()
{ {
vector_type& __free_list = _M_get_free_list(); vector_type& __free_list = _M_get_free_list();
const vector_type::size_type __max_size = 64; const vector_type::size_type __max_size = 64;
...@@ -605,10 +603,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -605,10 +603,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* false. * false.
*/ */
bool bool
_M_should_i_give(size_t __block_size, _M_should_i_give(std::size_t __block_size,
size_t __required_size) throw() 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 && if (__block_size >= __required_size &&
(((__block_size - __required_size) * 100 / __block_size) (((__block_size - __required_size) * 100 / __block_size)
< __max_wastage_percentage)) < __max_wastage_percentage))
...@@ -625,14 +623,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -625,14 +623,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* by a call to the _M_get function. * by a call to the _M_get function.
*/ */
inline void inline void
_M_insert(size_t* __addr) throw() _M_insert(std::size_t* __addr) throw()
{ {
#if defined __GTHREADS #if defined __GTHREADS
__scoped_lock __bfl_lock(_M_get_mutex()); __scoped_lock __bfl_lock(_M_get_mutex());
#endif #endif
// Call _M_validate to decide what should be done with // Call _M_validate to decide what should be done with
// this particular free list. // 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! // See discussion as to why this is 1!
} }
...@@ -644,8 +642,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -644,8 +642,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* @return A pointer to the new memory block of size at least * @return A pointer to the new memory block of size at least
* equal to that requested. * equal to that requested.
*/ */
size_t* std::size_t*
_M_get(size_t __sz) _GLIBCXX_THROW(std::bad_alloc); _M_get(std::size_t __sz) _GLIBCXX_THROW(std::bad_alloc);
/** @brief This function just clears the internal Free List, and /** @brief This function just clears the internal Free List, and
* gives back all the memory to the OS. * gives back all the memory to the OS.
...@@ -684,8 +682,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -684,8 +682,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
class bitmap_allocator : private free_list class bitmap_allocator : private free_list
{ {
public: public:
typedef size_t size_type; typedef std::size_t size_type;
typedef ptrdiff_t difference_type; typedef std::ptrdiff_t difference_type;
typedef _Tp* pointer; typedef _Tp* pointer;
typedef const _Tp* const_pointer; typedef const _Tp* const_pointer;
typedef _Tp& reference; typedef _Tp& reference;
...@@ -706,7 +704,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -706,7 +704,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
#endif #endif
private: private:
template<size_t _BSize, size_t _AlignSize> template<std::size_t _BSize, std::size_t _AlignSize>
struct aligned_size struct aligned_size
{ {
enum enum
...@@ -765,6 +763,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -765,6 +763,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
void void
_S_refill_pool() _GLIBCXX_THROW(std::bad_alloc) _S_refill_pool() _GLIBCXX_THROW(std::bad_alloc)
{ {
using std::size_t;
#if defined _GLIBCXX_DEBUG #if defined _GLIBCXX_DEBUG
_S_check_for_free_blocks(); _S_check_for_free_blocks();
#endif #endif
...@@ -798,7 +797,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -798,7 +797,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
} }
static _BPVector _S_mem_blocks; 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 __detail::_Bitmap_counter<_Alloc_block*> _S_last_request;
static typename _BPVector::size_type _S_last_dealloc_index; static typename _BPVector::size_type _S_last_dealloc_index;
#if defined __GTHREADS #if defined __GTHREADS
...@@ -823,6 +822,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -823,6 +822,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
pointer pointer
_M_allocate_single_object() _GLIBCXX_THROW(std::bad_alloc) _M_allocate_single_object() _GLIBCXX_THROW(std::bad_alloc)
{ {
using std::size_t;
#if defined __GTHREADS #if defined __GTHREADS
__scoped_lock __bit_lock(_S_mut); __scoped_lock __bit_lock(_S_mut);
#endif #endif
...@@ -913,6 +913,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -913,6 +913,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
void void
_M_deallocate_single_object(pointer __p) throw() _M_deallocate_single_object(pointer __p) throw()
{ {
using std::size_t;
#if defined __GTHREADS #if defined __GTHREADS
__scoped_lock __bit_lock(_S_mut); __scoped_lock __bit_lock(_S_mut);
#endif #endif
...@@ -1109,8 +1110,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -1109,8 +1110,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
bitmap_allocator<_Tp>::_S_mem_blocks; bitmap_allocator<_Tp>::_S_mem_blocks;
template<typename _Tp> template<typename _Tp>
size_t bitmap_allocator<_Tp>::_S_block_size = std::size_t bitmap_allocator<_Tp>::_S_block_size
2 * size_t(__detail::bits_per_block); = 2 * std::size_t(__detail::bits_per_block);
template<typename _Tp> template<typename _Tp>
typename bitmap_allocator<_Tp>::_BPVector::size_type typename bitmap_allocator<_Tp>::_BPVector::size_type
......
...@@ -50,8 +50,6 @@ namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) ...@@ -50,8 +50,6 @@ namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
{ {
_GLIBCXX_BEGIN_NAMESPACE_VERSION _GLIBCXX_BEGIN_NAMESPACE_VERSION
using std::size_t;
/** /**
* @brief A meta-allocator with debugging bits. * @brief A meta-allocator with debugging bits.
* @ingroup allocators * @ingroup allocators
...@@ -103,7 +101,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -103,7 +101,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
size_type _S_extra() 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; return (sizeof(size_type) + __obj_size - 1) / __obj_size;
} }
......
...@@ -64,14 +64,6 @@ namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) ...@@ -64,14 +64,6 @@ namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
{ {
_GLIBCXX_BEGIN_NAMESPACE_VERSION _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++ /** The @c identity_element functions are not part of the C++
* standard; SGI provided them as an extension. Its argument is an * standard; SGI provided them as an extension. Its argument is an
* operation, and its return value is the identity element for that * operation, and its return value is the identity element for that
...@@ -123,8 +115,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -123,8 +115,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
/// An \link SGIextensions SGI extension \endlink. /// An \link SGIextensions SGI extension \endlink.
template <class _Operation1, class _Operation2> template <class _Operation1, class _Operation2>
class unary_compose class unary_compose
: public unary_function<typename _Operation2::argument_type, : public std::unary_function<typename _Operation2::argument_type,
typename _Operation1::result_type> typename _Operation1::result_type>
{ {
protected: protected:
_Operation1 _M_fn1; _Operation1 _M_fn1;
...@@ -148,8 +140,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -148,8 +140,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
/// An \link SGIextensions SGI extension \endlink. /// An \link SGIextensions SGI extension \endlink.
template <class _Operation1, class _Operation2, class _Operation3> template <class _Operation1, class _Operation2, class _Operation3>
class binary_compose class binary_compose
: public unary_function<typename _Operation2::argument_type, : public std::unary_function<typename _Operation2::argument_type,
typename _Operation1::result_type> typename _Operation1::result_type>
{ {
protected: protected:
_Operation1 _M_fn1; _Operation1 _M_fn1;
...@@ -209,7 +201,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -209,7 +201,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// extension documented next // extension documented next
template <class _Arg1, class _Arg2> template <class _Arg1, class _Arg2>
struct _Project1st : public binary_function<_Arg1, _Arg2, _Arg1> struct _Project1st : public std::binary_function<_Arg1, _Arg2, _Arg1>
{ {
_Arg1 _Arg1
operator()(const _Arg1& __x, const _Arg2&) const operator()(const _Arg1& __x, const _Arg2&) const
...@@ -217,7 +209,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -217,7 +209,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}; };
template <class _Arg1, class _Arg2> template <class _Arg1, class _Arg2>
struct _Project2nd : public binary_function<_Arg1, _Arg2, _Arg2> struct _Project2nd : public std::binary_function<_Arg1, _Arg2, _Arg2>
{ {
_Arg2 _Arg2
operator()(const _Arg1&, const _Arg2& __y) const operator()(const _Arg1&, const _Arg2& __y) const
...@@ -350,12 +342,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -350,12 +342,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* @ingroup SGIextensions * @ingroup SGIextensions
*/ */
class subtractive_rng class subtractive_rng
: public unary_function<unsigned int, unsigned int> : public std::unary_function<unsigned int, unsigned int>
{ {
private: private:
unsigned int _M_table[55]; unsigned int _M_table[55];
size_t _M_index1; std::size_t _M_index1;
size_t _M_index2; std::size_t _M_index2;
public: public:
/// Returns a number less than the argument. /// Returns a number less than the argument.
...@@ -373,10 +365,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -373,10 +365,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ {
unsigned int __k = 1; unsigned int __k = 1;
_M_table[54] = __seed; _M_table[54] = __seed;
size_t __i; std::size_t __i;
for (__i = 0; __i < 54; __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; _M_table[__ii] = __k;
__k = __seed - __k; __k = __seed - __k;
__seed = _M_table[__ii]; __seed = _M_table[__ii];
...@@ -404,24 +396,24 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -404,24 +396,24 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// the C++ standard. // the C++ standard.
template <class _Ret, class _Tp, class _Arg> 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)) 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> 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) 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> 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)) 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> 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) 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 _GLIBCXX_END_NAMESPACE_VERSION
} // namespace } // namespace
......
...@@ -42,9 +42,6 @@ namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) ...@@ -42,9 +42,6 @@ namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
{ {
_GLIBCXX_BEGIN_NAMESPACE_VERSION _GLIBCXX_BEGIN_NAMESPACE_VERSION
using std::size_t;
using std::ptrdiff_t;
/** /**
* @brief An allocator that uses malloc. * @brief An allocator that uses malloc.
* @ingroup allocators * @ingroup allocators
...@@ -57,8 +54,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -57,8 +54,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
class malloc_allocator class malloc_allocator
{ {
public: public:
typedef size_t size_type; typedef std::size_t size_type;
typedef ptrdiff_t difference_type; typedef std::ptrdiff_t difference_type;
typedef _Tp* pointer; typedef _Tp* pointer;
typedef const _Tp* const_pointer; typedef const _Tp* const_pointer;
typedef _Tp& reference; typedef _Tp& reference;
...@@ -141,9 +138,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -141,9 +138,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
max_size() const _GLIBCXX_USE_NOEXCEPT max_size() const _GLIBCXX_USE_NOEXCEPT
{ {
#if __PTRDIFF_MAX__ < __SIZE_MAX__ #if __PTRDIFF_MAX__ < __SIZE_MAX__
return size_t(__PTRDIFF_MAX__) / sizeof(_Tp); return std::size_t(__PTRDIFF_MAX__) / sizeof(_Tp);
#else #else
return size_t(-1) / sizeof(_Tp); return std::size_t(-1) / sizeof(_Tp);
#endif #endif
} }
......
...@@ -65,13 +65,10 @@ namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) ...@@ -65,13 +65,10 @@ namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
{ {
_GLIBCXX_BEGIN_NAMESPACE_VERSION _GLIBCXX_BEGIN_NAMESPACE_VERSION
using std::ptrdiff_t;
using std::pair;
using std::__iterator_category;
using std::_Temporary_buffer; using std::_Temporary_buffer;
template<typename _InputIter, typename _Size, typename _ForwardIter> template<typename _InputIter, typename _Size, typename _ForwardIter>
pair<_InputIter, _ForwardIter> std::pair<_InputIter, _ForwardIter>
__uninitialized_copy_n(_InputIter __first, _Size __count, __uninitialized_copy_n(_InputIter __first, _Size __count,
_ForwardIter __result, std::input_iterator_tag) _ForwardIter __result, std::input_iterator_tag)
{ {
...@@ -80,7 +77,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -80,7 +77,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ {
for (; __count > 0 ; --__count, ++__first, ++__cur) for (; __count > 0 ; --__count, ++__first, ++__cur)
std::_Construct(&*__cur, *__first); std::_Construct(&*__cur, *__first);
return pair<_InputIter, _ForwardIter>(__first, __cur); return std::pair<_InputIter, _ForwardIter>(__first, __cur);
} }
__catch(...) __catch(...)
{ {
...@@ -90,22 +87,24 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -90,22 +87,24 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
} }
template<typename _RandomAccessIter, typename _Size, typename _ForwardIter> template<typename _RandomAccessIter, typename _Size, typename _ForwardIter>
inline pair<_RandomAccessIter, _ForwardIter> inline std::pair<_RandomAccessIter, _ForwardIter>
__uninitialized_copy_n(_RandomAccessIter __first, _Size __count, __uninitialized_copy_n(_RandomAccessIter __first, _Size __count,
_ForwardIter __result, _ForwardIter __result,
std::random_access_iterator_tag) std::random_access_iterator_tag)
{ {
_RandomAccessIter __last = __first + __count; _RandomAccessIter __last = __first + __count;
return (pair<_RandomAccessIter, _ForwardIter> return (std::pair<_RandomAccessIter, _ForwardIter>
(__last, std::uninitialized_copy(__first, __last, __result))); (__last, std::uninitialized_copy(__first, __last, __result)));
} }
template<typename _InputIter, typename _Size, typename _ForwardIter> template<typename _InputIter, typename _Size, typename _ForwardIter>
inline pair<_InputIter, _ForwardIter> inline std::pair<_InputIter, _ForwardIter>
__uninitialized_copy_n(_InputIter __first, _Size __count, __uninitialized_copy_n(_InputIter __first, _Size __count,
_ForwardIter __result) _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. * @brief Copies the range [first,last) into result.
...@@ -118,18 +117,20 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -118,18 +117,20 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* Like copy(), but does not require an initialized output range. * Like copy(), but does not require an initialized output range.
*/ */
template<typename _InputIter, typename _Size, typename _ForwardIter> template<typename _InputIter, typename _Size, typename _ForwardIter>
inline pair<_InputIter, _ForwardIter> inline std::pair<_InputIter, _ForwardIter>
uninitialized_copy_n(_InputIter __first, _Size __count, uninitialized_copy_n(_InputIter __first, _Size __count,
_ForwardIter __result) _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 // An alternative version of uninitialized_copy_n that constructs
// and destroys objects with a user-provided allocator. // and destroys objects with a user-provided allocator.
template<typename _InputIter, typename _Size, typename _ForwardIter, template<typename _InputIter, typename _Size, typename _ForwardIter,
typename _Allocator> typename _Allocator>
pair<_InputIter, _ForwardIter> std::pair<_InputIter, _ForwardIter>
__uninitialized_copy_n_a(_InputIter __first, _Size __count, __uninitialized_copy_n_a(_InputIter __first, _Size __count,
_ForwardIter __result, _ForwardIter __result,
_Allocator __alloc) _Allocator __alloc)
...@@ -139,7 +140,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -139,7 +140,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ {
for (; __count > 0 ; --__count, ++__first, ++__cur) for (; __count > 0 ; --__count, ++__first, ++__cur)
__alloc.construct(&*__cur, *__first); __alloc.construct(&*__cur, *__first);
return pair<_InputIter, _ForwardIter>(__first, __cur); return std::pair<_InputIter, _ForwardIter>(__first, __cur);
} }
__catch(...) __catch(...)
{ {
...@@ -150,7 +151,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -150,7 +151,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _InputIter, typename _Size, typename _ForwardIter, template<typename _InputIter, typename _Size, typename _ForwardIter,
typename _Tp> typename _Tp>
inline pair<_InputIter, _ForwardIter> inline std::pair<_InputIter, _ForwardIter>
__uninitialized_copy_n_a(_InputIter __first, _Size __count, __uninitialized_copy_n_a(_InputIter __first, _Size __count,
_ForwardIter __result, _ForwardIter __result,
std::allocator<_Tp>) std::allocator<_Tp>)
......
...@@ -42,8 +42,6 @@ namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) ...@@ -42,8 +42,6 @@ namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
{ {
_GLIBCXX_BEGIN_NAMESPACE_VERSION _GLIBCXX_BEGIN_NAMESPACE_VERSION
using std::size_t;
using std::ptrdiff_t;
typedef void (*__destroy_handler)(void*); typedef void (*__destroy_handler)(void*);
...@@ -53,11 +51,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -53,11 +51,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// Using short int as type for the binmap implies we are never // Using short int as type for the binmap implies we are never
// caching blocks larger than 32768 with this allocator. // caching blocks larger than 32768 with this allocator.
typedef unsigned short int _Binmap_type; typedef unsigned short int _Binmap_type;
typedef std::size_t size_t;
// Variables used to configure the behavior of the allocator, // Variables used to configure the behavior of the allocator,
// assigned and explained in detail below. // assigned and explained in detail below.
struct _Tune struct _Tune
{ {
// Compile time constants for the default _Tune values. // Compile time constants for the default _Tune values.
enum { _S_align = 8 }; enum { _S_align = 8 };
enum { _S_max_bytes = 128 }; enum { _S_max_bytes = 128 };
...@@ -477,7 +476,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -477,7 +476,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
static pool_type& static pool_type&
_S_get_pool() _S_get_pool()
{ {
using std::size_t;
// Sane defaults for the _PoolTp. // Sane defaults for the _PoolTp.
typedef typename pool_type::_Block_record _Block_record; typedef typename pool_type::_Block_record _Block_record;
const static size_t __a = (__alignof__(_Tp) >= sizeof(_Block_record) const static size_t __a = (__alignof__(_Tp) >= sizeof(_Block_record)
...@@ -570,8 +570,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -570,8 +570,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
class __mt_alloc_base class __mt_alloc_base
{ {
public: public:
typedef size_t size_type; typedef std::size_t size_type;
typedef ptrdiff_t difference_type; typedef std::ptrdiff_t difference_type;
typedef _Tp* pointer; typedef _Tp* pointer;
typedef const _Tp* const_pointer; typedef const _Tp* const_pointer;
typedef _Tp& reference; typedef _Tp& reference;
...@@ -594,7 +594,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -594,7 +594,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
size_type size_type
max_size() const _GLIBCXX_USE_NOEXCEPT max_size() const _GLIBCXX_USE_NOEXCEPT
{ return size_t(-1) / sizeof(_Tp); } { return size_type(-1) / sizeof(_Tp); }
#if __cplusplus >= 201103L #if __cplusplus >= 201103L
template<typename _Up, typename... _Args> template<typename _Up, typename... _Args>
...@@ -639,8 +639,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -639,8 +639,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
class __mt_alloc : public __mt_alloc_base<_Tp> class __mt_alloc : public __mt_alloc_base<_Tp>
{ {
public: public:
typedef size_t size_type; typedef std::size_t size_type;
typedef ptrdiff_t difference_type; typedef std::ptrdiff_t difference_type;
typedef _Tp* pointer; typedef _Tp* pointer;
typedef const _Tp* const_pointer; typedef const _Tp* const_pointer;
typedef _Tp& reference; typedef _Tp& reference;
...@@ -705,7 +705,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -705,7 +705,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// Requests larger than _M_max_bytes are handled by operator // Requests larger than _M_max_bytes are handled by operator
// new/delete directly. // new/delete directly.
__pool_type& __pool = __policy_type::_S_get_pool(); __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)) if (__pool._M_check_threshold(__bytes))
{ {
void* __ret = ::operator new(__bytes); void* __ret = ::operator new(__bytes);
...@@ -713,8 +713,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -713,8 +713,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
} }
// Round up to power of 2 and figure out which bin to use. // Round up to power of 2 and figure out which bin to use.
const size_t __which = __pool._M_get_binmap(__bytes); const size_type __which = __pool._M_get_binmap(__bytes);
const size_t __thread_id = __pool._M_get_thread_id(); const size_type __thread_id = __pool._M_get_thread_id();
// Find out if we have blocks on our freelist. If so, go ahead // Find out if we have blocks on our freelist. If so, go ahead
// and use them directly without having to lock anything. // and use them directly without having to lock anything.
...@@ -758,7 +758,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -758,7 +758,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// Requests larger than _M_max_bytes are handled by // Requests larger than _M_max_bytes are handled by
// operators new/delete directly. // operators new/delete directly.
__pool_type& __pool = __policy_type::_S_get_pool(); __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)) if (__pool._M_check_threshold(__bytes))
::operator delete(__p); ::operator delete(__p);
else else
......
...@@ -41,9 +41,6 @@ namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) ...@@ -41,9 +41,6 @@ namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
{ {
_GLIBCXX_BEGIN_NAMESPACE_VERSION _GLIBCXX_BEGIN_NAMESPACE_VERSION
using std::size_t;
using std::ptrdiff_t;
/** /**
* @brief An allocator that uses global new, as per [20.4]. * @brief An allocator that uses global new, as per [20.4].
* @ingroup allocators * @ingroup allocators
...@@ -58,8 +55,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -58,8 +55,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
class new_allocator class new_allocator
{ {
public: public:
typedef size_t size_type; typedef std::size_t size_type;
typedef ptrdiff_t difference_type; typedef std::ptrdiff_t difference_type;
typedef _Tp* pointer; typedef _Tp* pointer;
typedef const _Tp* const_pointer; typedef const _Tp* const_pointer;
typedef _Tp& reference; typedef _Tp& reference;
...@@ -140,9 +137,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -140,9 +137,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
max_size() const _GLIBCXX_USE_NOEXCEPT max_size() const _GLIBCXX_USE_NOEXCEPT
{ {
#if __PTRDIFF_MAX__ < __SIZE_MAX__ #if __PTRDIFF_MAX__ < __SIZE_MAX__
return size_t(__PTRDIFF_MAX__) / sizeof(_Tp); return std::size_t(__PTRDIFF_MAX__) / sizeof(_Tp);
#else #else
return size_t(-1) / sizeof(_Tp); return std::size_t(-1) / sizeof(_Tp);
#endif #endif
} }
......
...@@ -131,7 +131,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -131,7 +131,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* @ingroup SGIextensions * @ingroup SGIextensions
* @doctodo * @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> template<typename _ForwardIter, typename _Tp>
void void
iota(_ForwardIter __first, _ForwardIter __last, _Tp __value) iota(_ForwardIter __first, _ForwardIter __last, _Tp __value)
......
...@@ -57,9 +57,6 @@ namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) ...@@ -57,9 +57,6 @@ namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
{ {
_GLIBCXX_BEGIN_NAMESPACE_VERSION _GLIBCXX_BEGIN_NAMESPACE_VERSION
using std::size_t;
using std::ptrdiff_t;
/** /**
* @brief Base class for __pool_alloc. * @brief Base class for __pool_alloc.
* *
...@@ -77,6 +74,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -77,6 +74,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
*/ */
class __pool_alloc_base class __pool_alloc_base
{ {
typedef std::size_t size_t;
protected: protected:
enum { _S_align = 8 }; enum { _S_align = 8 };
...@@ -129,8 +127,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -129,8 +127,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
static _Atomic_word _S_force_new; static _Atomic_word _S_force_new;
public: public:
typedef size_t size_type; typedef std::size_t size_type;
typedef ptrdiff_t difference_type; typedef std::ptrdiff_t difference_type;
typedef _Tp* pointer; typedef _Tp* pointer;
typedef const _Tp* const_pointer; typedef const _Tp* const_pointer;
typedef _Tp& reference; typedef _Tp& reference;
...@@ -166,7 +164,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -166,7 +164,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
size_type size_type
max_size() const _GLIBCXX_USE_NOEXCEPT max_size() const _GLIBCXX_USE_NOEXCEPT
{ return size_t(-1) / sizeof(_Tp); } { return std::size_t(-1) / sizeof(_Tp); }
#if __cplusplus >= 201103L #if __cplusplus >= 201103L
template<typename _Up, typename... _Args> template<typename _Up, typename... _Args>
...@@ -213,6 +211,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -213,6 +211,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_GLIBCXX_NODISCARD _Tp* _GLIBCXX_NODISCARD _Tp*
__pool_alloc<_Tp>::allocate(size_type __n, const void*) __pool_alloc<_Tp>::allocate(size_type __n, const void*)
{ {
using std::size_t;
pointer __ret = 0; pointer __ret = 0;
if (__builtin_expect(__n != 0, true)) if (__builtin_expect(__n != 0, true))
{ {
...@@ -266,6 +265,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -266,6 +265,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
void void
__pool_alloc<_Tp>::deallocate(pointer __p, size_type __n) __pool_alloc<_Tp>::deallocate(pointer __p, size_type __n)
{ {
using std::size_t;
if (__builtin_expect(__n != 0 && __p != 0, true)) if (__builtin_expect(__n != 0 && __p != 0, true))
{ {
#if __cpp_aligned_new #if __cpp_aligned_new
......
...@@ -64,9 +64,6 @@ namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) ...@@ -64,9 +64,6 @@ namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
{ {
_GLIBCXX_BEGIN_NAMESPACE_VERSION _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 // Class rb_tree is not part of the C++ standard. It is provided for
// compatibility with the HP STL. // compatibility with the HP STL.
...@@ -76,11 +73,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -76,11 +73,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* @doctodo * @doctodo
*/ */
template <class _Key, class _Value, class _KeyOfValue, class _Compare, template <class _Key, class _Value, class _KeyOfValue, class _Compare,
class _Alloc = allocator<_Value> > class _Alloc = std::allocator<_Value> >
struct rb_tree 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; typedef typename _Base::allocator_type allocator_type;
rb_tree(const _Compare& __comp = _Compare(), rb_tree(const _Compare& __comp = _Compare(),
......
...@@ -73,11 +73,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -73,11 +73,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
enum _Tag {_S_leaf, _S_concat, _S_substringfn, _S_function}; enum _Tag {_S_leaf, _S_concat, _S_substringfn, _S_function};
} // namespace __detail } // namespace __detail
using std::size_t;
using std::ptrdiff_t;
using std::allocator;
using std::_Destroy;
// See libstdc++/36832. // See libstdc++/36832.
template<typename _ForwardIterator, typename _Allocator> template<typename _ForwardIterator, typename _Allocator>
void void
...@@ -91,8 +86,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -91,8 +86,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _ForwardIterator, typename _Tp> template<typename _ForwardIterator, typename _Tp>
inline void inline void
_Destroy_const(_ForwardIterator __first, _Destroy_const(_ForwardIterator __first,
_ForwardIterator __last, allocator<_Tp>) _ForwardIterator __last, std::allocator<_Tp>)
{ _Destroy(__first, __last); } { std::_Destroy(__first, __last); }
// The _S_eos function is used for those functions that // The _S_eos function is used for those functions that
// convert to/from C-like strings to detect the end of the string. // convert to/from C-like strings to detect the end of the string.
...@@ -153,7 +148,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -153,7 +148,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
virtual ~char_producer() { } virtual ~char_producer() { }
virtual void virtual void
operator()(size_t __start_pos, size_t __len, operator()(std::size_t __start_pos, std::size_t __len,
_CharT* __buffer) = 0; _CharT* __buffer) = 0;
// Buffer should really be an arbitrary output iterator. // Buffer should really be an arbitrary output iterator.
// That way we could flatten directly into an ostream, etc. // That way we could flatten directly into an ostream, etc.
...@@ -175,7 +170,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -175,7 +170,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// behave a little like basic_ostringstream<sequence::value_type> and a // behave a little like basic_ostringstream<sequence::value_type> and a
// little like containers. // little like containers.
template<class _Sequence, size_t _Buf_sz = 100> template<class _Sequence, std::size_t _Buf_sz = 100>
class sequence_buffer class sequence_buffer
: public std::iterator<std::output_iterator_tag, void, void, void, void> : public std::iterator<std::output_iterator_tag, void, void, void, void>
{ {
...@@ -184,7 +179,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -184,7 +179,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
protected: protected:
_Sequence* _M_prefix; _Sequence* _M_prefix;
value_type _M_buffer[_Buf_sz]; value_type _M_buffer[_Buf_sz];
size_t _M_buf_count; std::size_t _M_buf_count;
public: public:
void void
...@@ -252,12 +247,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -252,12 +247,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
} }
void void
append(value_type* __s, size_t __len) append(value_type* __s, std::size_t __len)
{ {
if (__len + _M_buf_count <= _Buf_sz) if (__len + _M_buf_count <= _Buf_sz)
{ {
size_t __i = _M_buf_count; std::size_t __i = _M_buf_count;
for (size_t __j = 0; __j < __len; __i++, __j++) for (std::size_t __j = 0; __j < __len; __i++, __j++)
_M_buffer[__i] = __s[__j]; _M_buffer[__i] = __s[__j];
_M_buf_count += __len; _M_buf_count += __len;
} }
...@@ -271,7 +266,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -271,7 +266,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
} }
sequence_buffer& sequence_buffer&
write(value_type* __s, size_t __len) write(value_type* __s, std::size_t __len)
{ {
append(__s, __len); append(__s, __len);
return *this; return *this;
...@@ -317,13 +312,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -317,13 +312,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
virtual ~_Rope_char_consumer() { } virtual ~_Rope_char_consumer() { }
virtual bool 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 // First a lot of forward declarations. The standard seems to require
// much stricter "declaration before use" than many of the implementations // much stricter "declaration before use" than many of the implementations
// that preceded it. // that preceded it.
template<class _CharT, class _Alloc = allocator<_CharT> > template<class _CharT, class _Alloc = std::allocator<_CharT> >
class rope; class rope;
template<class _CharT, class _Alloc> template<class _CharT, class _Alloc>
...@@ -358,16 +353,16 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -358,16 +353,16 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<class _CharT, class _Alloc> template<class _CharT, class _Alloc>
_Rope_const_iterator<_CharT, _Alloc> _Rope_const_iterator<_CharT, _Alloc>
operator-(const _Rope_const_iterator<_CharT, _Alloc>& __x, operator-(const _Rope_const_iterator<_CharT, _Alloc>& __x,
ptrdiff_t __n); std::ptrdiff_t __n);
template<class _CharT, class _Alloc> template<class _CharT, class _Alloc>
_Rope_const_iterator<_CharT, _Alloc> _Rope_const_iterator<_CharT, _Alloc>
operator+(const _Rope_const_iterator<_CharT, _Alloc>& __x, operator+(const _Rope_const_iterator<_CharT, _Alloc>& __x,
ptrdiff_t __n); std::ptrdiff_t __n);
template<class _CharT, class _Alloc> template<class _CharT, class _Alloc>
_Rope_const_iterator<_CharT, _Alloc> _Rope_const_iterator<_CharT, _Alloc>
operator+(ptrdiff_t __n, operator+(std::ptrdiff_t __n,
const _Rope_const_iterator<_CharT, _Alloc>& __x); const _Rope_const_iterator<_CharT, _Alloc>& __x);
template<class _CharT, class _Alloc> template<class _CharT, class _Alloc>
...@@ -381,21 +376,21 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -381,21 +376,21 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
const _Rope_const_iterator<_CharT, _Alloc>& __y); const _Rope_const_iterator<_CharT, _Alloc>& __y);
template<class _CharT, class _Alloc> template<class _CharT, class _Alloc>
ptrdiff_t std::ptrdiff_t
operator-(const _Rope_const_iterator<_CharT, _Alloc>& __x, operator-(const _Rope_const_iterator<_CharT, _Alloc>& __x,
const _Rope_const_iterator<_CharT, _Alloc>& __y); const _Rope_const_iterator<_CharT, _Alloc>& __y);
template<class _CharT, class _Alloc> template<class _CharT, class _Alloc>
_Rope_iterator<_CharT, _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> template<class _CharT, class _Alloc>
_Rope_iterator<_CharT, _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> template<class _CharT, class _Alloc>
_Rope_iterator<_CharT, _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> template<class _CharT, class _Alloc>
bool bool
...@@ -408,7 +403,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -408,7 +403,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
const _Rope_iterator<_CharT, _Alloc>& __y); const _Rope_iterator<_CharT, _Alloc>& __y);
template<class _CharT, class _Alloc> template<class _CharT, class _Alloc>
ptrdiff_t std::ptrdiff_t
operator-(const _Rope_iterator<_CharT, _Alloc>& __x, operator-(const _Rope_iterator<_CharT, _Alloc>& __x,
const _Rope_iterator<_CharT, _Alloc>& __y); const _Rope_iterator<_CharT, _Alloc>& __y);
...@@ -453,7 +448,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -453,7 +448,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
struct _Refcount_Base struct _Refcount_Base
{ {
// The type _RC_t // The type _RC_t
typedef size_t _RC_t; typedef std::size_t _RC_t;
// The data member _M_ref_count // The data member _M_ref_count
volatile _RC_t _M_ref_count; volatile _RC_t _M_ref_count;
...@@ -548,6 +543,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -548,6 +543,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
struct _Rope_rep_base struct _Rope_rep_base
: public _Alloc : public _Alloc
{ {
typedef std::size_t size_type;
typedef _Alloc allocator_type; typedef _Alloc allocator_type;
allocator_type allocator_type
...@@ -562,17 +558,17 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -562,17 +558,17 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_M_get_allocator() const _M_get_allocator() const
{ return *static_cast<const _Alloc*>(this); } { 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) { } : _M_size(__size) { }
size_t _M_size; size_type _M_size;
# define __ROPE_DEFINE_ALLOC(_Tp, __name) \ # define __ROPE_DEFINE_ALLOC(_Tp, __name) \
typedef typename \ typedef typename \
_Alloc::template rebind<_Tp>::other __name##Alloc; \ _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); } \ { 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); } { __name##Alloc().deallocate(__p, __n); }
__ROPE_DEFINE_ALLOCS(_Alloc) __ROPE_DEFINE_ALLOCS(_Alloc)
# undef __ROPE_DEFINE_ALLOC # undef __ROPE_DEFINE_ALLOC
...@@ -603,11 +599,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -603,11 +599,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
/* the same memory as the data field. */ /* the same memory as the data field. */
typedef typename _Rope_rep_base<_CharT, _Alloc>::allocator_type typedef typename _Rope_rep_base<_CharT, _Alloc>::allocator_type
allocator_type; allocator_type;
typedef std::size_t size_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; 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) const allocator_type& __a)
: _Rope_rep_base<_CharT, _Alloc>(__size, __a), : _Rope_rep_base<_CharT, _Alloc>(__size, __a),
#ifndef __GC #ifndef __GC
...@@ -626,7 +623,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -626,7 +623,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_M_incr () { } _M_incr () { }
#endif #endif
static void static void
_S_free_string(__GC_CONST _CharT*, size_t __len, _S_free_string(__GC_CONST _CharT*, size_type __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.
...@@ -688,6 +685,7 @@ protected: ...@@ -688,6 +685,7 @@ protected:
struct _Rope_RopeLeaf struct _Rope_RopeLeaf
: public _Rope_RopeRep<_CharT, _Alloc> : public _Rope_RopeRep<_CharT, _Alloc>
{ {
typedef std::size_t size_type;
public: public:
// Apparently needed by VC++ // Apparently needed by VC++
// The data fields of leaves are allocated with some // The data fields of leaves are allocated with some
...@@ -695,10 +693,10 @@ protected: ...@@ -695,10 +693,10 @@ protected:
// character types, to hold a trailing eos character. // character types, to hold a trailing eos character.
enum { _S_alloc_granularity = 8 }; enum { _S_alloc_granularity = 8 };
static size_t static size_type
_S_rounded_up_size(size_t __n) _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)) if (_S_is_basic_char_type((_CharT*)0))
__size_with_eos = __n + 1; __size_with_eos = __n + 1;
...@@ -708,8 +706,8 @@ protected: ...@@ -708,8 +706,8 @@ protected:
return __size_with_eos; return __size_with_eos;
#else #else
// Allow slop for in-place expansion. // Allow slop for in-place expansion.
return ((__size_with_eos + size_t(_S_alloc_granularity) - 1) return ((__size_with_eos + size_type(_S_alloc_granularity) - 1)
&~ (size_t(_S_alloc_granularity) - 1)); &~ (size_type(_S_alloc_granularity) - 1));
#endif #endif
} }
__GC_CONST _CharT* _M_data; /* Not necessarily 0 terminated. */ __GC_CONST _CharT* _M_data; /* Not necessarily 0 terminated. */
...@@ -720,7 +718,7 @@ protected: ...@@ -720,7 +718,7 @@ protected:
typedef typename _Rope_rep_base<_CharT,_Alloc>::allocator_type typedef typename _Rope_rep_base<_CharT,_Alloc>::allocator_type
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) 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)
...@@ -810,7 +808,7 @@ protected: ...@@ -810,7 +808,7 @@ protected:
typedef typename _Rope_rep_base<_CharT, _Alloc>::allocator_type typedef typename _Rope_rep_base<_CharT, _Alloc>::allocator_type
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) 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)
...@@ -852,13 +850,14 @@ protected: ...@@ -852,13 +850,14 @@ protected:
: public _Rope_RopeFunction<_CharT, _Alloc>, : public _Rope_RopeFunction<_CharT, _Alloc>,
public char_producer<_CharT> public char_producer<_CharT>
{ {
typedef std::size_t size_type;
public: public:
// XXX this whole class should be rewritten. // XXX this whole class should be rewritten.
_Rope_RopeRep<_CharT,_Alloc>* _M_base; // not 0 _Rope_RopeRep<_CharT,_Alloc>* _M_base; // not 0
size_t _M_start; size_type _M_start;
virtual void virtual void
operator()(size_t __start_pos, size_t __req_len, operator()(size_type __start_pos, size_type __req_len,
_CharT* __buffer) _CharT* __buffer)
{ {
switch(_M_base->_M_tag) switch(_M_base->_M_tag)
...@@ -887,8 +886,8 @@ protected: ...@@ -887,8 +886,8 @@ protected:
typedef typename _Rope_rep_base<_CharT, _Alloc>::allocator_type typedef typename _Rope_rep_base<_CharT, _Alloc>::allocator_type
allocator_type; allocator_type;
_Rope_RopeSubstring(_Rope_RopeRep<_CharT, _Alloc>* __b, size_t __s, _Rope_RopeSubstring(_Rope_RopeRep<_CharT, _Alloc>* __b, size_type __s,
size_t __l, const allocator_type& __a) size_type __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)
{ {
...@@ -966,12 +965,12 @@ protected: ...@@ -966,12 +965,12 @@ protected:
#endif #endif
typedef _Rope_RopeRep<_CharT, _Alloc> _RopeRep; typedef _Rope_RopeRep<_CharT, _Alloc> _RopeRep;
typedef rope<_CharT, _Alloc> _My_rope; typedef rope<_CharT, _Alloc> _My_rope;
size_t _M_pos; std::size_t _M_pos;
_CharT _M_current; _CharT _M_current;
bool _M_current_valid; bool _M_current_valid;
_My_rope* _M_root; // The whole rope. _My_rope* _M_root; // The whole rope.
public: 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) { } : _M_pos(__p), _M_current(), _M_current_valid(false), _M_root(__r) { }
_Rope_char_ref_proxy(const _Rope_char_ref_proxy& __x) _Rope_char_ref_proxy(const _Rope_char_ref_proxy& __x)
...@@ -982,7 +981,7 @@ protected: ...@@ -982,7 +981,7 @@ protected:
// expression. We claim that's not possible without calling // expression. We claim that's not possible without calling
// a copy constructor or generating reference to a proxy // a copy constructor or generating reference to a proxy
// reference. We declare the latter to have undefined semantics. // 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) { } : _M_pos(__p), _M_current(__c), _M_current_valid(true), _M_root(__r) { }
inline operator _CharT () const; inline operator _CharT () const;
...@@ -1012,7 +1011,7 @@ protected: ...@@ -1012,7 +1011,7 @@ protected:
{ {
// XXX this class should be rewritten. // XXX this class should be rewritten.
friend class _Rope_char_ref_proxy<_CharT, _Alloc>; 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. rope<_CharT,_Alloc>* _M_root; // The whole rope.
public: public:
_Rope_char_ptr_proxy(const _Rope_char_ref_proxy<_CharT,_Alloc>& __x) _Rope_char_ptr_proxy(const _Rope_char_ref_proxy<_CharT,_Alloc>& __x)
...@@ -1064,9 +1063,9 @@ protected: ...@@ -1064,9 +1063,9 @@ protected:
protected: protected:
enum { _S_path_cache_len = 4 }; // Must be <= 9. enum { _S_path_cache_len = 4 }; // Must be <= 9.
enum { _S_iterator_buf_len = 15 }; enum { _S_iterator_buf_len = 15 };
size_t _M_current_pos; std::size_t _M_current_pos;
_RopeRep* _M_root; // The whole rope. _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; __GC_CONST _CharT* _M_buf_start;
// Buffer possibly // Buffer possibly
// containing current char. // containing current char.
...@@ -1107,13 +1106,13 @@ protected: ...@@ -1107,13 +1106,13 @@ protected:
// cache is valid for previous posn. // cache is valid for previous posn.
_Rope_iterator_base() { } _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) { } : _M_current_pos(__pos), _M_root(__root), _M_buf_ptr(0) { }
void _M_incr(size_t __n); void _M_incr(std::size_t __n);
void _M_decr(size_t __n); void _M_decr(std::size_t __n);
public: public:
size_t std::size_t
index() const index() const
{ return _M_current_pos; } { return _M_current_pos; }
...@@ -1141,7 +1140,7 @@ protected: ...@@ -1141,7 +1140,7 @@ protected:
protected: protected:
typedef _Rope_RopeRep<_CharT, _Alloc> _RopeRep; typedef _Rope_RopeRep<_CharT, _Alloc> _RopeRep;
// The one from the base class may not be directly visible. // 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), : _Rope_iterator_base<_CharT, _Alloc>(const_cast<_RopeRep*>(__root),
__pos) __pos)
// Only nonconst iterators modify root ref count // Only nonconst iterators modify root ref count
...@@ -1160,7 +1159,7 @@ protected: ...@@ -1160,7 +1159,7 @@ protected:
_Rope_const_iterator(const _Rope_iterator<_CharT,_Alloc>& __x); _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_iterator_base<_CharT,_Alloc>(__r._M_tree_ptr, __pos) { }
_Rope_const_iterator& _Rope_const_iterator&
...@@ -1209,7 +1208,7 @@ protected: ...@@ -1209,7 +1208,7 @@ protected:
} }
_Rope_const_iterator& _Rope_const_iterator&
operator+=(ptrdiff_t __n) operator+=(std::ptrdiff_t __n)
{ {
if (__n >= 0) if (__n >= 0)
this->_M_incr(__n); this->_M_incr(__n);
...@@ -1226,7 +1225,7 @@ protected: ...@@ -1226,7 +1225,7 @@ protected:
} }
_Rope_const_iterator& _Rope_const_iterator&
operator-=(ptrdiff_t __n) operator-=(std::ptrdiff_t __n)
{ {
if (__n >= 0) if (__n >= 0)
this->_M_decr(__n); this->_M_decr(__n);
...@@ -1238,7 +1237,7 @@ protected: ...@@ -1238,7 +1237,7 @@ protected:
_Rope_const_iterator _Rope_const_iterator
operator++(int) operator++(int)
{ {
size_t __old_pos = this->_M_current_pos; std::size_t __old_pos = this->_M_current_pos;
this->_M_incr(1); this->_M_incr(1);
return _Rope_const_iterator<_CharT,_Alloc>(this->_M_root, __old_pos); return _Rope_const_iterator<_CharT,_Alloc>(this->_M_root, __old_pos);
// This makes a subsequent dereference expensive. // This makes a subsequent dereference expensive.
...@@ -1249,7 +1248,7 @@ protected: ...@@ -1249,7 +1248,7 @@ protected:
_Rope_const_iterator _Rope_const_iterator
operator--(int) operator--(int)
{ {
size_t __old_pos = this->_M_current_pos; std::size_t __old_pos = this->_M_current_pos;
this->_M_decr(1); this->_M_decr(1);
return _Rope_const_iterator<_CharT,_Alloc>(this->_M_root, __old_pos); return _Rope_const_iterator<_CharT,_Alloc>(this->_M_root, __old_pos);
} }
...@@ -1257,20 +1256,20 @@ protected: ...@@ -1257,20 +1256,20 @@ protected:
template<class _CharT2, class _Alloc2> template<class _CharT2, class _Alloc2>
friend _Rope_const_iterator<_CharT2, _Alloc2> friend _Rope_const_iterator<_CharT2, _Alloc2>
operator-(const _Rope_const_iterator<_CharT2, _Alloc2>& __x, operator-(const _Rope_const_iterator<_CharT2, _Alloc2>& __x,
ptrdiff_t __n); std::ptrdiff_t __n);
template<class _CharT2, class _Alloc2> template<class _CharT2, class _Alloc2>
friend _Rope_const_iterator<_CharT2, _Alloc2> friend _Rope_const_iterator<_CharT2, _Alloc2>
operator+(const _Rope_const_iterator<_CharT2, _Alloc2>& __x, operator+(const _Rope_const_iterator<_CharT2, _Alloc2>& __x,
ptrdiff_t __n); std::ptrdiff_t __n);
template<class _CharT2, class _Alloc2> template<class _CharT2, class _Alloc2>
friend _Rope_const_iterator<_CharT2, _Alloc2> friend _Rope_const_iterator<_CharT2, _Alloc2>
operator+(ptrdiff_t __n, operator+(std::ptrdiff_t __n,
const _Rope_const_iterator<_CharT2, _Alloc2>& __x); const _Rope_const_iterator<_CharT2, _Alloc2>& __x);
reference reference
operator[](size_t __n) operator[](std::size_t __n)
{ return rope<_CharT, _Alloc>::_S_fetch(this->_M_root, { return rope<_CharT, _Alloc>::_S_fetch(this->_M_root,
this->_M_current_pos + __n); } this->_M_current_pos + __n); }
...@@ -1285,7 +1284,7 @@ protected: ...@@ -1285,7 +1284,7 @@ protected:
const _Rope_const_iterator<_CharT2, _Alloc2>& __y); const _Rope_const_iterator<_CharT2, _Alloc2>& __y);
template<class _CharT2, class _Alloc2> template<class _CharT2, class _Alloc2>
friend ptrdiff_t friend std::ptrdiff_t
operator-(const _Rope_const_iterator<_CharT2, _Alloc2>& __x, operator-(const _Rope_const_iterator<_CharT2, _Alloc2>& __x,
const _Rope_const_iterator<_CharT2, _Alloc2>& __y); const _Rope_const_iterator<_CharT2, _Alloc2>& __y);
}; };
...@@ -1305,7 +1304,7 @@ protected: ...@@ -1305,7 +1304,7 @@ protected:
// Root is included in the reference count. This is necessary // Root is included in the reference count. This is necessary
// so that we can detect changes reliably. Unfortunately, it // so that we can detect changes reliably. Unfortunately, it
// requires careful bookkeeping for the nonGC case. // 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), : _Rope_iterator_base<_CharT, _Alloc>(__r->_M_tree_ptr, __pos),
_M_root_rope(__r) _M_root_rope(__r)
{ _RopeRep::_S_ref(this->_M_root); { _RopeRep::_S_ref(this->_M_root);
...@@ -1334,7 +1333,7 @@ protected: ...@@ -1334,7 +1333,7 @@ protected:
_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() ~_Rope_iterator()
{ _RopeRep::_S_unref(this->_M_root); } { _RopeRep::_S_unref(this->_M_root); }
...@@ -1389,7 +1388,7 @@ protected: ...@@ -1389,7 +1388,7 @@ protected:
} }
_Rope_iterator& _Rope_iterator&
operator+=(ptrdiff_t __n) operator+=(std::ptrdiff_t __n)
{ {
if (__n >= 0) if (__n >= 0)
this->_M_incr(__n); this->_M_incr(__n);
...@@ -1406,7 +1405,7 @@ protected: ...@@ -1406,7 +1405,7 @@ protected:
} }
_Rope_iterator& _Rope_iterator&
operator-=(ptrdiff_t __n) operator-=(std::ptrdiff_t __n)
{ {
if (__n >= 0) if (__n >= 0)
this->_M_decr(__n); this->_M_decr(__n);
...@@ -1418,7 +1417,7 @@ protected: ...@@ -1418,7 +1417,7 @@ protected:
_Rope_iterator _Rope_iterator
operator++(int) operator++(int)
{ {
size_t __old_pos = this->_M_current_pos; std::size_t __old_pos = this->_M_current_pos;
this->_M_incr(1); this->_M_incr(1);
return _Rope_iterator<_CharT,_Alloc>(_M_root_rope, __old_pos); return _Rope_iterator<_CharT,_Alloc>(_M_root_rope, __old_pos);
} }
...@@ -1426,13 +1425,13 @@ protected: ...@@ -1426,13 +1425,13 @@ protected:
_Rope_iterator _Rope_iterator
operator--(int) operator--(int)
{ {
size_t __old_pos = this->_M_current_pos; std::size_t __old_pos = this->_M_current_pos;
this->_M_decr(1); this->_M_decr(1);
return _Rope_iterator<_CharT,_Alloc>(_M_root_rope, __old_pos); return _Rope_iterator<_CharT,_Alloc>(_M_root_rope, __old_pos);
} }
reference reference
operator[](ptrdiff_t __n) operator[](std::ptrdiff_t __n)
{ return _Rope_char_ref_proxy<_CharT, _Alloc>(_M_root_rope, { return _Rope_char_ref_proxy<_CharT, _Alloc>(_M_root_rope,
this->_M_current_pos this->_M_current_pos
+ __n); } + __n); }
...@@ -1448,21 +1447,24 @@ protected: ...@@ -1448,21 +1447,24 @@ protected:
const _Rope_iterator<_CharT2, _Alloc2>& __y); const _Rope_iterator<_CharT2, _Alloc2>& __y);
template<class _CharT2, class _Alloc2> template<class _CharT2, class _Alloc2>
friend ptrdiff_t friend std::ptrdiff_t
operator-(const _Rope_iterator<_CharT2, _Alloc2>& __x, operator-(const _Rope_iterator<_CharT2, _Alloc2>& __x,
const _Rope_iterator<_CharT2, _Alloc2>& __y); const _Rope_iterator<_CharT2, _Alloc2>& __y);
template<class _CharT2, class _Alloc2> template<class _CharT2, class _Alloc2>
friend _Rope_iterator<_CharT2, _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> template<class _CharT2, class _Alloc2>
friend _Rope_iterator<_CharT2, _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> template<class _CharT2, class _Alloc2>
friend _Rope_iterator<_CharT2, _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);
}; };
...@@ -1498,9 +1500,9 @@ protected: ...@@ -1498,9 +1500,9 @@ protected:
#define __ROPE_DEFINE_ALLOC(_Tp, __name) \ #define __ROPE_DEFINE_ALLOC(_Tp, __name) \
typedef typename \ typedef typename \
_Alloc::template rebind<_Tp>::other __name##Alloc; \ _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); } \ { 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); } { __name##Alloc().deallocate(__p, __n); }
__ROPE_DEFINE_ALLOCS(_Alloc) __ROPE_DEFINE_ALLOCS(_Alloc)
#undef __ROPE_DEFINE_ALLOC #undef __ROPE_DEFINE_ALLOC
...@@ -1522,8 +1524,8 @@ protected: ...@@ -1522,8 +1524,8 @@ protected:
{ {
public: public:
typedef _CharT value_type; typedef _CharT value_type;
typedef ptrdiff_t difference_type; typedef std::ptrdiff_t difference_type;
typedef size_t size_type; typedef std::size_t size_type;
typedef _CharT const_reference; typedef _CharT const_reference;
typedef const _CharT* const_pointer; typedef const _CharT* const_pointer;
typedef _Rope_iterator<_CharT, _Alloc> iterator; typedef _Rope_iterator<_CharT, _Alloc> iterator;
...@@ -1580,7 +1582,7 @@ protected: ...@@ -1580,7 +1582,7 @@ protected:
_S_apply_to_pieces(// should be template parameter _S_apply_to_pieces(// should be template parameter
_Rope_char_consumer<_CharT>& __c, _Rope_char_consumer<_CharT>& __c,
const _RopeRep* __r, const _RopeRep* __r,
size_t __begin, size_t __end); size_type __begin, size_type __end);
// begin and end are assumed to be in range. // begin and end are assumed to be in range.
#ifndef __GC #ifndef __GC
...@@ -1605,16 +1607,17 @@ protected: ...@@ -1605,16 +1607,17 @@ protected:
// _Result is counted in refcount. // _Result is counted in refcount.
static _RopeRep* _S_substring(_RopeRep* __base, 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, 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. // Concatenate rope and char ptr, copying __s.
// Should really take an arbitrary iterator. // Should really take an arbitrary iterator.
// Result is counted in refcount. // Result is counted in refcount.
static _RopeRep* _S_destr_concat_char_iter(_RopeRep* __r, static _RopeRep* _S_destr_concat_char_iter(_RopeRep* __r,
const _CharT* __iter, const _CharT* __iter,
size_t __slen) size_type __slen)
// As above, but one reference to __r is about to be // As above, but one reference to __r is about to be
// destroyed. Thus the pieces may be recycled if all // destroyed. Thus the pieces may be recycled if all
// relevant reference counts are 1. // relevant reference counts are 1.
...@@ -1631,18 +1634,18 @@ protected: ...@@ -1631,18 +1634,18 @@ protected:
public: public:
void 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 _Rope_char_consumer<_CharT>& __c) const
{ _S_apply_to_pieces(__c, this->_M_tree_ptr, __begin, __end); } { _S_apply_to_pieces(__c, this->_M_tree_ptr, __begin, __end); }
protected: protected:
static size_t static size_type
_S_rounded_up_size(size_t __n) _S_rounded_up_size(size_type __n)
{ return _RopeLeaf::_S_rounded_up_size(__n); } { return _RopeLeaf::_S_rounded_up_size(__n); }
static size_t static size_type
_S_allocated_capacity(size_t __n) _S_allocated_capacity(size_type __n)
{ {
if (_S_is_basic_char_type((_CharT*)0)) if (_S_is_basic_char_type((_CharT*)0))
return _S_rounded_up_size(__n) - 1; return _S_rounded_up_size(__n) - 1;
...@@ -1655,7 +1658,7 @@ protected: ...@@ -1655,7 +1658,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_type __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);
...@@ -1671,15 +1674,15 @@ protected: ...@@ -1671,15 +1674,15 @@ 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_type __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);
} }
static _RopeSubstring* static _RopeSubstring*
_S_new_RopeSubstring(_Rope_RopeRep<_CharT,_Alloc>* __b, size_t __s, _S_new_RopeSubstring(_Rope_RopeRep<_CharT,_Alloc>* __b, size_type __s,
size_t __l, allocator_type& __a) size_type __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);
...@@ -1687,7 +1690,7 @@ protected: ...@@ -1687,7 +1690,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_type __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)
{ {
...@@ -1718,20 +1721,20 @@ protected: ...@@ -1718,20 +1721,20 @@ protected:
// Concatenation helper functions // Concatenation helper functions
static _RopeLeaf* static _RopeLeaf*
_S_leaf_concat_char_iter(_RopeLeaf* __r, _S_leaf_concat_char_iter(_RopeLeaf* __r,
const _CharT* __iter, size_t __slen); const _CharT* __iter, size_type __slen);
// Concatenate by copying leaf. // Concatenate by copying leaf.
// should take an arbitrary iterator // should take an arbitrary iterator
// result has refcount 1. // result has refcount 1.
#ifndef __GC #ifndef __GC
static _RopeLeaf* static _RopeLeaf*
_S_destr_leaf_concat_char_iter(_RopeLeaf* __r, _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. // A version that potentially clobbers __r if __r->_M_ref_count == 1.
#endif #endif
private: private:
static size_t _S_char_ptr_len(const _CharT* __s); static size_type _S_char_ptr_len(const _CharT* __s);
// slightly generalized strlen // slightly generalized strlen
rope(_RopeRep* __t, const allocator_type& __a = allocator_type()) rope(_RopeRep* __t, const allocator_type& __a = allocator_type())
...@@ -1746,7 +1749,7 @@ protected: ...@@ -1746,7 +1749,7 @@ protected:
// Again, with explicit starting position and length. // Again, with explicit starting position and length.
// Assumes that buffer is uninitialized. // Assumes that buffer is uninitialized.
static _CharT* _S_flatten(_RopeRep* __r, static _CharT* _S_flatten(_RopeRep* __r,
size_t __start, size_t __len, size_type __start, size_type __len,
_CharT* __buffer); _CharT* __buffer);
static const unsigned long static const unsigned long
...@@ -1816,7 +1819,7 @@ protected: ...@@ -1816,7 +1819,7 @@ protected:
_M_get_allocator()); _M_get_allocator());
} }
rope(const _CharT* __s, size_t __len, rope(const _CharT* __s, size_type __len,
const allocator_type& __a = allocator_type()) const allocator_type& __a = allocator_type())
: _Base(__a) : _Base(__a)
{ {
...@@ -1865,14 +1868,14 @@ protected: ...@@ -1865,14 +1868,14 @@ protected:
} }
} }
rope(size_t __n, _CharT __c, rope(size_type __n, _CharT __c,
const allocator_type& __a = allocator_type()); const allocator_type& __a = allocator_type());
rope(const allocator_type& __a = allocator_type()) rope(const allocator_type& __a = allocator_type())
: _Base(0, __a) { } : _Base(0, __a) { }
// Construct a rope from a function that can compute its members // Construct a rope from a function that can compute its members
rope(char_producer<_CharT> *__fn, size_t __len, bool __delete_fn, rope(char_producer<_CharT> *__fn, size_type __len, bool __delete_fn,
const allocator_type& __a = allocator_type()) const allocator_type& __a = allocator_type())
: _Base(__a) : _Base(__a)
{ {
...@@ -1982,8 +1985,8 @@ protected: ...@@ -1982,8 +1985,8 @@ protected:
size_type size_type
copy(size_type __pos, size_type __n, _CharT* __buffer) const copy(size_type __pos, size_type __n, _CharT* __buffer) const
{ {
size_t __size = size(); size_type __size = size();
size_t __len = (__pos + __n > __size? __size - __pos : __n); size_type __len = (__pos + __n > __size? __size - __pos : __n);
_Destroy_const(__buffer, __buffer + __len, _M_get_allocator()); _Destroy_const(__buffer, __buffer + __len, _M_get_allocator());
_S_flatten(this->_M_tree_ptr, __pos, __len, __buffer); _S_flatten(this->_M_tree_ptr, __pos, __len, __buffer);
...@@ -2108,7 +2111,7 @@ protected: ...@@ -2108,7 +2111,7 @@ protected:
// argument should be an input iterator or forward iterator with // argument should be an input iterator or forward iterator with
// value_type _CharT. // value_type _CharT.
rope& rope&
append(const _CharT* __iter, size_t __n) append(const _CharT* __iter, size_type __n)
{ {
_RopeRep* __result = _RopeRep* __result =
_S_destr_concat_char_iter(this->_M_tree_ptr, __iter, __n); _S_destr_concat_char_iter(this->_M_tree_ptr, __iter, __n);
...@@ -2120,7 +2123,7 @@ protected: ...@@ -2120,7 +2123,7 @@ protected:
rope& rope&
append(const _CharT* __c_string) 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); append(__c_string, __len);
return(*this); return(*this);
} }
...@@ -2172,7 +2175,7 @@ protected: ...@@ -2172,7 +2175,7 @@ protected:
} }
rope& rope&
append(size_t __n, _CharT __c) append(size_type __n, _CharT __c)
{ {
rope<_CharT,_Alloc> __last(__n, __c); rope<_CharT,_Alloc> __last(__n, __c);
return append(__last); return append(__last);
...@@ -2189,8 +2192,8 @@ protected: ...@@ -2189,8 +2192,8 @@ protected:
protected: protected:
// Result is included in refcount. // Result is included in refcount.
static _RopeRep* static _RopeRep*
replace(_RopeRep* __old, size_t __pos1, replace(_RopeRep* __old, size_type __pos1,
size_t __pos2, _RopeRep* __r) size_type __pos2, _RopeRep* __r)
{ {
if (0 == __old) if (0 == __old)
{ {
...@@ -2213,7 +2216,7 @@ protected: ...@@ -2213,7 +2216,7 @@ protected:
public: public:
void void
insert(size_t __p, const rope& __r) insert(size_type __p, const rope& __r)
{ {
_RopeRep* __result = _RopeRep* __result =
replace(this->_M_tree_ptr, __p, __p, __r._M_tree_ptr); replace(this->_M_tree_ptr, __p, __p, __r._M_tree_ptr);
...@@ -2222,14 +2225,14 @@ protected: ...@@ -2222,14 +2225,14 @@ protected:
} }
void 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); rope<_CharT,_Alloc> __r(__n,__c);
insert(__p, __r); insert(__p, __r);
} }
void 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 __left(_S_substring(this->_M_tree_ptr, 0, __p));
_Self_destruct_ptr __right(_S_substring(this->_M_tree_ptr, _Self_destruct_ptr __right(_S_substring(this->_M_tree_ptr,
...@@ -2244,29 +2247,29 @@ protected: ...@@ -2244,29 +2247,29 @@ protected:
} }
void 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)); } { insert(__p, __c_string, _S_char_ptr_len(__c_string)); }
void void
insert(size_t __p, _CharT __c) insert(size_type __p, _CharT __c)
{ insert(__p, &__c, 1); } { insert(__p, &__c, 1); }
void void
insert(size_t __p) insert(size_type __p)
{ {
_CharT __c = _CharT(); _CharT __c = _CharT();
insert(__p, &__c, 1); insert(__p, &__c, 1);
} }
void 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); rope __r(__i, __j);
insert(__p, __r); insert(__p, __r);
} }
void void
insert(size_t __p, const const_iterator& __i, insert(size_type __p, const const_iterator& __i,
const const_iterator& __j) const const_iterator& __j)
{ {
rope __r(__i, __j); rope __r(__i, __j);
...@@ -2274,7 +2277,7 @@ protected: ...@@ -2274,7 +2277,7 @@ protected:
} }
void void
insert(size_t __p, const iterator& __i, insert(size_type __p, const iterator& __i,
const iterator& __j) const iterator& __j)
{ {
rope __r(__i, __j); rope __r(__i, __j);
...@@ -2284,7 +2287,7 @@ protected: ...@@ -2284,7 +2287,7 @@ protected:
// (position, length) versions of replace operations: // (position, length) versions of replace operations:
void void
replace(size_t __p, size_t __n, const rope& __r) replace(size_type __p, size_type __n, const rope& __r)
{ {
_RopeRep* __result = _RopeRep* __result =
replace(this->_M_tree_ptr, __p, __p + __n, __r._M_tree_ptr); replace(this->_M_tree_ptr, __p, __p + __n, __r._M_tree_ptr);
...@@ -2293,29 +2296,29 @@ protected: ...@@ -2293,29 +2296,29 @@ protected:
} }
void void
replace(size_t __p, size_t __n, replace(size_type __p, size_type __n,
const _CharT* __i, size_t __i_len) const _CharT* __i, size_type __i_len)
{ {
rope __r(__i, __i_len); rope __r(__i, __i_len);
replace(__p, __n, __r); replace(__p, __n, __r);
} }
void void
replace(size_t __p, size_t __n, _CharT __c) replace(size_type __p, size_type __n, _CharT __c)
{ {
rope __r(__c); rope __r(__c);
replace(__p, __n, __r); replace(__p, __n, __r);
} }
void 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); rope __r(__c_string);
replace(__p, __n, __r); replace(__p, __n, __r);
} }
void void
replace(size_t __p, size_t __n, replace(size_type __p, size_type __n,
const _CharT* __i, const _CharT* __j) const _CharT* __i, const _CharT* __j)
{ {
rope __r(__i, __j); rope __r(__i, __j);
...@@ -2323,7 +2326,7 @@ protected: ...@@ -2323,7 +2326,7 @@ protected:
} }
void void
replace(size_t __p, size_t __n, replace(size_type __p, size_type __n,
const const_iterator& __i, const const_iterator& __j) const const_iterator& __i, const const_iterator& __j)
{ {
rope __r(__i, __j); rope __r(__i, __j);
...@@ -2331,7 +2334,7 @@ protected: ...@@ -2331,7 +2334,7 @@ protected:
} }
void void
replace(size_t __p, size_t __n, replace(size_type __p, size_type __n,
const iterator& __i, const iterator& __j) const iterator& __i, const iterator& __j)
{ {
rope __r(__i, __j); rope __r(__i, __j);
...@@ -2340,41 +2343,41 @@ protected: ...@@ -2340,41 +2343,41 @@ protected:
// Single character variants: // Single character variants:
void void
replace(size_t __p, _CharT __c) replace(size_type __p, _CharT __c)
{ {
iterator __i(this, __p); iterator __i(this, __p);
*__i = __c; *__i = __c;
} }
void void
replace(size_t __p, const rope& __r) replace(size_type __p, const rope& __r)
{ replace(__p, 1, __r); } { replace(__p, 1, __r); }
void 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); } { replace(__p, 1, __i, __i_len); }
void void
replace(size_t __p, const _CharT* __c_string) replace(size_type __p, const _CharT* __c_string)
{ replace(__p, 1, __c_string); } { replace(__p, 1, __c_string); }
void 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); } { replace(__p, 1, __i, __j); }
void void
replace(size_t __p, const const_iterator& __i, replace(size_type __p, const const_iterator& __i,
const const_iterator& __j) const const_iterator& __j)
{ replace(__p, 1, __i, __j); } { replace(__p, 1, __i, __j); }
void void
replace(size_t __p, const iterator& __i, replace(size_type __p, const iterator& __i,
const iterator& __j) const iterator& __j)
{ replace(__p, 1, __i, __j); } { replace(__p, 1, __i, __j); }
// Erase, (position, size) variant. // Erase, (position, size) variant.
void void
erase(size_t __p, size_t __n) erase(size_type __p, size_type __n)
{ {
_RopeRep* __result = replace(this->_M_tree_ptr, __p, _RopeRep* __result = replace(this->_M_tree_ptr, __p,
__p + __n, 0); __p + __n, 0);
...@@ -2384,7 +2387,7 @@ protected: ...@@ -2384,7 +2387,7 @@ protected:
// Erase, single character // Erase, single character
void void
erase(size_t __p) erase(size_type __p)
{ erase(__p, __p + 1); } { erase(__p, __p + 1); }
// Insert, iterator variants. // Insert, iterator variants.
...@@ -2396,7 +2399,7 @@ protected: ...@@ -2396,7 +2399,7 @@ protected:
} }
iterator iterator
insert(const iterator& __p, size_t __n, _CharT __c) insert(const iterator& __p, size_type __n, _CharT __c)
{ {
insert(__p.index(), __n, __c); insert(__p.index(), __n, __c);
return __p; return __p;
...@@ -2423,7 +2426,7 @@ protected: ...@@ -2423,7 +2426,7 @@ protected:
} }
iterator 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); insert(__p.index(), __i, __n);
return __p; return __p;
...@@ -2469,7 +2472,7 @@ protected: ...@@ -2469,7 +2472,7 @@ protected:
void void
replace(const iterator& __p, const iterator& __q, 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); } { replace(__p.index(), __q.index() - __p.index(), __i, __n); }
void void
...@@ -2501,7 +2504,7 @@ protected: ...@@ -2501,7 +2504,7 @@ protected:
{ replace(__p.index(), __c_string); } { replace(__p.index(), __c_string); }
void 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); } { replace(__p.index(), __i, __n); }
void void
...@@ -2520,7 +2523,7 @@ protected: ...@@ -2520,7 +2523,7 @@ protected:
iterator iterator
erase(const iterator& __p, const iterator& __q) 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); erase(__p_index, __q.index() - __p_index);
return iterator(this, __p_index); return iterator(this, __p_index);
} }
...@@ -2528,13 +2531,13 @@ protected: ...@@ -2528,13 +2531,13 @@ protected:
iterator iterator
erase(const iterator& __p) erase(const iterator& __p)
{ {
size_t __p_index = __p.index(); size_type __p_index = __p.index();
erase(__p_index, 1); erase(__p_index, 1);
return iterator(this, __p_index); return iterator(this, __p_index);
} }
rope 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, return rope<_CharT, _Alloc>(_S_substring(this->_M_tree_ptr,
__start, __start,
...@@ -2552,7 +2555,7 @@ protected: ...@@ -2552,7 +2555,7 @@ protected:
rope rope
substr(iterator __start) const substr(iterator __start) const
{ {
size_t __pos = __start.index(); size_type __pos = __start.index();
return rope<_CharT, _Alloc>(_S_substring(this->_M_tree_ptr, return rope<_CharT, _Alloc>(_S_substring(this->_M_tree_ptr,
__pos, __pos + 1)); __pos, __pos + 1));
} }
...@@ -2570,7 +2573,7 @@ protected: ...@@ -2570,7 +2573,7 @@ protected:
rope<_CharT, _Alloc> rope<_CharT, _Alloc>
substr(const_iterator __start) substr(const_iterator __start)
{ {
size_t __pos = __start.index(); size_type __pos = __start.index();
return rope<_CharT, _Alloc>(_S_substring(this->_M_tree_ptr, return rope<_CharT, _Alloc>(_S_substring(this->_M_tree_ptr,
__pos, __pos + 1)); __pos, __pos + 1));
} }
...@@ -2718,26 +2721,32 @@ protected: ...@@ -2718,26 +2721,32 @@ protected:
{ return !(__x < __y); } { return !(__x < __y); }
template <class _CharT, class _Alloc> template <class _CharT, class _Alloc>
inline ptrdiff_t inline std::ptrdiff_t
operator-(const _Rope_const_iterator<_CharT, _Alloc>& __x, operator-(const _Rope_const_iterator<_CharT, _Alloc>& __x,
const _Rope_const_iterator<_CharT, _Alloc>& __y) 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> template <class _CharT, class _Alloc>
inline _Rope_const_iterator<_CharT, _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, { return _Rope_const_iterator<_CharT, _Alloc>(__x._M_root,
__x._M_current_pos - __n); } __x._M_current_pos - __n); }
template <class _CharT, class _Alloc> template <class _CharT, class _Alloc>
inline _Rope_const_iterator<_CharT, _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, { return _Rope_const_iterator<_CharT, _Alloc>(__x._M_root,
__x._M_current_pos + __n); } __x._M_current_pos + __n); }
template <class _CharT, class _Alloc> template <class _CharT, class _Alloc>
inline _Rope_const_iterator<_CharT, _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, { return _Rope_const_iterator<_CharT, _Alloc>(__x._M_root,
__x._M_current_pos + __n); } __x._M_current_pos + __n); }
...@@ -2779,28 +2788,28 @@ protected: ...@@ -2779,28 +2788,28 @@ protected:
{ return !(__x < __y); } { return !(__x < __y); }
template <class _CharT, class _Alloc> template <class _CharT, class _Alloc>
inline ptrdiff_t inline std::ptrdiff_t
operator-(const _Rope_iterator<_CharT, _Alloc>& __x, operator-(const _Rope_iterator<_CharT, _Alloc>& __x,
const _Rope_iterator<_CharT, _Alloc>& __y) const _Rope_iterator<_CharT, _Alloc>& __y)
{ return ((ptrdiff_t)__x._M_current_pos { return ((std::ptrdiff_t)__x._M_current_pos
- (ptrdiff_t)__y._M_current_pos); } - (std::ptrdiff_t)__y._M_current_pos); }
template <class _CharT, class _Alloc> template <class _CharT, class _Alloc>
inline _Rope_iterator<_CharT, _Alloc> inline _Rope_iterator<_CharT, _Alloc>
operator-(const _Rope_iterator<_CharT, _Alloc>& __x, operator-(const _Rope_iterator<_CharT, _Alloc>& __x,
ptrdiff_t __n) std::ptrdiff_t __n)
{ return _Rope_iterator<_CharT, _Alloc>(__x._M_root_rope, { return _Rope_iterator<_CharT, _Alloc>(__x._M_root_rope,
__x._M_current_pos - __n); } __x._M_current_pos - __n); }
template <class _CharT, class _Alloc> template <class _CharT, class _Alloc>
inline _Rope_iterator<_CharT, _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, { return _Rope_iterator<_CharT, _Alloc>(__x._M_root_rope,
__x._M_current_pos + __n); } __x._M_current_pos + __n); }
template <class _CharT, class _Alloc> template <class _CharT, class _Alloc>
inline _Rope_iterator<_CharT, _Alloc> inline _Rope_iterator<_CharT, _Alloc>
operator+(ptrdiff_t __n, const _Rope_iterator<_CharT, _Alloc>& __x) operator+(std::ptrdiff_t __n, const _Rope_iterator<_CharT, _Alloc>& __x)
{ return _Rope_iterator<_CharT, _Alloc>(__x._M_root_rope, { return _Rope_iterator<_CharT, _Alloc>(__x._M_root_rope,
__x._M_current_pos + __n); } __x._M_current_pos + __n); }
...@@ -2831,7 +2840,7 @@ protected: ...@@ -2831,7 +2840,7 @@ protected:
const _CharT* __right) const _CharT* __right)
{ {
typedef rope<_CharT, _Alloc> rope_type; 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, return rope_type(rope_type::_S_concat_char_iter(__left._M_tree_ptr,
__right, __rlen)); __right, __rlen));
} }
...@@ -2919,11 +2928,11 @@ protected: ...@@ -2919,11 +2928,11 @@ protected:
typedef rope<wchar_t> wrope; typedef rope<wchar_t> wrope;
inline crope::reference 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); } { return __c.mutable_reference_at(__i); }
inline wrope::reference 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); } { return __c.mutable_reference_at(__i); }
template <class _CharT, class _Alloc> template <class _CharT, class _Alloc>
......
...@@ -52,13 +52,6 @@ namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) ...@@ -52,13 +52,6 @@ namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
{ {
_GLIBCXX_BEGIN_NAMESPACE_VERSION _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 // 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. // 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 // Results in a valid buf_ptr if the iterator can be legitimately
...@@ -68,6 +61,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -68,6 +61,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_Rope_iterator_base<_CharT, _Alloc>:: _Rope_iterator_base<_CharT, _Alloc>::
_S_setbuf(_Rope_iterator_base<_CharT, _Alloc>& __x) _S_setbuf(_Rope_iterator_base<_CharT, _Alloc>& __x)
{ {
using std::size_t;
const _RopeRep* __leaf = __x._M_path_end[__x._M_leaf_index]; const _RopeRep* __leaf = __x._M_path_end[__x._M_leaf_index];
size_t __leaf_pos = __x._M_leaf_pos; size_t __leaf_pos = __x._M_leaf_pos;
size_t __pos = __x._M_current_pos; size_t __pos = __x._M_current_pos;
...@@ -113,6 +107,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -113,6 +107,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_Rope_iterator_base<_CharT, _Alloc>:: _Rope_iterator_base<_CharT, _Alloc>::
_S_setcache(_Rope_iterator_base<_CharT, _Alloc>& __x) _S_setcache(_Rope_iterator_base<_CharT, _Alloc>& __x)
{ {
using std::size_t;
const _RopeRep* __path[int(__detail::_S_max_rope_depth) + 1]; const _RopeRep* __path[int(__detail::_S_max_rope_depth) + 1];
const _RopeRep* __curr_rope; const _RopeRep* __curr_rope;
int __curr_depth = -1; /* index into path */ int __curr_depth = -1; /* index into path */
...@@ -190,6 +185,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -190,6 +185,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_Rope_iterator_base<_CharT, _Alloc>:: _Rope_iterator_base<_CharT, _Alloc>::
_S_setcache_for_incr(_Rope_iterator_base<_CharT, _Alloc>& __x) _S_setcache_for_incr(_Rope_iterator_base<_CharT, _Alloc>& __x)
{ {
using std::size_t;
int __current_index = __x._M_leaf_index; int __current_index = __x._M_leaf_index;
const _RopeRep* __current_node = __x._M_path_end[__current_index]; const _RopeRep* __current_node = __x._M_path_end[__current_index];
size_t __len = __current_node->_M_size; size_t __len = __current_node->_M_size;
...@@ -255,12 +251,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -255,12 +251,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template <class _CharT, class _Alloc> template <class _CharT, class _Alloc>
void void
_Rope_iterator_base<_CharT, _Alloc>:: _Rope_iterator_base<_CharT, _Alloc>::
_M_incr(size_t __n) _M_incr(std::size_t __n)
{ {
_M_current_pos += __n; _M_current_pos += __n;
if (0 != _M_buf_ptr) 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) if (__chars_left > __n)
_M_buf_ptr += __n; _M_buf_ptr += __n;
else if (__chars_left == __n) else if (__chars_left == __n)
...@@ -276,11 +272,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -276,11 +272,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template <class _CharT, class _Alloc> template <class _CharT, class _Alloc>
void void
_Rope_iterator_base<_CharT, _Alloc>:: _Rope_iterator_base<_CharT, _Alloc>::
_M_decr(size_t __n) _M_decr(std::size_t __n)
{ {
if (0 != _M_buf_ptr) 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) if (__chars_left >= __n)
_M_buf_ptr -= __n; _M_buf_ptr -= __n;
else else
...@@ -314,13 +310,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -314,13 +310,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template <class _CharT, class _Alloc> template <class _CharT, class _Alloc>
inline inline
_Rope_iterator<_CharT, _Alloc>:: _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), : _Rope_iterator_base<_CharT,_Alloc>(__r._M_tree_ptr, __pos),
_M_root_rope(&__r) _M_root_rope(&__r)
{ _RopeRep::_S_ref(this->_M_root); } { _RopeRep::_S_ref(this->_M_root); }
template <class _CharT, class _Alloc> template <class _CharT, class _Alloc>
inline size_t inline std::size_t
rope<_CharT, _Alloc>:: rope<_CharT, _Alloc>::
_S_char_ptr_len(const _CharT* __s) _S_char_ptr_len(const _CharT* __s)
{ {
...@@ -342,8 +338,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -342,8 +338,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_CharT* __cstr = _M_c_string; _CharT* __cstr = _M_c_string;
if (0 != __cstr) if (0 != __cstr)
{ {
size_t __size = this->_M_size + 1; std::size_t __size = this->_M_size + 1;
_Destroy(__cstr, __cstr + __size, _M_get_allocator()); std::_Destroy(__cstr, __cstr + __size, _M_get_allocator());
this->_Data_deallocate(__cstr, __size); this->_Data_deallocate(__cstr, __size);
} }
} }
...@@ -351,10 +347,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -351,10 +347,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
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, std::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); std::_Destroy(__s, __s + __n, __a);
// This has to be a static member, so this gets a bit messy // This has to be a static member, so this gets a bit messy
__a.deallocate(__s, __a.deallocate(__s,
...@@ -415,7 +411,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -415,7 +411,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
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(const _CharT*, size_t, allocator_type) _S_free_string(const _CharT*, std::size_t, allocator_type)
{ } { }
#endif #endif
...@@ -425,9 +421,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -425,9 +421,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template <class _CharT, class _Alloc> template <class _CharT, class _Alloc>
typename rope<_CharT, _Alloc>::_RopeLeaf* typename rope<_CharT, _Alloc>::_RopeLeaf*
rope<_CharT, _Alloc>:: 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*) _CharT* __new_data = (_CharT*)
rope::_Data_allocate(_S_rounded_up_size(__old_len + __len)); rope::_Data_allocate(_S_rounded_up_size(__old_len + __len));
_RopeLeaf* __result; _RopeLeaf* __result;
...@@ -455,11 +452,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -455,11 +452,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
typename rope<_CharT,_Alloc>::_RopeLeaf* typename rope<_CharT,_Alloc>::_RopeLeaf*
rope<_CharT, _Alloc>:: rope<_CharT, _Alloc>::
_S_destr_leaf_concat_char_iter(_RopeLeaf* __r, const _CharT* __iter, _S_destr_leaf_concat_char_iter(_RopeLeaf* __r, const _CharT* __iter,
size_t __len) std::size_t __len)
{ {
if (__r->_M_ref_count > 1) if (__r->_M_ref_count > 1)
return _S_leaf_concat_char_iter(__r, __iter, __len); 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) if (_S_allocated_capacity(__old_len) >= __old_len + __len)
{ {
// The space has been partially initialized for the standard // The space has been partially initialized for the standard
...@@ -492,6 +489,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -492,6 +489,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
rope<_CharT, _Alloc>:: rope<_CharT, _Alloc>::
_S_tree_concat(_RopeRep* __left, _RopeRep* __right) _S_tree_concat(_RopeRep* __left, _RopeRep* __right)
{ {
using std::size_t;
_RopeConcatenation* __result = _S_new_RopeConcatenation(__left, __right, _RopeConcatenation* __result = _S_new_RopeConcatenation(__left, __right,
__left-> __left->
_M_get_allocator()); _M_get_allocator());
...@@ -526,8 +524,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -526,8 +524,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template <class _CharT, class _Alloc> template <class _CharT, class _Alloc>
typename rope<_CharT, _Alloc>::_RopeRep* typename rope<_CharT, _Alloc>::_RopeRep*
rope<_CharT, _Alloc>:: 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; _RopeRep* __result;
if (0 == __slen) if (0 == __slen)
{ {
...@@ -585,8 +584,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -585,8 +584,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template <class _CharT, class _Alloc> template <class _CharT, class _Alloc>
typename rope<_CharT,_Alloc>::_RopeRep* typename rope<_CharT,_Alloc>::_RopeRep*
rope<_CharT,_Alloc>:: 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; _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,
...@@ -651,6 +652,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -651,6 +652,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
rope<_CharT, _Alloc>:: rope<_CharT, _Alloc>::
_S_concat(_RopeRep* __left, _RopeRep* __right) _S_concat(_RopeRep* __left, _RopeRep* __right)
{ {
using std::size_t;
if (0 == __left) if (0 == __left)
{ {
_S_ref(__right); _S_ref(__right);
...@@ -712,8 +714,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -712,8 +714,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template <class _CharT, class _Alloc> template <class _CharT, class _Alloc>
typename rope<_CharT, _Alloc>::_RopeRep* typename rope<_CharT, _Alloc>::_RopeRep*
rope<_CharT, _Alloc>:: 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) if (0 == __base)
return 0; return 0;
size_t __len = __base->_M_size; size_t __len = __base->_M_size;
...@@ -849,7 +852,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -849,7 +852,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
~_Rope_flatten_char_consumer() {} ~_Rope_flatten_char_consumer() {}
bool bool
operator()(const _CharT* __leaf, size_t __n) operator()(const _CharT* __leaf, std::size_t __n)
{ {
uninitialized_copy_n(__leaf, __n, _M_buf_ptr); uninitialized_copy_n(__leaf, __n, _M_buf_ptr);
_M_buf_ptr += __n; _M_buf_ptr += __n;
...@@ -864,7 +867,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -864,7 +867,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
private: private:
_CharT _M_pattern; _CharT _M_pattern;
public: 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) _Rope_find_char_char_consumer(_CharT __p)
: _M_pattern(__p), _M_count(0) {} : _M_pattern(__p), _M_count(0) {}
...@@ -872,9 +875,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -872,9 +875,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
~_Rope_find_char_char_consumer() {} ~_Rope_find_char_char_consumer() {}
bool 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++) for (__i = 0; __i < __n; __i++)
{ {
if (__leaf[__i] == _M_pattern) if (__leaf[__i] == _M_pattern)
...@@ -893,23 +896,23 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -893,23 +896,23 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
: public _Rope_char_consumer<_CharT> : public _Rope_char_consumer<_CharT>
{ {
private: private:
typedef basic_ostream<_CharT,_Traits> _Insert_ostream; typedef std::basic_ostream<_CharT,_Traits> _Insert_ostream;
_Insert_ostream& _M_o; _Insert_ostream& _M_o;
public: public:
_Rope_insert_char_consumer(_Insert_ostream& __writer) _Rope_insert_char_consumer(_Insert_ostream& __writer)
: _M_o(__writer) {} : _M_o(__writer) {}
~_Rope_insert_char_consumer() { } ~_Rope_insert_char_consumer() { }
// Caller is presumed to own the ostream // 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. // Returns true to continue traversal.
}; };
template<class _CharT, class _Traits> template<class _CharT, class _Traits>
bool bool
_Rope_insert_char_consumer<_CharT, _Traits>:: _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. // We assume that formatting is set up correctly for each element.
for (__i = 0; __i < __n; __i++) for (__i = 0; __i < __n; __i++)
_M_o.put(__leaf[__i]); _M_o.put(__leaf[__i]);
...@@ -919,9 +922,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -919,9 +922,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template <class _CharT, class _Alloc> template <class _CharT, class _Alloc>
bool bool
rope<_CharT, _Alloc>:: rope<_CharT, _Alloc>::
_S_apply_to_pieces(_Rope_char_consumer<_CharT>& __c, _S_apply_to_pieces(_Rope_char_consumer<_CharT>& __c, const _RopeRep* __r,
const _RopeRep* __r, size_t __begin, size_t __end) std::size_t __begin, std::size_t __end)
{ {
using std::size_t;
if (0 == __r) if (0 == __r)
return true; return true;
switch(__r->_M_tag) switch(__r->_M_tag)
...@@ -981,10 +985,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -981,10 +985,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<class _CharT, class _Traits> template<class _CharT, class _Traits>
inline void 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(); char __f = __o.fill();
size_t __i; std::size_t __i;
for (__i = 0; __i < __n; __i++) for (__i = 0; __i < __n; __i++)
__o.put(__f); __o.put(__f);
...@@ -1005,10 +1009,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -1005,10 +1009,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ return true; } { return true; }
template<class _CharT, class _Traits, class _Alloc> template<class _CharT, class _Traits, class _Alloc>
basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __o, operator<<(std::basic_ostream<_CharT, _Traits>& __o,
const rope<_CharT, _Alloc>& __r) const rope<_CharT, _Alloc>& __r)
{ {
using std::size_t;
size_t __w = __o.width(); size_t __w = __o.width();
bool __left = bool(__o.flags() & std::ios::left); bool __left = bool(__o.flags() & std::ios::left);
size_t __pad_len; size_t __pad_len;
...@@ -1045,7 +1050,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -1045,7 +1050,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template <class _CharT, class _Alloc> template <class _CharT, class _Alloc>
_CharT* _CharT*
rope<_CharT, _Alloc>:: 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) _CharT* __buffer)
{ {
_Rope_flatten_char_consumer<_CharT> __c(__buffer); _Rope_flatten_char_consumer<_CharT> __c(__buffer);
...@@ -1054,9 +1059,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -1054,9 +1059,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
} }
template <class _CharT, class _Alloc> template <class _CharT, class _Alloc>
size_t std::size_t
rope<_CharT, _Alloc>:: 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); _Rope_find_char_char_consumer<_CharT> __c(__pattern);
_S_apply_to_pieces(__c, this->_M_tree_ptr, __start, size()); _S_apply_to_pieces(__c, this->_M_tree_ptr, __start, size());
...@@ -1110,6 +1115,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -1110,6 +1115,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
rope<_CharT, _Alloc>:: rope<_CharT, _Alloc>::
_S_dump(_RopeRep* __r, int __indent) _S_dump(_RopeRep* __r, int __indent)
{ {
using std::printf;
for (int __i = 0; __i < __indent; __i++) for (int __i = 0; __i < __indent; __i++)
putchar(' '); putchar(' ');
if (0 == __r) if (0 == __r)
...@@ -1236,7 +1242,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -1236,7 +1242,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
} }
if (__result->_M_depth > int(__detail::_S_max_rope_depth)) 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); return(__result);
} }
...@@ -1268,7 +1274,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -1268,7 +1274,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_RopeRep* __insertee; // included in refcount _RopeRep* __insertee; // included in refcount
_RopeRep* __too_tiny = 0; // included in refcount _RopeRep* __too_tiny = 0; // included in refcount
int __i; // forest[0..__i-1] is empty 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) for (__i = 0; __s >= _S_min_len[__i+1]/* not this bucket */; ++__i)
{ {
...@@ -1330,7 +1336,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -1330,7 +1336,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ {
_RopeConcatenation* __c = (_RopeConcatenation*)__r; _RopeConcatenation* __c = (_RopeConcatenation*)__r;
_RopeRep* __left = __c->_M_left; _RopeRep* __left = __c->_M_left;
size_t __left_len = __left->_M_size; std::size_t __left_len = __left->_M_size;
if (__i >= __left_len) if (__i >= __left_len)
{ {
...@@ -1368,7 +1374,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -1368,7 +1374,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_S_fetch_ptr(_RopeRep* __r, size_type __i) _S_fetch_ptr(_RopeRep* __r, size_type __i)
{ {
_RopeRep* __clrstack[__detail::_S_max_rope_depth]; _RopeRep* __clrstack[__detail::_S_max_rope_depth];
size_t __csptr = 0; std::size_t __csptr = 0;
for(;;) for(;;)
{ {
...@@ -1380,7 +1386,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -1380,7 +1386,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ {
_RopeConcatenation* __c = (_RopeConcatenation*)__r; _RopeConcatenation* __c = (_RopeConcatenation*)__r;
_RopeRep* __left = __c->_M_left; _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) if (__c->_M_c_string != 0)
__clrstack[__csptr++] = __c; __clrstack[__csptr++] = __c;
...@@ -1424,8 +1430,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -1424,8 +1430,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
rope<_CharT, _Alloc>:: rope<_CharT, _Alloc>::
_S_compare (const _RopeRep* __left, const _RopeRep* __right) _S_compare (const _RopeRep* __left, const _RopeRep* __right)
{ {
size_t __left_len; std::size_t __left_len;
size_t __right_len; std::size_t __right_len;
if (0 == __right) if (0 == __right)
return 0 != __left; return 0 != __left;
...@@ -1524,13 +1530,15 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -1524,13 +1530,15 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template <class _CharT, class _Alloc> template <class _CharT, class _Alloc>
rope<_CharT, _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) : _Base(__a)
{ {
using std::__uninitialized_fill_n_a;
rope<_CharT,_Alloc> __result; rope<_CharT,_Alloc> __result;
const size_t __exponentiate_threshold = 32; const std::size_t __exponentiate_threshold = 32;
size_t __exponent; std::size_t __exponent;
size_t __rest; std::size_t __rest;
_CharT* __rest_buffer; _CharT* __rest_buffer;
_RopeRep* __remainder; _RopeRep* __remainder;
rope<_CharT, _Alloc> __remainder_rope; rope<_CharT, _Alloc> __remainder_rope;
...@@ -1617,7 +1625,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -1617,7 +1625,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
__GC_CONST _CharT* __result = this->_M_tree_ptr->_M_c_string; __GC_CONST _CharT* __result = this->_M_tree_ptr->_M_c_string;
if (0 == __result) if (0 == __result)
{ {
size_t __s = size(); std::size_t __s = size();
__result = this->_Data_allocate(__s + 1); __result = this->_Data_allocate(__s + 1);
_S_flatten(this->_M_tree_ptr, __result); _S_flatten(this->_M_tree_ptr, __result);
__result[__s] = _S_eos((_CharT*)0); __result[__s] = _S_eos((_CharT*)0);
...@@ -1640,7 +1648,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -1640,7 +1648,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
if (__detail::_S_leaf == this->_M_tree_ptr->_M_tag if (__detail::_S_leaf == this->_M_tree_ptr->_M_tag
&& 0 != __old_c_string) && 0 != __old_c_string)
return(__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)); _CharT* __result = this->_Data_allocate(_S_rounded_up_size(__s));
_S_flatten(this->_M_tree_ptr, __result); _S_flatten(this->_M_tree_ptr, __result);
__result[__s] = _S_eos((_CharT*)0); __result[__s] = _S_eos((_CharT*)0);
......
...@@ -54,14 +54,6 @@ namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) ...@@ -54,14 +54,6 @@ namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
{ {
_GLIBCXX_BEGIN_NAMESPACE_VERSION _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 struct _Slist_node_base
{ {
_Slist_node_base* _M_next; _Slist_node_base* _M_next;
...@@ -138,10 +130,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -138,10 +130,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
return __result; return __result;
} }
inline size_t inline std::size_t
__slist_size(_Slist_node_base* __node) __slist_size(_Slist_node_base* __node)
{ {
size_t __result = 0; std::size_t __result = 0;
for (; __node != 0; __node = __node->_M_next) for (; __node != 0; __node = __node->_M_next)
++__result; ++__result;
return __result; return __result;
...@@ -155,8 +147,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -155,8 +147,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
struct _Slist_iterator_base struct _Slist_iterator_base
{ {
typedef size_t size_type; typedef std::size_t size_type;
typedef ptrdiff_t difference_type; typedef std::ptrdiff_t difference_type;
typedef std::forward_iterator_tag iterator_category; typedef std::forward_iterator_tag iterator_category;
_Slist_node_base* _M_node; _Slist_node_base* _M_node;
...@@ -288,7 +280,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -288,7 +280,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* @ingroup SGIextensions * @ingroup SGIextensions
* @doctodo * @doctodo
*/ */
template <class _Tp, class _Alloc = allocator<_Tp> > template <class _Tp, class _Alloc = std::allocator<_Tp> >
class slist : private _Slist_base<_Tp,_Alloc> class slist : private _Slist_base<_Tp,_Alloc>
{ {
// concept requirements // concept requirements
...@@ -303,8 +295,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -303,8 +295,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
typedef const value_type* const_pointer; typedef const value_type* const_pointer;
typedef value_type& reference; typedef value_type& reference;
typedef const value_type& const_reference; typedef const value_type& const_reference;
typedef size_t size_type; typedef std::size_t size_type;
typedef ptrdiff_t difference_type; typedef std::ptrdiff_t difference_type;
typedef _Slist_iterator<_Tp, _Tp&, _Tp*> iterator; typedef _Slist_iterator<_Tp, _Tp&, _Tp*> iterator;
typedef _Slist_iterator<_Tp, const _Tp&, const _Tp*> const_iterator; typedef _Slist_iterator<_Tp, const _Tp&, const _Tp*> const_iterator;
...@@ -409,13 +401,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -409,13 +401,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template <class _Integer> template <class _Integer>
void 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); } { _M_fill_assign((size_type) __n, (_Tp) __val); }
template <class _InputIterator> template <class _InputIterator>
void void
_M_assign_dispatch(_InputIterator __first, _InputIterator __last, _M_assign_dispatch(_InputIterator __first, _InputIterator __last,
__false_type); std::__false_type);
public: public:
...@@ -533,14 +525,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -533,14 +525,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template <class _Integer> template <class _Integer>
void void
_M_insert_after_range(_Node_base* __pos, _Integer __n, _Integer __x, _M_insert_after_range(_Node_base* __pos, _Integer __n, _Integer __x,
__true_type) std::__true_type)
{ _M_insert_after_fill(__pos, __n, __x); } { _M_insert_after_fill(__pos, __n, __x); }
template <class _InIterator> template <class _InIterator>
void void
_M_insert_after_range(_Node_base* __pos, _M_insert_after_range(_Node_base* __pos,
_InIterator __first, _InIterator __last, _InIterator __first, _InIterator __last,
__false_type) std::__false_type)
{ {
while (__first != __last) while (__first != __last)
{ {
...@@ -771,7 +763,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -771,7 +763,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
void void
slist<_Tp, _Alloc>::_M_assign_dispatch(_InputIterator __first, slist<_Tp, _Alloc>::_M_assign_dispatch(_InputIterator __first,
_InputIterator __last, _InputIterator __last,
__false_type) std::__false_type)
{ {
_Node_base* __prev = &this->_M_head; _Node_base* __prev = &this->_M_head;
_Node* __node = (_Node*) this->_M_head._M_next; _Node* __node = (_Node*) this->_M_head._M_next;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment