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