Commit fa30fe72 by Bernardo Innocenti Committed by Bernardo Innocenti

algorithm, [...]: Remove trailing whitespace.

	* include/ext/algorithm, include/ext/debug_allocator.h,
	include/ext/enc_filebuf.h, include/ext/functional,
	include/ext/hash_fun.h, include/ext/hash_map, include/ext/hash_set,
	include/ext/hashtable.h, include/ext/iterator,
	include/ext/malloc_allocator.h, include/ext/memory,
	include/ext/mt_allocator.h, include/ext/numeric,
	include/ext/pod_char_traits.h, include/ext/pool_allocator.h,
	include/ext/rb_tree, include/ext/rope, include/ext/ropeimpl.h,
	include/ext/slist, include/ext/stdio_filebuf.h,
	include/ext/stdio_sync_filebuf.h: Remove trailing whitespace.

From-SVN: r74464
parent 526da49c
2003-12-09 Bernardo Innocenti <bernie@develer.com> 2003-12-09 Bernardo Innocenti <bernie@develer.com>
* include/ext/algorithm, include/ext/debug_allocator.h,
include/ext/enc_filebuf.h, include/ext/functional,
include/ext/hash_fun.h, include/ext/hash_map, include/ext/hash_set,
include/ext/hashtable.h, include/ext/iterator,
include/ext/malloc_allocator.h, include/ext/memory,
include/ext/mt_allocator.h, include/ext/numeric,
include/ext/pod_char_traits.h, include/ext/pool_allocator.h,
include/ext/rb_tree, include/ext/rope, include/ext/ropeimpl.h,
include/ext/slist, include/ext/stdio_filebuf.h,
include/ext/stdio_sync_filebuf.h: Remove trailing whitespace.
2003-12-09 Bernardo Innocenti <bernie@develer.com>
* include/debug/bitset, include/debug/debug.h, include/debug/deque, * include/debug/bitset, include/debug/debug.h, include/debug/deque,
include/debug/formatter.h, include/debug/hash_map.h, include/debug/formatter.h, include/debug/hash_map.h,
include/debug/hash_multimap.h, include/debug/hash_multiset.h, include/debug/hash_multimap.h, include/debug/hash_multiset.h,
......
...@@ -160,11 +160,11 @@ namespace __gnu_cxx ...@@ -160,11 +160,11 @@ namespace __gnu_cxx
const ptrdiff_t __len1 = __last1 - __first1; const ptrdiff_t __len1 = __last1 - __first1;
const ptrdiff_t __len2 = __last2 - __first2; const ptrdiff_t __len2 = __last2 - __first2;
const int __result = std::memcmp(__first1, __first2, min(__len1, __len2)); const int __result = std::memcmp(__first1, __first2, min(__len1, __len2));
return __result != 0 ? __result return __result != 0 ? __result
: (__len1 == __len2 ? 0 : (__len1 < __len2 ? -1 : 1)); : (__len1 == __len2 ? 0 : (__len1 < __len2 ? -1 : 1));
} }
inline int inline int
__lexicographical_compare_3way(const char* __first1, const char* __last1, __lexicographical_compare_3way(const char* __first1, const char* __last1,
const char* __first2, const char* __last2) const char* __first2, const char* __last2)
{ {
...@@ -295,7 +295,7 @@ namespace __gnu_cxx ...@@ -295,7 +295,7 @@ namespace __gnu_cxx
typename _RandomNumberGenerator> typename _RandomNumberGenerator>
_OutputIterator _OutputIterator
random_sample_n(_ForwardIterator __first, _ForwardIterator __last, random_sample_n(_ForwardIterator __first, _ForwardIterator __last,
_OutputIterator __out, const _Distance __n, _OutputIterator __out, const _Distance __n,
_RandomNumberGenerator& __rand) _RandomNumberGenerator& __rand)
{ {
// concept requirements // concept requirements
...@@ -330,7 +330,7 @@ namespace __gnu_cxx ...@@ -330,7 +330,7 @@ namespace __gnu_cxx
{ {
_Distance __m = 0; _Distance __m = 0;
_Distance __t = __n; _Distance __t = __n;
for ( ; __first != __last && __m < __n; ++__m, ++__first) for ( ; __first != __last && __m < __n; ++__m, ++__first)
__out[__m] = *__first; __out[__m] = *__first;
while (__first != __last) { while (__first != __last) {
...@@ -380,7 +380,7 @@ namespace __gnu_cxx ...@@ -380,7 +380,7 @@ namespace __gnu_cxx
template<typename _InputIterator, typename _RandomAccessIterator> template<typename _InputIterator, typename _RandomAccessIterator>
inline _RandomAccessIterator inline _RandomAccessIterator
random_sample(_InputIterator __first, _InputIterator __last, random_sample(_InputIterator __first, _InputIterator __last,
_RandomAccessIterator __out_first, _RandomAccessIterator __out_last) _RandomAccessIterator __out_first, _RandomAccessIterator __out_last)
{ {
// concept requirements // concept requirements
__glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)
...@@ -398,12 +398,12 @@ namespace __gnu_cxx ...@@ -398,12 +398,12 @@ namespace __gnu_cxx
* @ingroup SGIextensions * @ingroup SGIextensions
* @doctodo * @doctodo
*/ */
template<typename _InputIterator, typename _RandomAccessIterator, template<typename _InputIterator, typename _RandomAccessIterator,
typename _RandomNumberGenerator> typename _RandomNumberGenerator>
inline _RandomAccessIterator inline _RandomAccessIterator
random_sample(_InputIterator __first, _InputIterator __last, random_sample(_InputIterator __first, _InputIterator __last,
_RandomAccessIterator __out_first, _RandomAccessIterator __out_last, _RandomAccessIterator __out_first, _RandomAccessIterator __out_last,
_RandomNumberGenerator& __rand) _RandomNumberGenerator& __rand)
{ {
// concept requirements // concept requirements
__glibcxx_function_requires(_InputIteratorConcept<_InputIterator>) __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)
...@@ -416,7 +416,7 @@ namespace __gnu_cxx ...@@ -416,7 +416,7 @@ namespace __gnu_cxx
__out_first, __rand, __out_first, __rand,
__out_last - __out_first); __out_last - __out_first);
} }
/** /**
* This is an SGI extension. * This is an SGI extension.
* @ingroup SGIextensions * @ingroup SGIextensions
...@@ -448,7 +448,7 @@ namespace __gnu_cxx ...@@ -448,7 +448,7 @@ namespace __gnu_cxx
// concept requirements // concept requirements
__glibcxx_function_requires(_RandomAccessIteratorConcept<_RandomAccessIterator>) __glibcxx_function_requires(_RandomAccessIteratorConcept<_RandomAccessIterator>)
__glibcxx_function_requires(_BinaryPredicateConcept<_StrictWeakOrdering, __glibcxx_function_requires(_BinaryPredicateConcept<_StrictWeakOrdering,
typename iterator_traits<_RandomAccessIterator>::value_type, typename iterator_traits<_RandomAccessIterator>::value_type,
typename iterator_traits<_RandomAccessIterator>::value_type>) typename iterator_traits<_RandomAccessIterator>::value_type>)
__glibcxx_requires_valid_range(__first, __last); __glibcxx_requires_valid_range(__first, __last);
...@@ -498,7 +498,7 @@ namespace __gnu_cxx ...@@ -498,7 +498,7 @@ namespace __gnu_cxx
// concept requirements // concept requirements
__glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>) __glibcxx_function_requires(_ForwardIteratorConcept<_ForwardIterator>)
__glibcxx_function_requires(_BinaryPredicateConcept<_StrictWeakOrdering, __glibcxx_function_requires(_BinaryPredicateConcept<_StrictWeakOrdering,
typename iterator_traits<_ForwardIterator>::value_type, typename iterator_traits<_ForwardIterator>::value_type,
typename iterator_traits<_ForwardIterator>::value_type>) typename iterator_traits<_ForwardIterator>::value_type>)
__glibcxx_requires_valid_range(__first, __last); __glibcxx_requires_valid_range(__first, __last);
......
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
*/ */
/** @file ext/debug_allocator.h /** @file ext/debug_allocator.h
* This file is a GNU extension to the Standard C++ Library. * This file is a GNU extension to the Standard C++ Library.
* You should only include this header if you are using GCC 3 or later. * You should only include this header if you are using GCC 3 or later.
*/ */
...@@ -125,7 +125,7 @@ namespace std ...@@ -125,7 +125,7 @@ namespace std
/// Versions for the __allocator adaptor used with the predefined /// Versions for the __allocator adaptor used with the predefined
/// "SGI" style allocators. /// "SGI" style allocators.
template<typename _Tp, typename _Tp1, typename _Alloc> template<typename _Tp, typename _Tp1, typename _Alloc>
struct _Alloc_traits<_Tp, __allocator<_Tp1, struct _Alloc_traits<_Tp, __allocator<_Tp1,
__gnu_cxx::__debug_alloc<_Alloc> > > __gnu_cxx::__debug_alloc<_Alloc> > >
{ {
static const bool _S_instanceless = true; static const bool _S_instanceless = true;
......
...@@ -39,7 +39,7 @@ namespace __gnu_cxx ...@@ -39,7 +39,7 @@ namespace __gnu_cxx
struct enc_char_traits: public std::char_traits<_CharT> struct enc_char_traits: public std::char_traits<_CharT>
{ {
typedef std::__enc_traits state_type; typedef std::__enc_traits state_type;
typedef typename std::fpos<state_type> pos_type; typedef typename std::fpos<state_type> pos_type;
}; };
template<typename _CharT> template<typename _CharT>
...@@ -47,13 +47,13 @@ namespace __gnu_cxx ...@@ -47,13 +47,13 @@ namespace __gnu_cxx
: public std::basic_filebuf<_CharT, enc_char_traits<_CharT> > : public std::basic_filebuf<_CharT, enc_char_traits<_CharT> >
{ {
public: public:
typedef enc_char_traits<_CharT> traits_type; typedef enc_char_traits<_CharT> traits_type;
typedef typename traits_type::state_type state_type; typedef typename traits_type::state_type state_type;
typedef typename traits_type::pos_type pos_type; typedef typename traits_type::pos_type pos_type;
enc_filebuf(state_type& __state) enc_filebuf(state_type& __state)
: std::basic_filebuf<_CharT, enc_char_traits<_CharT> >() : std::basic_filebuf<_CharT, enc_char_traits<_CharT> >()
{ {
// Set state type to something useful. // Set state type to something useful.
// Something more than copyconstructible is needed here, so // Something more than copyconstructible is needed here, so
// require default and copy constructible + assignment operator. // require default and copy constructible + assignment operator.
......
...@@ -100,7 +100,7 @@ template <class _Tp> inline _Tp identity_element(std::multiplies<_Tp>) { ...@@ -100,7 +100,7 @@ template <class _Tp> inline _Tp identity_element(std::multiplies<_Tp>) {
* Calling @c operator() with a single argument @c x returns @c f(g(x)). * Calling @c operator() with a single argument @c x returns @c f(g(x)).
* The function @c compose1 takes the two functions and constructs a * The function @c compose1 takes the two functions and constructs a
* @c unary_compose variable for you. * @c unary_compose variable for you.
* *
* @c binary_compose is constructed from three functors, @c f, @c g1, * @c binary_compose is constructed from three functors, @c f, @c g1,
* and @c g2. Its @c operator() returns @c f(g1(x),g2(x)). The function * and @c g2. Its @c operator() returns @c f(g1(x),g2(x)). The function
* @compose2 takes f, g1, and g2, and constructs the @c binary_compose * @compose2 takes f, g1, and g2, and constructs the @c binary_compose
...@@ -124,13 +124,13 @@ template <class _Tp> inline _Tp identity_element(std::multiplies<_Tp>) { ...@@ -124,13 +124,13 @@ template <class _Tp> inline _Tp identity_element(std::multiplies<_Tp>) {
template <class _Operation1, class _Operation2> template <class _Operation1, class _Operation2>
class unary_compose class unary_compose
: public unary_function<typename _Operation2::argument_type, : public unary_function<typename _Operation2::argument_type,
typename _Operation1::result_type> typename _Operation1::result_type>
{ {
protected: protected:
_Operation1 _M_fn1; _Operation1 _M_fn1;
_Operation2 _M_fn2; _Operation2 _M_fn2;
public: public:
unary_compose(const _Operation1& __x, const _Operation2& __y) unary_compose(const _Operation1& __x, const _Operation2& __y)
: _M_fn1(__x), _M_fn2(__y) {} : _M_fn1(__x), _M_fn2(__y) {}
typename _Operation1::result_type typename _Operation1::result_type
operator()(const typename _Operation2::argument_type& __x) const { operator()(const typename _Operation2::argument_type& __x) const {
...@@ -140,7 +140,7 @@ public: ...@@ -140,7 +140,7 @@ public:
/// An \link SGIextensions SGI extension \endlink. /// An \link SGIextensions SGI extension \endlink.
template <class _Operation1, class _Operation2> template <class _Operation1, class _Operation2>
inline unary_compose<_Operation1,_Operation2> inline unary_compose<_Operation1,_Operation2>
compose1(const _Operation1& __fn1, const _Operation2& __fn2) compose1(const _Operation1& __fn1, const _Operation2& __fn2)
{ {
return unary_compose<_Operation1,_Operation2>(__fn1, __fn2); return unary_compose<_Operation1,_Operation2>(__fn1, __fn2);
...@@ -156,8 +156,8 @@ protected: ...@@ -156,8 +156,8 @@ protected:
_Operation2 _M_fn2; _Operation2 _M_fn2;
_Operation3 _M_fn3; _Operation3 _M_fn3;
public: public:
binary_compose(const _Operation1& __x, const _Operation2& __y, binary_compose(const _Operation1& __x, const _Operation2& __y,
const _Operation3& __z) const _Operation3& __z)
: _M_fn1(__x), _M_fn2(__y), _M_fn3(__z) { } : _M_fn1(__x), _M_fn2(__y), _M_fn3(__z) { }
typename _Operation1::result_type typename _Operation1::result_type
operator()(const typename _Operation2::argument_type& __x) const { operator()(const typename _Operation2::argument_type& __x) const {
...@@ -167,8 +167,8 @@ public: ...@@ -167,8 +167,8 @@ public:
/// 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>
inline binary_compose<_Operation1, _Operation2, _Operation3> inline binary_compose<_Operation1, _Operation2, _Operation3>
compose2(const _Operation1& __fn1, const _Operation2& __fn2, compose2(const _Operation1& __fn1, const _Operation2& __fn2,
const _Operation3& __fn3) const _Operation3& __fn3)
{ {
return binary_compose<_Operation1,_Operation2,_Operation3> return binary_compose<_Operation1,_Operation2,_Operation3>
...@@ -220,7 +220,7 @@ struct _Project2nd : public binary_function<_Arg1, _Arg2, _Arg2> { ...@@ -220,7 +220,7 @@ struct _Project2nd : public binary_function<_Arg1, _Arg2, _Arg2> {
*/ */
/// An \link SGIextensions SGI extension \endlink. /// An \link SGIextensions SGI extension \endlink.
template <class _Arg1, class _Arg2> template <class _Arg1, class _Arg2>
struct project1st : public _Project1st<_Arg1, _Arg2> {}; struct project1st : public _Project1st<_Arg1, _Arg2> {};
/// An \link SGIextensions SGI extension \endlink. /// An \link SGIextensions SGI extension \endlink.
...@@ -236,7 +236,7 @@ struct _Constant_void_fun { ...@@ -236,7 +236,7 @@ struct _Constant_void_fun {
_Constant_void_fun(const result_type& __v) : _M_val(__v) {} _Constant_void_fun(const result_type& __v) : _M_val(__v) {}
const result_type& operator()() const { return _M_val; } const result_type& operator()() const { return _M_val; }
}; };
template <class _Result, class _Argument> template <class _Result, class _Argument>
struct _Constant_unary_fun { struct _Constant_unary_fun {
...@@ -279,7 +279,7 @@ struct _Constant_binary_fun { ...@@ -279,7 +279,7 @@ struct _Constant_binary_fun {
template <class _Result> template <class _Result>
struct constant_void_fun : public _Constant_void_fun<_Result> { struct constant_void_fun : public _Constant_void_fun<_Result> {
constant_void_fun(const _Result& __v) : _Constant_void_fun<_Result>(__v) {} constant_void_fun(const _Result& __v) : _Constant_void_fun<_Result>(__v) {}
}; };
/// An \link SGIextensions SGI extension \endlink. /// An \link SGIextensions SGI extension \endlink.
template <class _Result, template <class _Result,
...@@ -317,7 +317,7 @@ inline constant_unary_fun<_Result,_Result> constant1(const _Result& __val) ...@@ -317,7 +317,7 @@ inline constant_unary_fun<_Result,_Result> constant1(const _Result& __val)
/// An \link SGIextensions SGI extension \endlink. /// An \link SGIextensions SGI extension \endlink.
template <class _Result> template <class _Result>
inline constant_binary_fun<_Result,_Result,_Result> inline constant_binary_fun<_Result,_Result,_Result>
constant2(const _Result& __val) constant2(const _Result& __val)
{ {
return constant_binary_fun<_Result,_Result,_Result>(__val); return constant_binary_fun<_Result,_Result,_Result>(__val);
...@@ -369,7 +369,7 @@ public: ...@@ -369,7 +369,7 @@ public:
subtractive_rng() { _M_initialize(161803398u); } subtractive_rng() { _M_initialize(161803398u); }
}; };
// Mem_fun adaptor helper functions mem_fun1 and mem_fun1_ref, // Mem_fun adaptor helper functions mem_fun1 and mem_fun1_ref,
// provided for backward compatibility, they are no longer part of // provided for backward compatibility, they are no longer part of
// the C++ standard. // the C++ standard.
...@@ -391,5 +391,5 @@ mem_fun1_ref(_Ret (_Tp::*__f)(_Arg) const) ...@@ -391,5 +391,5 @@ mem_fun1_ref(_Ret (_Tp::*__f)(_Arg) const)
{ return const_mem_fun1_ref_t<_Ret,_Tp,_Arg>(__f); } { return const_mem_fun1_ref_t<_Ret,_Tp,_Arg>(__f); }
} // namespace __gnu_cxx } // namespace __gnu_cxx
#endif #endif
...@@ -70,53 +70,53 @@ namespace __gnu_cxx ...@@ -70,53 +70,53 @@ namespace __gnu_cxx
template <class _Key> struct hash { }; template <class _Key> struct hash { };
inline size_t inline size_t
__stl_hash_string(const char* __s) __stl_hash_string(const char* __s)
{ {
unsigned long __h = 0; unsigned long __h = 0;
for ( ; *__s; ++__s) for ( ; *__s; ++__s)
__h = 5*__h + *__s; __h = 5*__h + *__s;
return size_t(__h); return size_t(__h);
} }
template<> struct hash<char*> template<> struct hash<char*>
{ {
size_t operator()(const char* __s) const size_t operator()(const char* __s) const
{ return __stl_hash_string(__s); } { return __stl_hash_string(__s); }
}; };
template<> struct hash<const char*> template<> struct hash<const char*>
{ {
size_t operator()(const char* __s) const size_t operator()(const char* __s) const
{ return __stl_hash_string(__s); } { return __stl_hash_string(__s); }
}; };
template<> struct hash<char> template<> struct hash<char>
{ size_t operator()(char __x) const { return __x; } }; { size_t operator()(char __x) const { return __x; } };
template<> struct hash<unsigned char> template<> struct hash<unsigned char>
{ size_t operator()(unsigned char __x) const { return __x; } }; { size_t operator()(unsigned char __x) const { return __x; } };
template<> struct hash<signed char> template<> struct hash<signed char>
{ size_t operator()(unsigned char __x) const { return __x; } }; { size_t operator()(unsigned char __x) const { return __x; } };
template<> struct hash<short> template<> struct hash<short>
{ size_t operator()(short __x) const { return __x; } }; { size_t operator()(short __x) const { return __x; } };
template<> struct hash<unsigned short> template<> struct hash<unsigned short>
{ size_t operator()(unsigned short __x) const { return __x; } }; { size_t operator()(unsigned short __x) const { return __x; } };
template<> struct hash<int> template<> struct hash<int>
{ size_t operator()(int __x) const { return __x; } }; { size_t operator()(int __x) const { return __x; } };
template<> struct hash<unsigned int> template<> struct hash<unsigned int>
{ size_t operator()(unsigned int __x) const { return __x; } }; { size_t operator()(unsigned int __x) const { return __x; } };
template<> struct hash<long> template<> struct hash<long>
{ size_t operator()(long __x) const { return __x; } }; { size_t operator()(long __x) const { return __x; } };
template<> struct hash<unsigned long> template<> struct hash<unsigned long>
{ size_t operator()(unsigned long __x) const { return __x; } }; { size_t operator()(unsigned long __x) const { return __x; } };
} // namespace __gnu_cxx } // namespace __gnu_cxx
#endif #endif
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
* include this header if you are using GCC 3 or later. * include this header if you are using GCC 3 or later.
*/ */
#ifndef _HASH_MAP #ifndef _HASH_MAP
#define _HASH_MAP 1 #define _HASH_MAP 1
#include <ext/hashtable.h> #include <ext/hashtable.h>
...@@ -102,7 +102,7 @@ public: ...@@ -102,7 +102,7 @@ public:
typedef typename _Ht::value_type value_type; typedef typename _Ht::value_type value_type;
typedef typename _Ht::hasher hasher; typedef typename _Ht::hasher hasher;
typedef typename _Ht::key_equal key_equal; typedef typename _Ht::key_equal key_equal;
typedef typename _Ht::size_type size_type; typedef typename _Ht::size_type size_type;
typedef typename _Ht::difference_type difference_type; typedef typename _Ht::difference_type difference_type;
typedef typename _Ht::pointer pointer; typedef typename _Ht::pointer pointer;
...@@ -171,10 +171,10 @@ public: ...@@ -171,10 +171,10 @@ public:
void insert(_InputIterator __f, _InputIterator __l) void insert(_InputIterator __f, _InputIterator __l)
{ _M_ht.insert_unique(__f,__l); } { _M_ht.insert_unique(__f,__l); }
pair<iterator,bool> insert_noresize(const value_type& __obj) pair<iterator,bool> insert_noresize(const value_type& __obj)
{ return _M_ht.insert_unique_noresize(__obj); } { return _M_ht.insert_unique_noresize(__obj); }
iterator find(const key_type& __key) { return _M_ht.find(__key); } iterator find(const key_type& __key) { return _M_ht.find(__key); }
const_iterator find(const key_type& __key) const const_iterator find(const key_type& __key) const
{ return _M_ht.find(__key); } { return _M_ht.find(__key); }
_Tp& operator[](const key_type& __key) { _Tp& operator[](const key_type& __key) {
...@@ -182,7 +182,7 @@ public: ...@@ -182,7 +182,7 @@ public:
} }
size_type count(const key_type& __key) const { return _M_ht.count(__key); } size_type count(const key_type& __key) const { return _M_ht.count(__key); }
pair<iterator, iterator> equal_range(const key_type& __key) pair<iterator, iterator> equal_range(const key_type& __key)
{ return _M_ht.equal_range(__key); } { return _M_ht.equal_range(__key); }
pair<const_iterator, const_iterator> pair<const_iterator, const_iterator>
...@@ -202,7 +202,7 @@ public: ...@@ -202,7 +202,7 @@ public:
}; };
template <class _Key, class _Tp, class _HashFcn, class _EqlKey, class _Alloc> template <class _Key, class _Tp, class _HashFcn, class _EqlKey, class _Alloc>
inline bool inline bool
operator==(const hash_map<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>& __hm1, operator==(const hash_map<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>& __hm1,
const hash_map<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>& __hm2) const hash_map<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>& __hm2)
{ {
...@@ -210,14 +210,14 @@ operator==(const hash_map<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>& __hm1, ...@@ -210,14 +210,14 @@ operator==(const hash_map<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>& __hm1,
} }
template <class _Key, class _Tp, class _HashFcn, class _EqlKey, class _Alloc> template <class _Key, class _Tp, class _HashFcn, class _EqlKey, class _Alloc>
inline bool inline bool
operator!=(const hash_map<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>& __hm1, operator!=(const hash_map<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>& __hm1,
const hash_map<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>& __hm2) { const hash_map<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>& __hm2) {
return !(__hm1 == __hm2); return !(__hm1 == __hm2);
} }
template <class _Key, class _Tp, class _HashFcn, class _EqlKey, class _Alloc> template <class _Key, class _Tp, class _HashFcn, class _EqlKey, class _Alloc>
inline void inline void
swap(hash_map<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>& __hm1, swap(hash_map<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>& __hm1,
hash_map<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>& __hm2) hash_map<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>& __hm2)
{ {
...@@ -233,7 +233,7 @@ template <class _Key, class _Tp, ...@@ -233,7 +233,7 @@ template <class _Key, class _Tp,
class hash_multimap; class hash_multimap;
template <class _Key, class _Tp, class _HF, class _EqKey, class _Alloc> template <class _Key, class _Tp, class _HF, class _EqKey, class _Alloc>
inline bool inline bool
operator==(const hash_multimap<_Key,_Tp,_HF,_EqKey,_Alloc>& __hm1, operator==(const hash_multimap<_Key,_Tp,_HF,_EqKey,_Alloc>& __hm1,
const hash_multimap<_Key,_Tp,_HF,_EqKey,_Alloc>& __hm2); const hash_multimap<_Key,_Tp,_HF,_EqKey,_Alloc>& __hm2);
...@@ -253,7 +253,7 @@ class hash_multimap ...@@ -253,7 +253,7 @@ class hash_multimap
private: private:
typedef hashtable<pair<const _Key, _Tp>, _Key, _HashFcn, typedef hashtable<pair<const _Key, _Tp>, _Key, _HashFcn,
_Select1st<pair<const _Key, _Tp> >, _EqualKey, _Alloc> _Select1st<pair<const _Key, _Tp> >, _EqualKey, _Alloc>
_Ht; _Ht;
_Ht _M_ht; _Ht _M_ht;
...@@ -327,20 +327,20 @@ public: ...@@ -327,20 +327,20 @@ public:
const_iterator end() const { return _M_ht.end(); } const_iterator end() const { return _M_ht.end(); }
public: public:
iterator insert(const value_type& __obj) iterator insert(const value_type& __obj)
{ return _M_ht.insert_equal(__obj); } { return _M_ht.insert_equal(__obj); }
template <class _InputIterator> template <class _InputIterator>
void insert(_InputIterator __f, _InputIterator __l) void insert(_InputIterator __f, _InputIterator __l)
{ _M_ht.insert_equal(__f,__l); } { _M_ht.insert_equal(__f,__l); }
iterator insert_noresize(const value_type& __obj) iterator insert_noresize(const value_type& __obj)
{ return _M_ht.insert_equal_noresize(__obj); } { return _M_ht.insert_equal_noresize(__obj); }
iterator find(const key_type& __key) { return _M_ht.find(__key); } iterator find(const key_type& __key) { return _M_ht.find(__key); }
const_iterator find(const key_type& __key) const const_iterator find(const key_type& __key) const
{ return _M_ht.find(__key); } { return _M_ht.find(__key); }
size_type count(const key_type& __key) const { return _M_ht.count(__key); } size_type count(const key_type& __key) const { return _M_ht.count(__key); }
pair<iterator, iterator> equal_range(const key_type& __key) pair<iterator, iterator> equal_range(const key_type& __key)
{ return _M_ht.equal_range(__key); } { return _M_ht.equal_range(__key); }
pair<const_iterator, const_iterator> pair<const_iterator, const_iterator>
...@@ -361,7 +361,7 @@ public: ...@@ -361,7 +361,7 @@ public:
}; };
template <class _Key, class _Tp, class _HF, class _EqKey, class _Alloc> template <class _Key, class _Tp, class _HF, class _EqKey, class _Alloc>
inline bool inline bool
operator==(const hash_multimap<_Key,_Tp,_HF,_EqKey,_Alloc>& __hm1, operator==(const hash_multimap<_Key,_Tp,_HF,_EqKey,_Alloc>& __hm1,
const hash_multimap<_Key,_Tp,_HF,_EqKey,_Alloc>& __hm2) const hash_multimap<_Key,_Tp,_HF,_EqKey,_Alloc>& __hm2)
{ {
...@@ -369,14 +369,14 @@ operator==(const hash_multimap<_Key,_Tp,_HF,_EqKey,_Alloc>& __hm1, ...@@ -369,14 +369,14 @@ operator==(const hash_multimap<_Key,_Tp,_HF,_EqKey,_Alloc>& __hm1,
} }
template <class _Key, class _Tp, class _HF, class _EqKey, class _Alloc> template <class _Key, class _Tp, class _HF, class _EqKey, class _Alloc>
inline bool inline bool
operator!=(const hash_multimap<_Key,_Tp,_HF,_EqKey,_Alloc>& __hm1, operator!=(const hash_multimap<_Key,_Tp,_HF,_EqKey,_Alloc>& __hm1,
const hash_multimap<_Key,_Tp,_HF,_EqKey,_Alloc>& __hm2) { const hash_multimap<_Key,_Tp,_HF,_EqKey,_Alloc>& __hm2) {
return !(__hm1 == __hm2); return !(__hm1 == __hm2);
} }
template <class _Key, class _Tp, class _HashFcn, class _EqlKey, class _Alloc> template <class _Key, class _Tp, class _HashFcn, class _EqlKey, class _Alloc>
inline void inline void
swap(hash_multimap<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>& __hm1, swap(hash_multimap<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>& __hm1,
hash_multimap<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>& __hm2) hash_multimap<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>& __hm2)
{ {
...@@ -407,7 +407,7 @@ public: ...@@ -407,7 +407,7 @@ public:
insert_iterator(_Container& __x, typename _Container::iterator) insert_iterator(_Container& __x, typename _Container::iterator)
: container(&__x) {} : container(&__x) {}
insert_iterator<_Container>& insert_iterator<_Container>&
operator=(const typename _Container::value_type& __value) { operator=(const typename _Container::value_type& __value) {
container->insert(__value); container->insert(__value);
return *this; return *this;
} }
...@@ -434,7 +434,7 @@ public: ...@@ -434,7 +434,7 @@ public:
insert_iterator(_Container& __x, typename _Container::iterator) insert_iterator(_Container& __x, typename _Container::iterator)
: container(&__x) {} : container(&__x) {}
insert_iterator<_Container>& insert_iterator<_Container>&
operator=(const typename _Container::value_type& __value) { operator=(const typename _Container::value_type& __value) {
container->insert(__value); container->insert(__value);
return *this; return *this;
} }
......
...@@ -75,12 +75,12 @@ namespace __gnu_cxx ...@@ -75,12 +75,12 @@ namespace __gnu_cxx
// Forward declaration of equality operator; needed for friend // Forward declaration of equality operator; needed for friend
// declaration. // declaration.
template <class _Value, class _HashFcn = hash<_Value>, template <class _Value, class _HashFcn = hash<_Value>,
class _EqualKey = equal_to<_Value>, class _EqualKey = equal_to<_Value>,
class _Alloc = allocator<_Value> > class _Alloc = allocator<_Value> >
class hash_set; class hash_set;
template <class _Value, class _HashFcn, class _EqualKey, class _Alloc> template <class _Value, class _HashFcn, class _EqualKey, class _Alloc>
inline bool inline bool
operator==(const hash_set<_Value,_HashFcn,_EqualKey,_Alloc>& __hs1, operator==(const hash_set<_Value,_HashFcn,_EqualKey,_Alloc>& __hs1,
const hash_set<_Value,_HashFcn,_EqualKey,_Alloc>& __hs2); const hash_set<_Value,_HashFcn,_EqualKey,_Alloc>& __hs2);
...@@ -98,7 +98,7 @@ class hash_set ...@@ -98,7 +98,7 @@ class hash_set
__glibcxx_class_requires3(_EqualKey, _Value, _Value, _BinaryPredicateConcept) __glibcxx_class_requires3(_EqualKey, _Value, _Value, _BinaryPredicateConcept)
private: private:
typedef hashtable<_Value, _Value, _HashFcn, _Identity<_Value>, typedef hashtable<_Value, _Value, _HashFcn, _Identity<_Value>,
_EqualKey, _Alloc> _Ht; _EqualKey, _Alloc> _Ht;
_Ht _M_ht; _Ht _M_ht;
...@@ -161,7 +161,7 @@ public: ...@@ -161,7 +161,7 @@ public:
bool empty() const { return _M_ht.empty(); } bool empty() const { return _M_ht.empty(); }
void swap(hash_set& __hs) { _M_ht.swap(__hs._M_ht); } void swap(hash_set& __hs) { _M_ht.swap(__hs._M_ht); }
template <class _Val, class _HF, class _EqK, class _Al> template <class _Val, class _HF, class _EqK, class _Al>
friend bool operator== (const hash_set<_Val, _HF, _EqK, _Al>&, friend bool operator== (const hash_set<_Val, _HF, _EqK, _Al>&,
const hash_set<_Val, _HF, _EqK, _Al>&); const hash_set<_Val, _HF, _EqK, _Al>&);
...@@ -175,11 +175,11 @@ public: ...@@ -175,11 +175,11 @@ public:
return pair<iterator,bool>(__p.first, __p.second); return pair<iterator,bool>(__p.first, __p.second);
} }
template <class _InputIterator> template <class _InputIterator>
void insert(_InputIterator __f, _InputIterator __l) void insert(_InputIterator __f, _InputIterator __l)
{ _M_ht.insert_unique(__f,__l); } { _M_ht.insert_unique(__f,__l); }
pair<iterator, bool> insert_noresize(const value_type& __obj) pair<iterator, bool> insert_noresize(const value_type& __obj)
{ {
pair<typename _Ht::iterator, bool> __p = pair<typename _Ht::iterator, bool> __p =
_M_ht.insert_unique_noresize(__obj); _M_ht.insert_unique_noresize(__obj);
return pair<iterator, bool>(__p.first, __p.second); return pair<iterator, bool>(__p.first, __p.second);
} }
...@@ -187,7 +187,7 @@ public: ...@@ -187,7 +187,7 @@ public:
iterator find(const key_type& __key) const { return _M_ht.find(__key); } iterator find(const key_type& __key) const { return _M_ht.find(__key); }
size_type count(const key_type& __key) const { return _M_ht.count(__key); } size_type count(const key_type& __key) const { return _M_ht.count(__key); }
pair<iterator, iterator> equal_range(const key_type& __key) const pair<iterator, iterator> equal_range(const key_type& __key) const
{ return _M_ht.equal_range(__key); } { return _M_ht.equal_range(__key); }
...@@ -205,7 +205,7 @@ public: ...@@ -205,7 +205,7 @@ public:
}; };
template <class _Value, class _HashFcn, class _EqualKey, class _Alloc> template <class _Value, class _HashFcn, class _EqualKey, class _Alloc>
inline bool inline bool
operator==(const hash_set<_Value,_HashFcn,_EqualKey,_Alloc>& __hs1, operator==(const hash_set<_Value,_HashFcn,_EqualKey,_Alloc>& __hs1,
const hash_set<_Value,_HashFcn,_EqualKey,_Alloc>& __hs2) const hash_set<_Value,_HashFcn,_EqualKey,_Alloc>& __hs2)
{ {
...@@ -213,14 +213,14 @@ operator==(const hash_set<_Value,_HashFcn,_EqualKey,_Alloc>& __hs1, ...@@ -213,14 +213,14 @@ operator==(const hash_set<_Value,_HashFcn,_EqualKey,_Alloc>& __hs1,
} }
template <class _Value, class _HashFcn, class _EqualKey, class _Alloc> template <class _Value, class _HashFcn, class _EqualKey, class _Alloc>
inline bool inline bool
operator!=(const hash_set<_Value,_HashFcn,_EqualKey,_Alloc>& __hs1, operator!=(const hash_set<_Value,_HashFcn,_EqualKey,_Alloc>& __hs1,
const hash_set<_Value,_HashFcn,_EqualKey,_Alloc>& __hs2) { const hash_set<_Value,_HashFcn,_EqualKey,_Alloc>& __hs2) {
return !(__hs1 == __hs2); return !(__hs1 == __hs2);
} }
template <class _Val, class _HashFcn, class _EqualKey, class _Alloc> template <class _Val, class _HashFcn, class _EqualKey, class _Alloc>
inline void inline void
swap(hash_set<_Val,_HashFcn,_EqualKey,_Alloc>& __hs1, swap(hash_set<_Val,_HashFcn,_EqualKey,_Alloc>& __hs1,
hash_set<_Val,_HashFcn,_EqualKey,_Alloc>& __hs2) hash_set<_Val,_HashFcn,_EqualKey,_Alloc>& __hs2)
{ {
...@@ -235,7 +235,7 @@ template <class _Value, ...@@ -235,7 +235,7 @@ template <class _Value,
class hash_multiset; class hash_multiset;
template <class _Val, class _HashFcn, class _EqualKey, class _Alloc> template <class _Val, class _HashFcn, class _EqualKey, class _Alloc>
inline bool inline bool
operator==(const hash_multiset<_Val,_HashFcn,_EqualKey,_Alloc>& __hs1, operator==(const hash_multiset<_Val,_HashFcn,_EqualKey,_Alloc>& __hs1,
const hash_multiset<_Val,_HashFcn,_EqualKey,_Alloc>& __hs2); const hash_multiset<_Val,_HashFcn,_EqualKey,_Alloc>& __hs2);
...@@ -254,7 +254,7 @@ class hash_multiset ...@@ -254,7 +254,7 @@ class hash_multiset
__glibcxx_class_requires3(_EqualKey, _Value, _Value, _BinaryPredicateConcept) __glibcxx_class_requires3(_EqualKey, _Value, _Value, _BinaryPredicateConcept)
private: private:
typedef hashtable<_Value, _Value, _HashFcn, _Identity<_Value>, typedef hashtable<_Value, _Value, _HashFcn, _Identity<_Value>,
_EqualKey, _Alloc> _Ht; _EqualKey, _Alloc> _Ht;
_Ht _M_ht; _Ht _M_ht;
...@@ -317,7 +317,7 @@ public: ...@@ -317,7 +317,7 @@ public:
bool empty() const { return _M_ht.empty(); } bool empty() const { return _M_ht.empty(); }
void swap(hash_multiset& hs) { _M_ht.swap(hs._M_ht); } void swap(hash_multiset& hs) { _M_ht.swap(hs._M_ht); }
template <class _Val, class _HF, class _EqK, class _Al> template <class _Val, class _HF, class _EqK, class _Al>
friend bool operator== (const hash_multiset<_Val, _HF, _EqK, _Al>&, friend bool operator== (const hash_multiset<_Val, _HF, _EqK, _Al>&,
const hash_multiset<_Val, _HF, _EqK, _Al>&); const hash_multiset<_Val, _HF, _EqK, _Al>&);
...@@ -328,15 +328,15 @@ public: ...@@ -328,15 +328,15 @@ public:
iterator insert(const value_type& __obj) iterator insert(const value_type& __obj)
{ return _M_ht.insert_equal(__obj); } { return _M_ht.insert_equal(__obj); }
template <class _InputIterator> template <class _InputIterator>
void insert(_InputIterator __f, _InputIterator __l) void insert(_InputIterator __f, _InputIterator __l)
{ _M_ht.insert_equal(__f,__l); } { _M_ht.insert_equal(__f,__l); }
iterator insert_noresize(const value_type& __obj) iterator insert_noresize(const value_type& __obj)
{ return _M_ht.insert_equal_noresize(__obj); } { return _M_ht.insert_equal_noresize(__obj); }
iterator find(const key_type& __key) const { return _M_ht.find(__key); } iterator find(const key_type& __key) const { return _M_ht.find(__key); }
size_type count(const key_type& __key) const { return _M_ht.count(__key); } size_type count(const key_type& __key) const { return _M_ht.count(__key); }
pair<iterator, iterator> equal_range(const key_type& __key) const pair<iterator, iterator> equal_range(const key_type& __key) const
{ return _M_ht.equal_range(__key); } { return _M_ht.equal_range(__key); }
...@@ -354,7 +354,7 @@ public: ...@@ -354,7 +354,7 @@ public:
}; };
template <class _Val, class _HashFcn, class _EqualKey, class _Alloc> template <class _Val, class _HashFcn, class _EqualKey, class _Alloc>
inline bool inline bool
operator==(const hash_multiset<_Val,_HashFcn,_EqualKey,_Alloc>& __hs1, operator==(const hash_multiset<_Val,_HashFcn,_EqualKey,_Alloc>& __hs1,
const hash_multiset<_Val,_HashFcn,_EqualKey,_Alloc>& __hs2) const hash_multiset<_Val,_HashFcn,_EqualKey,_Alloc>& __hs2)
{ {
...@@ -362,14 +362,14 @@ operator==(const hash_multiset<_Val,_HashFcn,_EqualKey,_Alloc>& __hs1, ...@@ -362,14 +362,14 @@ operator==(const hash_multiset<_Val,_HashFcn,_EqualKey,_Alloc>& __hs1,
} }
template <class _Val, class _HashFcn, class _EqualKey, class _Alloc> template <class _Val, class _HashFcn, class _EqualKey, class _Alloc>
inline bool inline bool
operator!=(const hash_multiset<_Val,_HashFcn,_EqualKey,_Alloc>& __hs1, operator!=(const hash_multiset<_Val,_HashFcn,_EqualKey,_Alloc>& __hs1,
const hash_multiset<_Val,_HashFcn,_EqualKey,_Alloc>& __hs2) { const hash_multiset<_Val,_HashFcn,_EqualKey,_Alloc>& __hs2) {
return !(__hs1 == __hs2); return !(__hs1 == __hs2);
} }
template <class _Val, class _HashFcn, class _EqualKey, class _Alloc> template <class _Val, class _HashFcn, class _EqualKey, class _Alloc>
inline void inline void
swap(hash_multiset<_Val,_HashFcn,_EqualKey,_Alloc>& __hs1, swap(hash_multiset<_Val,_HashFcn,_EqualKey,_Alloc>& __hs1,
hash_multiset<_Val,_HashFcn,_EqualKey,_Alloc>& __hs2) { hash_multiset<_Val,_HashFcn,_EqualKey,_Alloc>& __hs2) {
__hs1.swap(__hs2); __hs1.swap(__hs2);
...@@ -399,7 +399,7 @@ public: ...@@ -399,7 +399,7 @@ public:
insert_iterator(_Container& __x, typename _Container::iterator) insert_iterator(_Container& __x, typename _Container::iterator)
: container(&__x) {} : container(&__x) {}
insert_iterator<_Container>& insert_iterator<_Container>&
operator=(const typename _Container::value_type& __value) { operator=(const typename _Container::value_type& __value) {
container->insert(__value); container->insert(__value);
return *this; return *this;
} }
...@@ -426,7 +426,7 @@ public: ...@@ -426,7 +426,7 @@ public:
insert_iterator(_Container& __x, typename _Container::iterator) insert_iterator(_Container& __x, typename _Container::iterator)
: container(&__x) {} : container(&__x) {}
insert_iterator<_Container>& insert_iterator<_Container>&
operator=(const typename _Container::value_type& __value) { operator=(const typename _Container::value_type& __value) {
container->insert(__value); container->insert(__value);
return *this; return *this;
} }
...@@ -436,4 +436,4 @@ public: ...@@ -436,4 +436,4 @@ public:
}; };
} // namespace std } // namespace std
#endif #endif
...@@ -90,7 +90,7 @@ struct _Hashtable_node ...@@ -90,7 +90,7 @@ struct _Hashtable_node
{ {
_Hashtable_node* _M_next; _Hashtable_node* _M_next;
_Val _M_val; _Val _M_val;
}; };
template <class _Val, class _Key, class _HashFcn, template <class _Val, class _Key, class _HashFcn,
class _ExtractKey, class _EqualKey, class _Alloc = std::__alloc> class _ExtractKey, class _EqualKey, class _Alloc = std::__alloc>
...@@ -109,10 +109,10 @@ template <class _Val, class _Key, class _HashFcn, ...@@ -109,10 +109,10 @@ template <class _Val, class _Key, class _HashFcn,
struct _Hashtable_iterator { struct _Hashtable_iterator {
typedef hashtable<_Val,_Key,_HashFcn,_ExtractKey,_EqualKey,_Alloc> typedef hashtable<_Val,_Key,_HashFcn,_ExtractKey,_EqualKey,_Alloc>
_Hashtable; _Hashtable;
typedef _Hashtable_iterator<_Val, _Key, _HashFcn, typedef _Hashtable_iterator<_Val, _Key, _HashFcn,
_ExtractKey, _EqualKey, _Alloc> _ExtractKey, _EqualKey, _Alloc>
iterator; iterator;
typedef _Hashtable_const_iterator<_Val, _Key, _HashFcn, typedef _Hashtable_const_iterator<_Val, _Key, _HashFcn,
_ExtractKey, _EqualKey, _Alloc> _ExtractKey, _EqualKey, _Alloc>
const_iterator; const_iterator;
typedef _Hashtable_node<_Val> _Node; typedef _Hashtable_node<_Val> _Node;
...@@ -127,7 +127,7 @@ struct _Hashtable_iterator { ...@@ -127,7 +127,7 @@ struct _Hashtable_iterator {
_Node* _M_cur; _Node* _M_cur;
_Hashtable* _M_ht; _Hashtable* _M_ht;
_Hashtable_iterator(_Node* __n, _Hashtable* __tab) _Hashtable_iterator(_Node* __n, _Hashtable* __tab)
: _M_cur(__n), _M_ht(__tab) {} : _M_cur(__n), _M_ht(__tab) {}
_Hashtable_iterator() {} _Hashtable_iterator() {}
reference operator*() const { return _M_cur->_M_val; } reference operator*() const { return _M_cur->_M_val; }
...@@ -146,10 +146,10 @@ template <class _Val, class _Key, class _HashFcn, ...@@ -146,10 +146,10 @@ template <class _Val, class _Key, class _HashFcn,
struct _Hashtable_const_iterator { struct _Hashtable_const_iterator {
typedef hashtable<_Val,_Key,_HashFcn,_ExtractKey,_EqualKey,_Alloc> typedef hashtable<_Val,_Key,_HashFcn,_ExtractKey,_EqualKey,_Alloc>
_Hashtable; _Hashtable;
typedef _Hashtable_iterator<_Val,_Key,_HashFcn, typedef _Hashtable_iterator<_Val,_Key,_HashFcn,
_ExtractKey,_EqualKey,_Alloc> _ExtractKey,_EqualKey,_Alloc>
iterator; iterator;
typedef _Hashtable_const_iterator<_Val, _Key, _HashFcn, typedef _Hashtable_const_iterator<_Val, _Key, _HashFcn,
_ExtractKey, _EqualKey, _Alloc> _ExtractKey, _EqualKey, _Alloc>
const_iterator; const_iterator;
typedef _Hashtable_node<_Val> _Node; typedef _Hashtable_node<_Val> _Node;
...@@ -167,15 +167,15 @@ struct _Hashtable_const_iterator { ...@@ -167,15 +167,15 @@ struct _Hashtable_const_iterator {
_Hashtable_const_iterator(const _Node* __n, const _Hashtable* __tab) _Hashtable_const_iterator(const _Node* __n, const _Hashtable* __tab)
: _M_cur(__n), _M_ht(__tab) {} : _M_cur(__n), _M_ht(__tab) {}
_Hashtable_const_iterator() {} _Hashtable_const_iterator() {}
_Hashtable_const_iterator(const iterator& __it) _Hashtable_const_iterator(const iterator& __it)
: _M_cur(__it._M_cur), _M_ht(__it._M_ht) {} : _M_cur(__it._M_cur), _M_ht(__it._M_ht) {}
reference operator*() const { return _M_cur->_M_val; } reference operator*() const { return _M_cur->_M_val; }
pointer operator->() const { return &(operator*()); } pointer operator->() const { return &(operator*()); }
const_iterator& operator++(); const_iterator& operator++();
const_iterator operator++(int); const_iterator operator++(int);
bool operator==(const const_iterator& __it) const bool operator==(const const_iterator& __it) const
{ return _M_cur == __it._M_cur; } { return _M_cur == __it._M_cur; }
bool operator!=(const const_iterator& __it) const bool operator!=(const const_iterator& __it) const
{ return _M_cur != __it._M_cur; } { return _M_cur != __it._M_cur; }
}; };
...@@ -188,7 +188,7 @@ static const unsigned long __stl_prime_list[_S_num_primes] = ...@@ -188,7 +188,7 @@ static const unsigned long __stl_prime_list[_S_num_primes] =
1543ul, 3079ul, 6151ul, 12289ul, 24593ul, 1543ul, 3079ul, 6151ul, 12289ul, 24593ul,
49157ul, 98317ul, 196613ul, 393241ul, 786433ul, 49157ul, 98317ul, 196613ul, 393241ul, 786433ul,
1572869ul, 3145739ul, 6291469ul, 12582917ul, 25165843ul, 1572869ul, 3145739ul, 6291469ul, 12582917ul, 25165843ul,
50331653ul, 100663319ul, 201326611ul, 402653189ul, 805306457ul, 50331653ul, 100663319ul, 201326611ul, 402653189ul, 805306457ul,
1610612741ul, 3221225473ul, 4294967291ul 1610612741ul, 3221225473ul, 4294967291ul
}; };
...@@ -337,7 +337,7 @@ public: ...@@ -337,7 +337,7 @@ public:
} }
iterator begin() iterator begin()
{ {
for (size_type __n = 0; __n < _M_buckets.size(); ++__n) for (size_type __n = 0; __n < _M_buckets.size(); ++__n)
if (_M_buckets[__n]) if (_M_buckets[__n])
return iterator(_M_buckets[__n], this); return iterator(_M_buckets[__n], this);
...@@ -364,7 +364,7 @@ public: ...@@ -364,7 +364,7 @@ public:
size_type bucket_count() const { return _M_buckets.size(); } size_type bucket_count() const { return _M_buckets.size(); }
size_type max_bucket_count() const size_type max_bucket_count() const
{ return __stl_prime_list[(int)_S_num_primes - 1]; } { return __stl_prime_list[(int)_S_num_primes - 1]; }
size_type elems_in_bucket(size_type __bucket) const size_type elems_in_bucket(size_type __bucket) const
{ {
...@@ -388,7 +388,7 @@ public: ...@@ -388,7 +388,7 @@ public:
pair<iterator, bool> insert_unique_noresize(const value_type& __obj); pair<iterator, bool> insert_unique_noresize(const value_type& __obj);
iterator insert_equal_noresize(const value_type& __obj); iterator insert_equal_noresize(const value_type& __obj);
template <class _InputIterator> template <class _InputIterator>
void insert_unique(_InputIterator __f, _InputIterator __l) void insert_unique(_InputIterator __f, _InputIterator __l)
{ {
...@@ -439,7 +439,7 @@ public: ...@@ -439,7 +439,7 @@ public:
reference find_or_insert(const value_type& __obj); reference find_or_insert(const value_type& __obj);
iterator find(const key_type& __key) iterator find(const key_type& __key)
{ {
size_type __n = _M_bkt_num_key(__key); size_type __n = _M_bkt_num_key(__key);
_Node* __first; _Node* __first;
...@@ -448,7 +448,7 @@ public: ...@@ -448,7 +448,7 @@ public:
__first = __first->_M_next) __first = __first->_M_next)
{} {}
return iterator(__first, this); return iterator(__first, this);
} }
const_iterator find(const key_type& __key) const const_iterator find(const key_type& __key) const
{ {
...@@ -459,7 +459,7 @@ public: ...@@ -459,7 +459,7 @@ public:
__first = __first->_M_next) __first = __first->_M_next)
{} {}
return const_iterator(__first, this); return const_iterator(__first, this);
} }
size_type count(const key_type& __key) const size_type count(const key_type& __key) const
{ {
...@@ -472,10 +472,10 @@ public: ...@@ -472,10 +472,10 @@ public:
return __result; return __result;
} }
pair<iterator, iterator> pair<iterator, iterator>
equal_range(const key_type& __key); equal_range(const key_type& __key);
pair<const_iterator, const_iterator> pair<const_iterator, const_iterator>
equal_range(const key_type& __key) const; equal_range(const key_type& __key) const;
size_type erase(const key_type& __key); size_type erase(const key_type& __key);
...@@ -534,7 +534,7 @@ private: ...@@ -534,7 +534,7 @@ private:
__throw_exception_again; __throw_exception_again;
} }
} }
void _M_delete_node(_Node* __n) void _M_delete_node(_Node* __n)
{ {
_Destroy(&__n->_M_val); _Destroy(&__n->_M_val);
...@@ -548,7 +548,7 @@ private: ...@@ -548,7 +548,7 @@ private:
}; };
template <class _Val, class _Key, class _HF, class _ExK, class _EqK, template <class _Val, class _Key, class _HF, class _ExK, class _EqK,
class _All> class _All>
_Hashtable_iterator<_Val,_Key,_HF,_ExK,_EqK,_All>& _Hashtable_iterator<_Val,_Key,_HF,_ExK,_EqK,_All>&
_Hashtable_iterator<_Val,_Key,_HF,_ExK,_EqK,_All>::operator++() _Hashtable_iterator<_Val,_Key,_HF,_ExK,_EqK,_All>::operator++()
...@@ -563,7 +563,7 @@ _Hashtable_iterator<_Val,_Key,_HF,_ExK,_EqK,_All>::operator++() ...@@ -563,7 +563,7 @@ _Hashtable_iterator<_Val,_Key,_HF,_ExK,_EqK,_All>::operator++()
return *this; return *this;
} }
template <class _Val, class _Key, class _HF, class _ExK, class _EqK, template <class _Val, class _Key, class _HF, class _ExK, class _EqK,
class _All> class _All>
inline _Hashtable_iterator<_Val,_Key,_HF,_ExK,_EqK,_All> inline _Hashtable_iterator<_Val,_Key,_HF,_ExK,_EqK,_All>
_Hashtable_iterator<_Val,_Key,_HF,_ExK,_EqK,_All>::operator++(int) _Hashtable_iterator<_Val,_Key,_HF,_ExK,_EqK,_All>::operator++(int)
...@@ -573,7 +573,7 @@ _Hashtable_iterator<_Val,_Key,_HF,_ExK,_EqK,_All>::operator++(int) ...@@ -573,7 +573,7 @@ _Hashtable_iterator<_Val,_Key,_HF,_ExK,_EqK,_All>::operator++(int)
return __tmp; return __tmp;
} }
template <class _Val, class _Key, class _HF, class _ExK, class _EqK, template <class _Val, class _Key, class _HF, class _ExK, class _EqK,
class _All> class _All>
_Hashtable_const_iterator<_Val,_Key,_HF,_ExK,_EqK,_All>& _Hashtable_const_iterator<_Val,_Key,_HF,_ExK,_EqK,_All>&
_Hashtable_const_iterator<_Val,_Key,_HF,_ExK,_EqK,_All>::operator++() _Hashtable_const_iterator<_Val,_Key,_HF,_ExK,_EqK,_All>::operator++()
...@@ -588,7 +588,7 @@ _Hashtable_const_iterator<_Val,_Key,_HF,_ExK,_EqK,_All>::operator++() ...@@ -588,7 +588,7 @@ _Hashtable_const_iterator<_Val,_Key,_HF,_ExK,_EqK,_All>::operator++()
return *this; return *this;
} }
template <class _Val, class _Key, class _HF, class _ExK, class _EqK, template <class _Val, class _Key, class _HF, class _ExK, class _EqK,
class _All> class _All>
inline _Hashtable_const_iterator<_Val,_Key,_HF,_ExK,_EqK,_All> inline _Hashtable_const_iterator<_Val,_Key,_HF,_ExK,_EqK,_All>
_Hashtable_const_iterator<_Val,_Key,_HF,_ExK,_EqK,_All>::operator++(int) _Hashtable_const_iterator<_Val,_Key,_HF,_ExK,_EqK,_All>::operator++(int)
...@@ -632,7 +632,7 @@ bool operator==(const hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>& __ht1, ...@@ -632,7 +632,7 @@ bool operator==(const hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>& __ht1,
} }
} }
return true; return 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>
inline bool operator!=(const hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>& __ht1, inline bool operator!=(const hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>& __ht1,
...@@ -640,7 +640,7 @@ inline bool operator!=(const hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>& __ht1, ...@@ -640,7 +640,7 @@ inline bool operator!=(const hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>& __ht1,
return !(__ht1 == __ht2); return !(__ht1 == __ht2);
} }
template <class _Val, class _Key, class _HF, class _Extract, class _EqKey, template <class _Val, class _Key, class _HF, class _Extract, class _EqKey,
class _All> class _All>
inline void swap(hashtable<_Val, _Key, _HF, _Extract, _EqKey, _All>& __ht1, inline void swap(hashtable<_Val, _Key, _HF, _Extract, _EqKey, _All>& __ht1,
hashtable<_Val, _Key, _HF, _Extract, _EqKey, _All>& __ht2) { hashtable<_Val, _Key, _HF, _Extract, _EqKey, _All>& __ht2) {
...@@ -649,14 +649,14 @@ inline void swap(hashtable<_Val, _Key, _HF, _Extract, _EqKey, _All>& __ht1, ...@@ -649,14 +649,14 @@ inline void swap(hashtable<_Val, _Key, _HF, _Extract, _EqKey, _All>& __ht1,
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> 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)
{ {
const size_type __n = _M_bkt_num(__obj); const size_type __n = _M_bkt_num(__obj);
_Node* __first = _M_buckets[__n]; _Node* __first = _M_buckets[__n];
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 pair<iterator, bool>(iterator(__cur, this), false);
...@@ -668,14 +668,14 @@ hashtable<_Val,_Key,_HF,_Ex,_Eq,_All> ...@@ -668,14 +668,14 @@ hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>
} }
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>
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>
::insert_equal_noresize(const value_type& __obj) ::insert_equal_noresize(const value_type& __obj)
{ {
const size_type __n = _M_bkt_num(__obj); const size_type __n = _M_bkt_num(__obj);
_Node* __first = _M_buckets[__n]; _Node* __first = _M_buckets[__n];
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))) {
_Node* __tmp = _M_new_node(__obj); _Node* __tmp = _M_new_node(__obj);
__tmp->_M_next = __cur->_M_next; __tmp->_M_next = __cur->_M_next;
...@@ -692,7 +692,7 @@ hashtable<_Val,_Key,_HF,_Ex,_Eq,_All> ...@@ -692,7 +692,7 @@ hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>
} }
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>
typename hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::reference typename hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::reference
hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::find_or_insert(const value_type& __obj) hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::find_or_insert(const value_type& __obj)
{ {
resize(_M_num_elements + 1); resize(_M_num_elements + 1);
...@@ -713,7 +713,7 @@ hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::find_or_insert(const value_type& __obj) ...@@ -713,7 +713,7 @@ hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::find_or_insert(const value_type& __obj)
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, 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>::equal_range(const key_type& __key) hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::equal_range(const key_type& __key)
{ {
typedef pair<iterator, iterator> _Pii; typedef pair<iterator, iterator> _Pii;
...@@ -734,8 +734,8 @@ hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::equal_range(const key_type& __key) ...@@ -734,8 +734,8 @@ hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::equal_range(const key_type& __key)
} }
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, 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
{ {
...@@ -743,7 +743,7 @@ hashtable<_Val,_Key,_HF,_Ex,_Eq,_All> ...@@ -743,7 +743,7 @@ hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>
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] ; for (const _Node* __first = _M_buckets[__n] ;
__first; __first;
__first = __first->_M_next) { __first = __first->_M_next) {
if (_M_equals(_M_get_key(__first->_M_val), __key)) { if (_M_equals(_M_get_key(__first->_M_val), __key)) {
for (const _Node* __cur = __first->_M_next; for (const _Node* __cur = __first->_M_next;
...@@ -763,7 +763,7 @@ hashtable<_Val,_Key,_HF,_Ex,_Eq,_All> ...@@ -763,7 +763,7 @@ hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>
} }
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>
typename hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::size_type typename hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::size_type
hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::erase(const key_type& __key) hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::erase(const key_type& __key)
{ {
const size_type __n = _M_bkt_num_key(__key); const size_type __n = _M_bkt_num_key(__key);
...@@ -831,9 +831,9 @@ template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All> ...@@ -831,9 +831,9 @@ template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
void hashtable<_Val,_Key,_HF,_Ex,_Eq,_All> void hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>
::erase(iterator __first, iterator __last) ::erase(iterator __first, iterator __last)
{ {
size_type __f_bucket = __first._M_cur ? size_type __f_bucket = __first._M_cur ?
_M_bkt_num(__first._M_cur->_M_val) : _M_buckets.size(); _M_bkt_num(__first._M_cur->_M_val) : _M_buckets.size();
size_type __l_bucket = __last._M_cur ? size_type __l_bucket = __last._M_cur ?
_M_bkt_num(__last._M_cur->_M_val) : _M_buckets.size(); _M_bkt_num(__last._M_cur->_M_val) : _M_buckets.size();
if (__first._M_cur == __last._M_cur) if (__first._M_cur == __last._M_cur)
...@@ -886,7 +886,7 @@ void hashtable<_Val,_Key,_HF,_Ex,_Eq,_All> ...@@ -886,7 +886,7 @@ void hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>
_M_buckets[__bucket] = __first->_M_next; _M_buckets[__bucket] = __first->_M_next;
__first->_M_next = __tmp[__new_bucket]; __first->_M_next = __tmp[__new_bucket];
__tmp[__new_bucket] = __first; __tmp[__new_bucket] = __first;
__first = _M_buckets[__bucket]; __first = _M_buckets[__bucket];
} }
} }
_M_buckets.swap(__tmp); _M_buckets.swap(__tmp);
...@@ -914,8 +914,8 @@ void hashtable<_Val,_Key,_HF,_Ex,_Eq,_All> ...@@ -914,8 +914,8 @@ void hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>
_M_erase_bucket(__n, __last); _M_erase_bucket(__n, __last);
else { else {
_Node* __next; _Node* __next;
for (__next = __cur->_M_next; for (__next = __cur->_M_next;
__next != __first; __next != __first;
__cur = __next, __next = __cur->_M_next) __cur = __next, __next = __cur->_M_next)
; ;
while (__next != __last) { while (__next != __last) {
...@@ -956,7 +956,7 @@ void hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::clear() ...@@ -956,7 +956,7 @@ void hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::clear()
_M_num_elements = 0; _M_num_elements = 0;
} }
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>
void hashtable<_Val,_Key,_HF,_Ex,_Eq,_All> void hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>
::_M_copy_from(const hashtable& __ht) ::_M_copy_from(const hashtable& __ht)
...@@ -971,8 +971,8 @@ void hashtable<_Val,_Key,_HF,_Ex,_Eq,_All> ...@@ -971,8 +971,8 @@ void hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>
_Node* __local_copy = _M_new_node(__cur->_M_val); _Node* __local_copy = _M_new_node(__cur->_M_val);
_M_buckets[__i] = __local_copy; _M_buckets[__i] = __local_copy;
for (_Node* __next = __cur->_M_next; for (_Node* __next = __cur->_M_next;
__next; __next;
__cur = __next, __next = __cur->_M_next) { __cur = __next, __next = __cur->_M_next) {
__local_copy->_M_next = _M_new_node(__next->_M_val); __local_copy->_M_next = _M_new_node(__next->_M_val);
__local_copy = __local_copy->_M_next; __local_copy = __local_copy->_M_next;
......
...@@ -72,7 +72,7 @@ namespace __gnu_cxx ...@@ -72,7 +72,7 @@ namespace __gnu_cxx
// There are two signatures for distance. In addition to the one // There are two signatures for distance. In addition to the one
// taking two iterators and returning a result, there is another // taking two iterators and returning a result, there is another
// taking two iterators and a reference-to-result variable, and // taking two iterators and a reference-to-result variable, and
// returning nothing. The latter seems to be an SGI extension. // returning nothing. The latter seems to be an SGI extension.
// -- pedwards // -- pedwards
template<typename _InputIterator, typename _Distance> template<typename _InputIterator, typename _Distance>
inline void inline void
...@@ -86,7 +86,7 @@ namespace __gnu_cxx ...@@ -86,7 +86,7 @@ namespace __gnu_cxx
template<typename _RandomAccessIterator, typename _Distance> template<typename _RandomAccessIterator, typename _Distance>
inline void inline void
__distance(_RandomAccessIterator __first, _RandomAccessIterator __last, __distance(_RandomAccessIterator __first, _RandomAccessIterator __last,
_Distance& __n, std::random_access_iterator_tag) _Distance& __n, std::random_access_iterator_tag)
{ {
// concept requirements // concept requirements
...@@ -109,5 +109,5 @@ namespace __gnu_cxx ...@@ -109,5 +109,5 @@ namespace __gnu_cxx
} }
} // namespace __gnu_cxx } // namespace __gnu_cxx
#endif #endif
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
*/ */
/** @file ext/debug_allocator.h /** @file ext/debug_allocator.h
* This file is a GNU extension to the Standard C++ Library. * This file is a GNU extension to the Standard C++ Library.
* You should only include this header if you are using GCC 3 or later. * You should only include this header if you are using GCC 3 or later.
*/ */
...@@ -149,7 +149,7 @@ namespace std ...@@ -149,7 +149,7 @@ namespace std
/// Versions for the __allocator adaptor used with the predefined /// Versions for the __allocator adaptor used with the predefined
/// "SGI" style allocators. /// "SGI" style allocators.
template<typename _Tp, typename _Tp1, int __inst> template<typename _Tp, typename _Tp1, int __inst>
struct _Alloc_traits<_Tp, __allocator<_Tp1, struct _Alloc_traits<_Tp, __allocator<_Tp1,
__gnu_cxx::__malloc_alloc<__inst> > > __gnu_cxx::__malloc_alloc<__inst> > >
{ {
static const bool _S_instanceless = true; static const bool _S_instanceless = true;
......
...@@ -73,30 +73,30 @@ namespace __gnu_cxx ...@@ -73,30 +73,30 @@ namespace __gnu_cxx
using std::pair; using std::pair;
using std::__iterator_category; 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> 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)
{ {
_ForwardIter __cur = __result; _ForwardIter __cur = __result;
try try
{ {
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 pair<_InputIter, _ForwardIter>(__first, __cur);
} }
catch(...) catch(...)
{ {
std::_Destroy(__result, __cur); std::_Destroy(__result, __cur);
__throw_exception_again; __throw_exception_again;
} }
} }
template<typename _RandomAccessIter, typename _Size, typename _ForwardIter> template<typename _RandomAccessIter, typename _Size, typename _ForwardIter>
inline pair<_RandomAccessIter, _ForwardIter> inline 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;
...@@ -108,7 +108,7 @@ namespace __gnu_cxx ...@@ -108,7 +108,7 @@ namespace __gnu_cxx
template<typename _InputIter, typename _Size, typename _ForwardIter> template<typename _InputIter, typename _Size, typename _ForwardIter>
inline pair<_InputIter, _ForwardIter> inline pair<_InputIter, _ForwardIter>
__uninitialized_copy_n(_InputIter __first, _Size __count, __uninitialized_copy_n(_InputIter __first, _Size __count,
_ForwardIter __result) _ForwardIter __result)
{ {
return __uninitialized_copy_n(__first, __count, __result, return __uninitialized_copy_n(__first, __count, __result,
__iterator_category(__first)); __iterator_category(__first));
...@@ -127,7 +127,7 @@ namespace __gnu_cxx ...@@ -127,7 +127,7 @@ namespace __gnu_cxx
template<typename _InputIter, typename _Size, typename _ForwardIter> template<typename _InputIter, typename _Size, typename _ForwardIter>
inline pair<_InputIter, _ForwardIter> inline pair<_InputIter, _ForwardIter>
uninitialized_copy_n(_InputIter __first, _Size __count, uninitialized_copy_n(_InputIter __first, _Size __count,
_ForwardIter __result) _ForwardIter __result)
{ {
return __uninitialized_copy_n(__first, __count, __result, return __uninitialized_copy_n(__first, __count, __result,
__iterator_category(__first)); __iterator_category(__first));
...@@ -154,7 +154,7 @@ namespace __gnu_cxx ...@@ -154,7 +154,7 @@ namespace __gnu_cxx
* *
* @ingroup SGIextensions * @ingroup SGIextensions
*/ */
template <class _ForwardIterator, class _Tp template <class _ForwardIterator, class _Tp
= typename std::iterator_traits<_ForwardIterator>::value_type > = typename std::iterator_traits<_ForwardIterator>::value_type >
struct temporary_buffer : public _Temporary_buffer<_ForwardIterator, _Tp> struct temporary_buffer : public _Temporary_buffer<_ForwardIterator, _Tp>
{ {
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
// the GNU General Public License. // the GNU General Public License.
/** @file ext/mt_allocator.h /** @file ext/mt_allocator.h
* This file is a GNU extension to the Standard C++ Library. * This file is a GNU extension to the Standard C++ Library.
* You should only include this header if you are using GCC 3 or later. * You should only include this header if you are using GCC 3 or later.
*/ */
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
#define _MT_ALLOCATOR_H 1 #define _MT_ALLOCATOR_H 1
#include <cstdlib> #include <cstdlib>
#include <bits/functexcept.h> #include <bits/functexcept.h>
#include <bits/gthr.h> #include <bits/gthr.h>
#include <bits/atomicity.h> #include <bits/atomicity.h>
#include <bits/allocator_traits.h> #include <bits/allocator_traits.h>
...@@ -64,8 +64,8 @@ namespace __gnu_cxx ...@@ -64,8 +64,8 @@ namespace __gnu_cxx
private: private:
/* /*
* We need to create the initial lists and set up some variables * We need to create the initial lists and set up some variables
* before we can answer to the first request for memory. * before we can answer to the first request for memory.
* The initialization of these variables is done at file scope * The initialization of these variables is done at file scope
* below class declaration. * below class declaration.
*/ */
#ifdef __GTHREADS #ifdef __GTHREADS
...@@ -93,7 +93,7 @@ namespace __gnu_cxx ...@@ -93,7 +93,7 @@ namespace __gnu_cxx
static size_t _S_freelist_headroom; static size_t _S_freelist_headroom;
/* /*
* Each requesting thread is assigned an id ranging from 1 to * Each requesting thread is assigned an id ranging from 1 to
* _S_max_threads. Thread id 0 is used as a global memory pool. * _S_max_threads. Thread id 0 is used as a global memory pool.
* In order to get constant performance on the thread assignment * In order to get constant performance on the thread assignment
* routine, we keep a list of free ids. When a thread first requests * routine, we keep a list of free ids. When a thread first requests
...@@ -141,8 +141,8 @@ namespace __gnu_cxx ...@@ -141,8 +141,8 @@ namespace __gnu_cxx
struct bin_record struct bin_record
{ {
/* /*
* An "array" of pointers to the first/last free block for each * An "array" of pointers to the first/last free block for each
* thread id. Memory to these "arrays" is allocated in _S_init() * thread id. Memory to these "arrays" is allocated in _S_init()
* for _S_max_threads + global pool 0. * for _S_max_threads + global pool 0.
*/ */
block_record** first; block_record** first;
...@@ -151,24 +151,24 @@ namespace __gnu_cxx ...@@ -151,24 +151,24 @@ namespace __gnu_cxx
/* /*
* An "array" of counters used to keep track of the amount of blocks * An "array" of counters used to keep track of the amount of blocks
* that are on the freelist/used for each thread id. * that are on the freelist/used for each thread id.
* Memory to these "arrays" is allocated in _S_init() * Memory to these "arrays" is allocated in _S_init()
* for _S_max_threads + global pool 0. * for _S_max_threads + global pool 0.
*/ */
size_t* free; size_t* free;
size_t* used; size_t* used;
/* /*
* Each bin has its own mutex which is used to ensure data integrity * Each bin has its own mutex which is used to ensure data integrity
* while changing "ownership" on a block. * while changing "ownership" on a block.
* The mutex is initialized in _S_init(). * The mutex is initialized in _S_init().
*/ */
#ifdef __GTHREADS #ifdef __GTHREADS
__gthread_mutex_t* mutex; __gthread_mutex_t* mutex;
#endif #endif
}; };
/* /*
* An "array" of bin_records each of which represents a specific * An "array" of bin_records each of which represents a specific
* power of 2 size. Memory to this "array" is allocated in _S_init(). * power of 2 size. Memory to this "array" is allocated in _S_init().
*/ */
static bin_record* _S_bin; static bin_record* _S_bin;
...@@ -185,7 +185,7 @@ namespace __gnu_cxx ...@@ -185,7 +185,7 @@ namespace __gnu_cxx
if (__n > _S_max_bytes) if (__n > _S_max_bytes)
{ {
void* __ret = malloc(__n); void* __ret = malloc(__n);
if (!__ret) if (!__ret)
__throw_bad_alloc(); __throw_bad_alloc();
return __ret; return __ret;
...@@ -233,12 +233,12 @@ namespace __gnu_cxx ...@@ -233,12 +233,12 @@ namespace __gnu_cxx
{ {
/* /*
* Are we using threads? * Are we using threads?
* - Yes, lock and check if there are free blocks on the global * - Yes, lock and check if there are free blocks on the global
* list (and if not add new ones), get the first one * list (and if not add new ones), get the first one
* and change owner. * and change owner.
* - No, all operations are made directly to global pool 0 * - No, all operations are made directly to global pool 0
* no need to lock or change ownership but check for free * no need to lock or change ownership but check for free
* blocks on global list (and if not add new ones) and * blocks on global list (and if not add new ones) and
* get the first one. * get the first one.
*/ */
#ifdef __GTHREADS #ifdef __GTHREADS
...@@ -248,7 +248,7 @@ namespace __gnu_cxx ...@@ -248,7 +248,7 @@ namespace __gnu_cxx
if (_S_bin[bin].first[0] == NULL) if (_S_bin[bin].first[0] == NULL)
{ {
_S_bin[bin].first[0] = _S_bin[bin].first[0] =
(block_record*)malloc(_S_chunk_size); (block_record*)malloc(_S_chunk_size);
if (!_S_bin[bin].first[0]) if (!_S_bin[bin].first[0])
...@@ -258,7 +258,7 @@ namespace __gnu_cxx ...@@ -258,7 +258,7 @@ namespace __gnu_cxx
} }
size_t bin_t = 1 << bin; size_t bin_t = 1 << bin;
size_t block_count = size_t block_count =
_S_chunk_size /(bin_t + sizeof(block_record)); _S_chunk_size /(bin_t + sizeof(block_record));
_S_bin[bin].free[0] = block_count; _S_bin[bin].free[0] = block_count;
...@@ -268,7 +268,7 @@ namespace __gnu_cxx ...@@ -268,7 +268,7 @@ namespace __gnu_cxx
while (block_count > 0) while (block_count > 0)
{ {
block->next = (block_record*)((char*)block + block->next = (block_record*)((char*)block +
(bin_t + sizeof(block_record))); (bin_t + sizeof(block_record)));
block = block->next; block = block->next;
block_count--; block_count--;
...@@ -302,11 +302,11 @@ namespace __gnu_cxx ...@@ -302,11 +302,11 @@ namespace __gnu_cxx
{ {
_S_bin[bin].first[0] = (block_record*)malloc(_S_chunk_size); _S_bin[bin].first[0] = (block_record*)malloc(_S_chunk_size);
if (!_S_bin[bin].first[0]) if (!_S_bin[bin].first[0])
__throw_bad_alloc(); __throw_bad_alloc();
size_t bin_t = 1 << bin; size_t bin_t = 1 << bin;
size_t block_count = size_t block_count =
_S_chunk_size / (bin_t + sizeof(block_record)); _S_chunk_size / (bin_t + sizeof(block_record));
_S_bin[bin].free[0] = block_count; _S_bin[bin].free[0] = block_count;
...@@ -316,7 +316,7 @@ namespace __gnu_cxx ...@@ -316,7 +316,7 @@ namespace __gnu_cxx
while (block_count > 0) while (block_count > 0)
{ {
block->next = (block_record*)((char*)block + block->next = (block_record*)((char*)block +
(bin_t + sizeof(block_record))); (bin_t + sizeof(block_record)));
block = block->next; block = block->next;
block_count--; block_count--;
...@@ -335,7 +335,7 @@ namespace __gnu_cxx ...@@ -335,7 +335,7 @@ namespace __gnu_cxx
_S_bin[bin].free[0]--; _S_bin[bin].free[0]--;
_S_bin[bin].used[0]++; _S_bin[bin].used[0]++;
} }
} }
else else
{ {
/* /*
...@@ -376,7 +376,7 @@ namespace __gnu_cxx ...@@ -376,7 +376,7 @@ namespace __gnu_cxx
size_t thread_id = 0; size_t thread_id = 0;
#endif #endif
block_record* block = (block_record*)((char*)__p block_record* block = (block_record*)((char*)__p
- sizeof(block_record)); - sizeof(block_record));
/* /*
...@@ -391,7 +391,7 @@ namespace __gnu_cxx ...@@ -391,7 +391,7 @@ namespace __gnu_cxx
/* /*
* Calculate the number of records to remove from our freelist * Calculate the number of records to remove from our freelist
*/ */
int remove = _S_bin[bin].free[thread_id] - int remove = _S_bin[bin].free[thread_id] -
(_S_bin[bin].used[thread_id] / _S_freelist_headroom); (_S_bin[bin].used[thread_id] / _S_freelist_headroom);
/* /*
...@@ -400,8 +400,8 @@ namespace __gnu_cxx ...@@ -400,8 +400,8 @@ namespace __gnu_cxx
* too much contention when locking and therefore we * too much contention when locking and therefore we
* wait until the number of records is "high enough". * wait until the number of records is "high enough".
*/ */
if (remove > (int)(100 * (_S_no_of_bins - bin)) && if (remove > (int)(100 * (_S_no_of_bins - bin)) &&
remove > (int)(_S_bin[bin].free[thread_id] / remove > (int)(_S_bin[bin].free[thread_id] /
_S_freelist_headroom)) _S_freelist_headroom))
{ {
__gthread_mutex_lock(_S_bin[bin].mutex); __gthread_mutex_lock(_S_bin[bin].mutex);
...@@ -415,7 +415,7 @@ namespace __gnu_cxx ...@@ -415,7 +415,7 @@ namespace __gnu_cxx
_S_bin[bin].last[0] = _S_bin[bin].first[thread_id]; _S_bin[bin].last[0] = _S_bin[bin].first[thread_id];
_S_bin[bin].first[thread_id] = _S_bin[bin].first[thread_id] =
_S_bin[bin].first[thread_id]->next; _S_bin[bin].first[thread_id]->next;
_S_bin[bin].free[0]++; _S_bin[bin].free[0]++;
...@@ -506,7 +506,7 @@ namespace __gnu_cxx ...@@ -506,7 +506,7 @@ namespace __gnu_cxx
_S_binmap = (binmap_type*) _S_binmap = (binmap_type*)
malloc ((_S_max_bytes + 1) * sizeof(binmap_type)); malloc ((_S_max_bytes + 1) * sizeof(binmap_type));
if (!_S_binmap) if (!_S_binmap)
__throw_bad_alloc(); __throw_bad_alloc();
binmap_type* bp_t = _S_binmap; binmap_type* bp_t = _S_binmap;
...@@ -530,20 +530,20 @@ namespace __gnu_cxx ...@@ -530,20 +530,20 @@ namespace __gnu_cxx
#ifdef __GTHREADS #ifdef __GTHREADS
if (__gthread_active_p()) if (__gthread_active_p())
{ {
_S_thread_freelist_first = _S_thread_freelist_first =
(thread_record*)malloc(sizeof(thread_record) * _S_max_threads); (thread_record*)malloc(sizeof(thread_record) * _S_max_threads);
if (!_S_thread_freelist_first) if (!_S_thread_freelist_first)
__throw_bad_alloc(); __throw_bad_alloc();
/* /*
* NOTE! The first assignable thread id is 1 since the global * NOTE! The first assignable thread id is 1 since the global
* pool uses id 0 * pool uses id 0
*/ */
size_t i; size_t i;
for (i = 1; i < _S_max_threads; i++) for (i = 1; i < _S_max_threads; i++)
{ {
_S_thread_freelist_first[i - 1].next = _S_thread_freelist_first[i - 1].next =
&_S_thread_freelist_first[i]; &_S_thread_freelist_first[i];
_S_thread_freelist_first[i - 1].id = i; _S_thread_freelist_first[i - 1].id = i;
...@@ -575,7 +575,7 @@ namespace __gnu_cxx ...@@ -575,7 +575,7 @@ namespace __gnu_cxx
*/ */
_S_bin = (bin_record*)malloc(sizeof(bin_record) * _S_no_of_bins); _S_bin = (bin_record*)malloc(sizeof(bin_record) * _S_no_of_bins);
if (!_S_bin) if (!_S_bin)
__throw_bad_alloc(); __throw_bad_alloc();
for (size_t bin = 0; bin < _S_no_of_bins; bin++) for (size_t bin = 0; bin < _S_no_of_bins; bin++)
...@@ -583,25 +583,25 @@ namespace __gnu_cxx ...@@ -583,25 +583,25 @@ namespace __gnu_cxx
_S_bin[bin].first = (block_record**) _S_bin[bin].first = (block_record**)
malloc(sizeof(block_record*) * (_S_max_threads + 1)); malloc(sizeof(block_record*) * (_S_max_threads + 1));
if (!_S_bin[bin].first) if (!_S_bin[bin].first)
__throw_bad_alloc(); __throw_bad_alloc();
_S_bin[bin].last = (block_record**) _S_bin[bin].last = (block_record**)
malloc(sizeof(block_record*) * (_S_max_threads + 1)); malloc(sizeof(block_record*) * (_S_max_threads + 1));
if (!_S_bin[bin].last) if (!_S_bin[bin].last)
__throw_bad_alloc(); __throw_bad_alloc();
_S_bin[bin].free = (size_t*) _S_bin[bin].free = (size_t*)
malloc(sizeof(size_t) * (_S_max_threads + 1)); malloc(sizeof(size_t) * (_S_max_threads + 1));
if (!_S_bin[bin].free) if (!_S_bin[bin].free)
__throw_bad_alloc(); __throw_bad_alloc();
_S_bin[bin].used = (size_t*) _S_bin[bin].used = (size_t*)
malloc(sizeof(size_t) * (_S_max_threads + 1)); malloc(sizeof(size_t) * (_S_max_threads + 1));
if (!_S_bin[bin].used) if (!_S_bin[bin].used)
__throw_bad_alloc(); __throw_bad_alloc();
/* /*
...@@ -609,10 +609,10 @@ namespace __gnu_cxx ...@@ -609,10 +609,10 @@ namespace __gnu_cxx
* a parser problem - see PR c++/9779 for more info. * a parser problem - see PR c++/9779 for more info.
*/ */
#ifdef __GTHREADS #ifdef __GTHREADS
size_t s = sizeof(__gthread_mutex_t); size_t s = sizeof(__gthread_mutex_t);
_S_bin[bin].mutex = (__gthread_mutex_t*)malloc(s); _S_bin[bin].mutex = (__gthread_mutex_t*)malloc(s);
if (!_S_bin[bin].mutex) if (!_S_bin[bin].mutex)
__throw_bad_alloc(); __throw_bad_alloc();
#ifdef __GTHREAD_MUTEX_INIT #ifdef __GTHREAD_MUTEX_INIT
...@@ -656,7 +656,7 @@ namespace __gnu_cxx ...@@ -656,7 +656,7 @@ namespace __gnu_cxx
*/ */
for (size_t bin = 0; bin < _S_no_of_bins; bin++) for (size_t bin = 0; bin < _S_no_of_bins; bin++)
{ {
block_record* block = block_record* block =
_S_bin[bin].first[((thread_record*)freelist_pos)->id]; _S_bin[bin].first[((thread_record*)freelist_pos)->id];
if (block != NULL) if (block != NULL)
...@@ -711,7 +711,7 @@ namespace __gnu_cxx ...@@ -711,7 +711,7 @@ namespace __gnu_cxx
{ {
thread_record* freelist_pos; thread_record* freelist_pos;
if ((freelist_pos = if ((freelist_pos =
(thread_record*)__gthread_getspecific(_S_thread_key)) == NULL) (thread_record*)__gthread_getspecific(_S_thread_key)) == NULL)
{ {
__gthread_mutex_lock(&_S_thread_freelist_mutex); __gthread_mutex_lock(&_S_thread_freelist_mutex);
...@@ -742,7 +742,7 @@ namespace __gnu_cxx ...@@ -742,7 +742,7 @@ namespace __gnu_cxx
_S_bin[bin].last[freelist_pos->id] = NULL; _S_bin[bin].last[freelist_pos->id] = NULL;
_S_bin[bin].free[freelist_pos->id] = 0; _S_bin[bin].free[freelist_pos->id] = 0;
} }
} }
return freelist_pos->id; return freelist_pos->id;
} }
...@@ -851,7 +851,7 @@ namespace std ...@@ -851,7 +851,7 @@ namespace std
}; };
template<typename _Tp, typename _Tp1, int __inst> template<typename _Tp, typename _Tp1, int __inst>
struct _Alloc_traits<_Tp, struct _Alloc_traits<_Tp,
__allocator<_Tp1, __gnu_cxx::__mt_alloc<__inst> > > __allocator<_Tp1, __gnu_cxx::__mt_alloc<__inst> > >
{ {
static const bool _S_instanceless = true; static const bool _S_instanceless = true;
......
...@@ -72,7 +72,7 @@ ...@@ -72,7 +72,7 @@
namespace __gnu_cxx namespace __gnu_cxx
{ {
// Returns __x ** __n, where __n >= 0. _Note that "multiplication" // Returns __x ** __n, where __n >= 0. _Note that "multiplication"
// is required to be associative, but not necessarily commutative. // is required to be associative, but not necessarily commutative.
template<typename _Tp, typename _Integer, typename _MonoidOperation> template<typename _Tp, typename _Integer, typename _MonoidOperation>
_Tp _Tp
__power(_Tp __x, _Integer __n, _MonoidOperation __monoid_op) __power(_Tp __x, _Integer __n, _MonoidOperation __monoid_op)
...@@ -131,7 +131,7 @@ namespace __gnu_cxx ...@@ -131,7 +131,7 @@ namespace __gnu_cxx
*/ */
// iota is not part of the C++ standard. It is an extension. // iota is not part of the C++ standard. 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)
{ {
// concept requirements // concept requirements
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
#ifndef _POD_CHAR_TRAITS_H #ifndef _POD_CHAR_TRAITS_H
#define _POD_CHAR_TRAITS_H 1 #define _POD_CHAR_TRAITS_H 1
#include <string> #include <string>
namespace __gnu_cxx namespace __gnu_cxx
...@@ -40,19 +40,19 @@ namespace __gnu_cxx ...@@ -40,19 +40,19 @@ namespace __gnu_cxx
template<typename V, typename I, typename S = mbstate_t> template<typename V, typename I, typename S = mbstate_t>
struct character struct character
{ {
typedef V value_type; typedef V value_type;
typedef I int_type; typedef I int_type;
typedef S state_type; typedef S state_type;
value_type value; value_type value;
}; };
template<typename V, typename I> template<typename V, typename I>
inline bool inline bool
operator==(const character<V, I>& lhs, const character<V, I>& rhs) operator==(const character<V, I>& lhs, const character<V, I>& rhs)
{ return lhs.value == rhs.value; } { return lhs.value == rhs.value; }
template<typename V, typename I> template<typename V, typename I>
inline bool inline bool
operator<(const character<V, I>& lhs, const character<V, I>& rhs) operator<(const character<V, I>& lhs, const character<V, I>& rhs)
{ return lhs.value < rhs.value; } { return lhs.value < rhs.value; }
} // namespace __gnu_cxx } // namespace __gnu_cxx
...@@ -63,93 +63,93 @@ namespace std ...@@ -63,93 +63,93 @@ namespace std
template<typename V, typename I, typename S> template<typename V, typename I, typename S>
struct char_traits<__gnu_cxx::character<V, I, S> > struct char_traits<__gnu_cxx::character<V, I, S> >
{ {
typedef __gnu_cxx::character<V, I, S> char_type; typedef __gnu_cxx::character<V, I, S> char_type;
// NB: This type should be bigger than char_type, so as to // NB: This type should be bigger than char_type, so as to
// properly hold EOF values in addition to the full range of // properly hold EOF values in addition to the full range of
// char_type values. // char_type values.
// Also, assumes // Also, assumes
// int_type(value_type) is valid. // int_type(value_type) is valid.
// int_type(-1) is possible. // int_type(-1) is possible.
typedef typename char_type::int_type int_type; typedef typename char_type::int_type int_type;
typedef typename char_type::state_type state_type; typedef typename char_type::state_type state_type;
typedef fpos<state_type> pos_type; typedef fpos<state_type> pos_type;
typedef streamoff off_type; typedef streamoff off_type;
static void static void
assign(char_type& __c1, const char_type& __c2) assign(char_type& __c1, const char_type& __c2)
{ __c1 = __c2; } { __c1 = __c2; }
static bool static bool
eq(const char_type& __c1, const char_type& __c2) eq(const char_type& __c1, const char_type& __c2)
{ return __c1 == __c2; } { return __c1 == __c2; }
static bool static bool
lt(const char_type& __c1, const char_type& __c2) lt(const char_type& __c1, const char_type& __c2)
{ return __c1 < __c2; } { return __c1 < __c2; }
static int static int
compare(const char_type* __s1, const char_type* __s2, size_t __n) compare(const char_type* __s1, const char_type* __s2, size_t __n)
{ {
for (size_t __i = 0; __i < __n; ++__i) for (size_t __i = 0; __i < __n; ++__i)
if (!eq(__s1[__i], __s2[__i])) if (!eq(__s1[__i], __s2[__i]))
return lt(__s1[__i], __s2[__i]) ? -1 : 1; return lt(__s1[__i], __s2[__i]) ? -1 : 1;
return 0; return 0;
} }
static size_t static size_t
length(const char_type* __s) length(const char_type* __s)
{ {
const char_type* __p = __s; const char_type* __p = __s;
while (__p->value) while (__p->value)
++__p; ++__p;
return (__p - __s); return (__p - __s);
} }
static const char_type* static const char_type*
find(const char_type* __s, size_t __n, const char_type& __a) find(const char_type* __s, size_t __n, const char_type& __a)
{ {
for (const char_type* __p = __s; size_t(__p - __s) < __n; ++__p) for (const char_type* __p = __s; size_t(__p - __s) < __n; ++__p)
if (*__p == __a) if (*__p == __a)
return __p; return __p;
return 0; return 0;
} }
static char_type* static char_type*
move(char_type* __s1, const char_type* __s2, size_t __n) move(char_type* __s1, const char_type* __s2, size_t __n)
{ return (char_type*) memmove(__s1, __s2, __n * sizeof(char_type)); } { return (char_type*) memmove(__s1, __s2, __n * sizeof(char_type)); }
static char_type* static char_type*
copy(char_type* __s1, const char_type* __s2, size_t __n) copy(char_type* __s1, const char_type* __s2, size_t __n)
{ return (char_type*) memcpy(__s1, __s2, __n * sizeof(char_type)); } { return (char_type*) memcpy(__s1, __s2, __n * sizeof(char_type)); }
static char_type* static char_type*
assign(char_type* __s, size_t __n, char_type __a) assign(char_type* __s, size_t __n, char_type __a)
{ {
for (char_type* __p = __s; __p < __s + __n; ++__p) for (char_type* __p = __s; __p < __s + __n; ++__p)
assign(*__p, __a); assign(*__p, __a);
return __s; return __s;
} }
static char_type static char_type
to_char_type(const int_type& __c) to_char_type(const int_type& __c)
{ {
char_type __r = { __c }; char_type __r = { __c };
return __r; return __r;
} }
static int_type static int_type
to_int_type(const char_type& __c) to_int_type(const char_type& __c)
{ return int_type(__c.value); } { return int_type(__c.value); }
static bool static bool
eq_int_type(const int_type& __c1, const int_type& __c2) eq_int_type(const int_type& __c1, const int_type& __c2)
{ return __c1 == __c2; } { return __c1 == __c2; }
static int_type static int_type
eof() { return static_cast<int_type>(-1); } eof() { return static_cast<int_type>(-1); }
static int_type static int_type
not_eof(const int_type& __c) not_eof(const int_type& __c)
{ return eq_int_type(__c, eof()) ? int_type(0) : __c; } { return eq_int_type(__c, eof()) ? int_type(0) : __c; }
}; };
......
...@@ -41,14 +41,14 @@ ...@@ -41,14 +41,14 @@
*/ */
/** @file ext/debug_allocator.h /** @file ext/debug_allocator.h
* This file is a GNU extension to the Standard C++ Library. * This file is a GNU extension to the Standard C++ Library.
* You should only include this header if you are using GCC 3 or later. * You should only include this header if you are using GCC 3 or later.
*/ */
#ifndef _POOL_ALLOCATOR_H #ifndef _POOL_ALLOCATOR_H
#define _POOL_ALLOCATOR_H 1 #define _POOL_ALLOCATOR_H 1
#include <bits/functexcept.h> #include <bits/functexcept.h>
#include <bits/stl_threads.h> #include <bits/stl_threads.h>
#include <bits/atomicity.h> #include <bits/atomicity.h>
#include <bits/allocator_traits.h> #include <bits/allocator_traits.h>
...@@ -111,7 +111,7 @@ namespace __gnu_cxx ...@@ -111,7 +111,7 @@ namespace __gnu_cxx
static size_t _S_heap_size; static size_t _S_heap_size;
static _STL_mutex_lock _S_lock; static _STL_mutex_lock _S_lock;
static _Atomic_word _S_force_new; static _Atomic_word _S_force_new;
static size_t static size_t
_S_round_up(size_t __bytes) _S_round_up(size_t __bytes)
...@@ -152,7 +152,7 @@ namespace __gnu_cxx ...@@ -152,7 +152,7 @@ namespace __gnu_cxx
template<bool __threads, int __inst> template<bool __threads, int __inst>
inline bool inline bool
operator==(const __pool_alloc<__threads,__inst>&, operator==(const __pool_alloc<__threads,__inst>&,
const __pool_alloc<__threads,__inst>&) const __pool_alloc<__threads,__inst>&)
{ return true; } { return true; }
...@@ -289,7 +289,7 @@ namespace __gnu_cxx ...@@ -289,7 +289,7 @@ namespace __gnu_cxx
else else
__atomic_add(&_S_force_new, -1); __atomic_add(&_S_force_new, -1);
} }
if ((__n > (size_t) _S_max_bytes) || (_S_force_new > 0)) if ((__n > (size_t) _S_max_bytes) || (_S_force_new > 0))
__ret = __new_alloc::allocate(__n); __ret = __new_alloc::allocate(__n);
else else
...@@ -306,13 +306,13 @@ namespace __gnu_cxx ...@@ -306,13 +306,13 @@ namespace __gnu_cxx
{ {
*__free_list = __result -> _M_free_list_link; *__free_list = __result -> _M_free_list_link;
__ret = __result; __ret = __result;
} }
if (__builtin_expect(__ret == 0, 0)) if (__builtin_expect(__ret == 0, 0))
__throw_bad_alloc(); __throw_bad_alloc();
} }
return __ret; return __ret;
} }
template<bool __threads, int __inst> template<bool __threads, int __inst>
void void
__pool_alloc<__threads, __inst>::deallocate(void* __p, size_t __n) __pool_alloc<__threads, __inst>::deallocate(void* __p, size_t __n)
...@@ -323,7 +323,7 @@ namespace __gnu_cxx ...@@ -323,7 +323,7 @@ namespace __gnu_cxx
{ {
_Obj* volatile* __free_list = _S_free_list + _S_freelist_index(__n); _Obj* volatile* __free_list = _S_free_list + _S_freelist_index(__n);
_Obj* __q = (_Obj*)__p; _Obj* __q = (_Obj*)__p;
// Acquire the lock here with a constructor call. This // Acquire the lock here with a constructor call. This
// ensures that it is released in exit or during stack // ensures that it is released in exit or during stack
// unwinding. // unwinding.
...@@ -368,9 +368,9 @@ namespace std ...@@ -368,9 +368,9 @@ namespace std
template<typename _Tp, bool __thr, int __inst> template<typename _Tp, bool __thr, int __inst>
struct _Alloc_traits<_Tp, __gnu_cxx::__pool_alloc<__thr, __inst> > struct _Alloc_traits<_Tp, __gnu_cxx::__pool_alloc<__thr, __inst> >
{ {
static const bool _S_instanceless = true; static const bool _S_instanceless = true;
typedef __gnu_cxx::__pool_alloc<__thr, __inst> base_alloc_type; typedef __gnu_cxx::__pool_alloc<__thr, __inst> base_alloc_type;
typedef __simple_alloc<_Tp, base_alloc_type> _Alloc_type; typedef __simple_alloc<_Tp, base_alloc_type> _Alloc_type;
typedef __allocator<_Tp, base_alloc_type> allocator_type; typedef __allocator<_Tp, base_alloc_type> allocator_type;
}; };
//@} //@}
...@@ -379,11 +379,11 @@ namespace std ...@@ -379,11 +379,11 @@ namespace std
/// Versions for the __allocator adaptor used with the predefined /// Versions for the __allocator adaptor used with the predefined
/// "SGI" style allocators. /// "SGI" style allocators.
template<typename _Tp, typename _Tp1, bool __thr, int __inst> template<typename _Tp, typename _Tp1, bool __thr, int __inst>
struct _Alloc_traits<_Tp, __allocator<_Tp1, struct _Alloc_traits<_Tp, __allocator<_Tp1,
__gnu_cxx::__pool_alloc<__thr, __inst> > > __gnu_cxx::__pool_alloc<__thr, __inst> > >
{ {
static const bool _S_instanceless = true; static const bool _S_instanceless = true;
typedef __gnu_cxx::__pool_alloc<__thr, __inst> base_alloc_type; typedef __gnu_cxx::__pool_alloc<__thr, __inst> base_alloc_type;
typedef __simple_alloc<_Tp, base_alloc_type> _Alloc_type; typedef __simple_alloc<_Tp, base_alloc_type> _Alloc_type;
typedef __allocator<_Tp, base_alloc_type> allocator_type; typedef __allocator<_Tp, base_alloc_type> allocator_type;
}; };
......
...@@ -70,7 +70,7 @@ namespace __gnu_cxx ...@@ -70,7 +70,7 @@ namespace __gnu_cxx
{ {
using std::_Rb_tree; using std::_Rb_tree;
using std::allocator; 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.
...@@ -85,13 +85,13 @@ namespace __gnu_cxx ...@@ -85,13 +85,13 @@ namespace __gnu_cxx
{ {
typedef _Rb_tree<_Key, _Value, _KeyOfValue, _Compare, _Alloc> _Base; typedef _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(),
const allocator_type& __a = allocator_type()) const allocator_type& __a = allocator_type())
: _Base(__comp, __a) { } : _Base(__comp, __a) { }
~rb_tree() { } ~rb_tree() { }
}; };
} // namespace __gnu_cxx } // namespace __gnu_cxx
#endif #endif
...@@ -112,7 +112,7 @@ template <class _CharT> ...@@ -112,7 +112,7 @@ template <class _CharT>
class char_producer { class char_producer {
public: public:
virtual ~char_producer() {}; virtual ~char_producer() {};
virtual void operator()(size_t __start_pos, size_t __len, virtual void operator()(size_t __start_pos, 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.
...@@ -265,17 +265,17 @@ _Rope_const_iterator<_CharT,_Alloc> operator+ ...@@ -265,17 +265,17 @@ _Rope_const_iterator<_CharT,_Alloc> operator+
const _Rope_const_iterator<_CharT,_Alloc>& __x); const _Rope_const_iterator<_CharT,_Alloc>& __x);
template<class _CharT, class _Alloc> template<class _CharT, class _Alloc>
bool operator== bool operator==
(const _Rope_const_iterator<_CharT,_Alloc>& __x, (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>
bool operator< bool operator<
(const _Rope_const_iterator<_CharT,_Alloc>& __x, (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>
ptrdiff_t operator- ptrdiff_t operator-
(const _Rope_const_iterator<_CharT,_Alloc>& __x, (const _Rope_const_iterator<_CharT,_Alloc>& __x,
const _Rope_const_iterator<_CharT,_Alloc>& __y); const _Rope_const_iterator<_CharT,_Alloc>& __y);
...@@ -295,32 +295,32 @@ _Rope_iterator<_CharT,_Alloc> operator+ ...@@ -295,32 +295,32 @@ _Rope_iterator<_CharT,_Alloc> operator+
const _Rope_iterator<_CharT,_Alloc>& __x); const _Rope_iterator<_CharT,_Alloc>& __x);
template<class _CharT, class _Alloc> template<class _CharT, class _Alloc>
bool operator== bool operator==
(const _Rope_iterator<_CharT,_Alloc>& __x, (const _Rope_iterator<_CharT,_Alloc>& __x,
const _Rope_iterator<_CharT,_Alloc>& __y); const _Rope_iterator<_CharT,_Alloc>& __y);
template<class _CharT, class _Alloc> template<class _CharT, class _Alloc>
bool operator< bool operator<
(const _Rope_iterator<_CharT,_Alloc>& __x, (const _Rope_iterator<_CharT,_Alloc>& __x,
const _Rope_iterator<_CharT,_Alloc>& __y); const _Rope_iterator<_CharT,_Alloc>& __y);
template<class _CharT, class _Alloc> template<class _CharT, class _Alloc>
ptrdiff_t operator- ptrdiff_t operator-
(const _Rope_iterator<_CharT,_Alloc>& __x, (const _Rope_iterator<_CharT,_Alloc>& __x,
const _Rope_iterator<_CharT,_Alloc>& __y); const _Rope_iterator<_CharT,_Alloc>& __y);
template<class _CharT, class _Alloc> template<class _CharT, class _Alloc>
rope<_CharT,_Alloc> operator+ (const rope<_CharT,_Alloc>& __left, rope<_CharT,_Alloc> operator+ (const rope<_CharT,_Alloc>& __left,
const rope<_CharT,_Alloc>& __right); const rope<_CharT,_Alloc>& __right);
template<class _CharT, class _Alloc> template<class _CharT, class _Alloc>
rope<_CharT,_Alloc> operator+ (const rope<_CharT,_Alloc>& __left, rope<_CharT,_Alloc> operator+ (const rope<_CharT,_Alloc>& __left,
const _CharT* __right); const _CharT* __right);
template<class _CharT, class _Alloc> template<class _CharT, class _Alloc>
rope<_CharT,_Alloc> operator+ (const rope<_CharT,_Alloc>& __left, rope<_CharT,_Alloc> operator+ (const rope<_CharT,_Alloc>& __left,
_CharT __right); _CharT __right);
// Some helpers, so we can use power on ropes. // Some helpers, so we can use power on ropes.
// See below for why this isn't local to the implementation. // See below for why this isn't local to the implementation.
...@@ -347,16 +347,16 @@ identity_element(_Rope_Concat_fn<_CharT, _Alloc>) ...@@ -347,16 +347,16 @@ identity_element(_Rope_Concat_fn<_CharT, _Alloc>)
// Class _Refcount_Base provides a type, _RC_t, a data member, // Class _Refcount_Base provides a type, _RC_t, a data member,
// _M_ref_count, and member functions _M_incr and _M_decr, which perform // _M_ref_count, and member functions _M_incr and _M_decr, which perform
// atomic preincrement/predecrement. The constructor initializes // atomic preincrement/predecrement. The constructor initializes
// _M_ref_count. // _M_ref_count.
struct _Refcount_Base struct _Refcount_Base
{ {
// The type _RC_t // The type _RC_t
typedef size_t _RC_t; typedef 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;
// Constructor // Constructor
__gthread_mutex_t _M_ref_count_lock; __gthread_mutex_t _M_ref_count_lock;
...@@ -372,16 +372,16 @@ identity_element(_Rope_Concat_fn<_CharT, _Alloc>) ...@@ -372,16 +372,16 @@ identity_element(_Rope_Concat_fn<_CharT, _Alloc>)
#endif #endif
} }
void void
_M_incr() _M_incr()
{ {
__gthread_mutex_lock(&_M_ref_count_lock); __gthread_mutex_lock(&_M_ref_count_lock);
++_M_ref_count; ++_M_ref_count;
__gthread_mutex_unlock(&_M_ref_count_lock); __gthread_mutex_unlock(&_M_ref_count_lock);
} }
_RC_t _RC_t
_M_decr() _M_decr()
{ {
__gthread_mutex_lock(&_M_ref_count_lock); __gthread_mutex_lock(&_M_ref_count_lock);
volatile _RC_t __tmp = --_M_ref_count; volatile _RC_t __tmp = --_M_ref_count;
...@@ -420,7 +420,7 @@ identity_element(_Rope_Concat_fn<_CharT, _Alloc>) ...@@ -420,7 +420,7 @@ identity_element(_Rope_Concat_fn<_CharT, _Alloc>)
// we are using standard conforming allocators, and whether the allocator // we are using standard conforming allocators, and whether the allocator
// instances have real state. Thus this macro is invoked repeatedly // instances have real state. Thus this macro is invoked repeatedly
// with different definitions of __ROPE_DEFINE_ALLOC. // with different definitions of __ROPE_DEFINE_ALLOC.
// __ROPE_DEFINE_ALLOC(type,name) defines // __ROPE_DEFINE_ALLOC(type,name) defines
// type * name_allocate(size_t) and // type * name_allocate(size_t) and
// void name_deallocate(tipe *, size_t) // void name_deallocate(tipe *, size_t)
// Both functions may or may not be static. // Both functions may or may not be static.
...@@ -460,7 +460,7 @@ public: ...@@ -460,7 +460,7 @@ public:
size_t _M_size; // This is here only to avoid wasting space size_t _M_size; // This is here only to avoid wasting space
// for an otherwise empty base class. // for an otherwise empty base class.
protected: protected:
allocator_type _M_data_allocator; allocator_type _M_data_allocator;
...@@ -476,7 +476,7 @@ protected: ...@@ -476,7 +476,7 @@ protected:
}; };
// Specialization for allocators that have the property that we don't // Specialization for allocators that have the property that we don't
// actually have to store an allocator object. // actually have to store an allocator object.
template <class _CharT, class _Allocator> template <class _CharT, class _Allocator>
class _Rope_rep_alloc_base<_CharT,_Allocator,true> { class _Rope_rep_alloc_base<_CharT,_Allocator,true> {
public: public:
...@@ -486,7 +486,7 @@ public: ...@@ -486,7 +486,7 @@ public:
_Rope_rep_alloc_base(size_t __size, const allocator_type&) _Rope_rep_alloc_base(size_t __size, const allocator_type&)
: _M_size(__size) {} : _M_size(__size) {}
size_t _M_size; size_t _M_size;
protected: protected:
# define __ROPE_DEFINE_ALLOC(_Tp, __name) \ # define __ROPE_DEFINE_ALLOC(_Tp, __name) \
...@@ -513,7 +513,7 @@ struct _Rope_rep_base ...@@ -513,7 +513,7 @@ struct _Rope_rep_base
typedef typename _Base::allocator_type allocator_type; typedef typename _Base::allocator_type allocator_type;
_Rope_rep_base(size_t __size, const allocator_type& __a) _Rope_rep_base(size_t __size, const allocator_type& __a)
: _Base(__size, __a) {} : _Base(__size, __a) {}
}; };
template<class _CharT, class _Alloc> template<class _CharT, class _Alloc>
...@@ -612,7 +612,7 @@ struct _Rope_RopeLeaf : public _Rope_RopeRep<_CharT,_Alloc> { ...@@ -612,7 +612,7 @@ struct _Rope_RopeLeaf : public _Rope_RopeRep<_CharT,_Alloc> {
enum { _S_alloc_granularity = 8 }; enum { _S_alloc_granularity = 8 };
static size_t _S_rounded_up_size(size_t __n) { static size_t _S_rounded_up_size(size_t __n) {
size_t __size_with_eos; size_t __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;
} else { } else {
...@@ -780,7 +780,7 @@ struct _Rope_RopeSubstring : public _Rope_RopeFunction<_CharT,_Alloc>, ...@@ -780,7 +780,7 @@ struct _Rope_RopeSubstring : public _Rope_RopeFunction<_CharT,_Alloc>,
this->_M_tag = _Rope_RopeFunction<_CharT,_Alloc>::_S_substringfn; this->_M_tag = _Rope_RopeFunction<_CharT,_Alloc>::_S_substringfn;
} }
virtual ~_Rope_RopeSubstring() virtual ~_Rope_RopeSubstring()
{ {
# ifndef __GC # ifndef __GC
_M_base->_M_unref_nonnil(); _M_base->_M_unref_nonnil();
// _M_free_c_string(); -- done by parent class // _M_free_c_string(); -- done by parent class
...@@ -802,7 +802,7 @@ struct _Rope_RopeSubstring : public _Rope_RopeFunction<_CharT,_Alloc>, ...@@ -802,7 +802,7 @@ struct _Rope_RopeSubstring : public _Rope_RopeFunction<_CharT,_Alloc>,
template<class _CharT, class _Alloc> template<class _CharT, class _Alloc>
struct _Rope_self_destruct_ptr { struct _Rope_self_destruct_ptr {
_Rope_RopeRep<_CharT,_Alloc>* _M_ptr; _Rope_RopeRep<_CharT,_Alloc>* _M_ptr;
~_Rope_self_destruct_ptr() ~_Rope_self_destruct_ptr()
{ _Rope_RopeRep<_CharT,_Alloc>::_S_unref(_M_ptr); } { _Rope_RopeRep<_CharT,_Alloc>::_S_unref(_M_ptr); }
#ifdef __EXCEPTIONS #ifdef __EXCEPTIONS
_Rope_self_destruct_ptr() : _M_ptr(0) {}; _Rope_self_destruct_ptr() : _M_ptr(0) {};
...@@ -854,7 +854,7 @@ class _Rope_char_ref_proxy { ...@@ -854,7 +854,7 @@ class _Rope_char_ref_proxy {
_Rope_char_ref_proxy& operator= (_CharT __c); _Rope_char_ref_proxy& operator= (_CharT __c);
_Rope_char_ptr_proxy<_CharT,_Alloc> operator& () const; _Rope_char_ptr_proxy<_CharT,_Alloc> operator& () const;
_Rope_char_ref_proxy& operator= (const _Rope_char_ref_proxy& __c) { _Rope_char_ref_proxy& operator= (const _Rope_char_ref_proxy& __c) {
return operator=((_CharT)__c); return operator=((_CharT)__c);
} }
}; };
...@@ -873,14 +873,14 @@ class _Rope_char_ptr_proxy { ...@@ -873,14 +873,14 @@ class _Rope_char_ptr_proxy {
size_t _M_pos; 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)
: _M_pos(__x._M_pos), _M_root(__x._M_root) {} : _M_pos(__x._M_pos), _M_root(__x._M_root) {}
_Rope_char_ptr_proxy(const _Rope_char_ptr_proxy& __x) _Rope_char_ptr_proxy(const _Rope_char_ptr_proxy& __x)
: _M_pos(__x._M_pos), _M_root(__x._M_root) {} : _M_pos(__x._M_pos), _M_root(__x._M_root) {}
_Rope_char_ptr_proxy() {} _Rope_char_ptr_proxy() {}
_Rope_char_ptr_proxy(_CharT* __x) : _M_root(0), _M_pos(0) { _Rope_char_ptr_proxy(_CharT* __x) : _M_root(0), _M_pos(0) {
} }
_Rope_char_ptr_proxy& _Rope_char_ptr_proxy&
operator= (const _Rope_char_ptr_proxy& __x) { operator= (const _Rope_char_ptr_proxy& __x) {
_M_pos = __x._M_pos; _M_pos = __x._M_pos;
_M_root = __x._M_root; _M_root = __x._M_root;
...@@ -942,7 +942,7 @@ class _Rope_iterator_base ...@@ -942,7 +942,7 @@ class _Rope_iterator_base
// __right. Assumes path_cache_len <= 9. // __right. Assumes path_cache_len <= 9.
_CharT _M_tmp_buf[_S_iterator_buf_len]; _CharT _M_tmp_buf[_S_iterator_buf_len];
// Short buffer for surrounding chars. // Short buffer for surrounding chars.
// This is useful primarily for // This is useful primarily for
// RopeFunctions. We put the buffer // RopeFunctions. We put the buffer
// here to avoid locking in the // here to avoid locking in the
// multithreaded case. // multithreaded case.
...@@ -1081,7 +1081,7 @@ class _Rope_const_iterator : public _Rope_iterator_base<_CharT,_Alloc> { ...@@ -1081,7 +1081,7 @@ class _Rope_const_iterator : public _Rope_iterator_base<_CharT,_Alloc> {
(const _Rope_const_iterator<_CharT2,_Alloc2>& __x, (const _Rope_const_iterator<_CharT2,_Alloc2>& __x,
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 bool operator< friend bool operator<
(const _Rope_const_iterator<_CharT2,_Alloc2>& __x, (const _Rope_const_iterator<_CharT2,_Alloc2>& __x,
const _Rope_const_iterator<_CharT2,_Alloc2>& __y); const _Rope_const_iterator<_CharT2,_Alloc2>& __y);
template<class _CharT2, class _Alloc2> template<class _CharT2, class _Alloc2>
...@@ -1105,7 +1105,7 @@ class _Rope_iterator : public _Rope_iterator_base<_CharT,_Alloc> { ...@@ -1105,7 +1105,7 @@ class _Rope_iterator : public _Rope_iterator_base<_CharT,_Alloc> {
// nonGC case. // nonGC case.
_Rope_iterator(rope<_CharT,_Alloc>* __r, size_t __pos) _Rope_iterator(rope<_CharT,_Alloc>* __r, 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);
if (!(__r -> empty()))_S_setcache(*this); } if (!(__r -> empty()))_S_setcache(*this); }
...@@ -1235,7 +1235,7 @@ public: ...@@ -1235,7 +1235,7 @@ public:
: _M_tree_ptr(__t), _M_data_allocator(__a) {} : _M_tree_ptr(__t), _M_data_allocator(__a) {}
_Rope_alloc_base(const allocator_type& __a) _Rope_alloc_base(const allocator_type& __a)
: _M_data_allocator(__a) {} : _M_data_allocator(__a) {}
protected: protected:
// The only data members of a rope: // The only data members of a rope:
allocator_type _M_data_allocator; allocator_type _M_data_allocator;
...@@ -1253,7 +1253,7 @@ protected: ...@@ -1253,7 +1253,7 @@ protected:
}; };
// Specialization for allocators that have the property that we don't // Specialization for allocators that have the property that we don't
// actually have to store an allocator object. // actually have to store an allocator object.
template <class _CharT, class _Allocator> template <class _CharT, class _Allocator>
class _Rope_alloc_base<_CharT,_Allocator,true> { class _Rope_alloc_base<_CharT,_Allocator,true> {
public: public:
...@@ -1264,7 +1264,7 @@ public: ...@@ -1264,7 +1264,7 @@ public:
_Rope_alloc_base(_RopeRep *__t, const allocator_type&) _Rope_alloc_base(_RopeRep *__t, const allocator_type&)
: _M_tree_ptr(__t) {} : _M_tree_ptr(__t) {}
_Rope_alloc_base(const allocator_type&) {} _Rope_alloc_base(const allocator_type&) {}
protected: protected:
// The only data member of a rope: // The only data member of a rope:
_RopeRep *_M_tree_ptr; _RopeRep *_M_tree_ptr;
...@@ -1283,7 +1283,7 @@ protected: ...@@ -1283,7 +1283,7 @@ protected:
}; };
template <class _CharT, class _Alloc> template <class _CharT, class _Alloc>
struct _Rope_base struct _Rope_base
: public _Rope_alloc_base<_CharT,_Alloc, : public _Rope_alloc_base<_CharT,_Alloc,
_Alloc_traits<_CharT,_Alloc>::_S_instanceless> _Alloc_traits<_CharT,_Alloc>::_S_instanceless>
{ {
...@@ -1295,7 +1295,7 @@ struct _Rope_base ...@@ -1295,7 +1295,7 @@ struct _Rope_base
// The one in _Base may not be visible due to template rules. // The one in _Base may not be visible due to template rules.
_Rope_base(_RopeRep* __t, const allocator_type& __a) : _Base(__t, __a) {} _Rope_base(_RopeRep* __t, const allocator_type& __a) : _Base(__t, __a) {}
_Rope_base(const allocator_type& __a) : _Base(__a) {} _Rope_base(const allocator_type& __a) : _Base(__a) {}
}; };
/** /**
...@@ -1429,7 +1429,7 @@ class rope : public _Rope_base<_CharT,_Alloc> { ...@@ -1429,7 +1429,7 @@ class rope : public _Rope_base<_CharT,_Alloc> {
return _S_rounded_up_size(__n); return _S_rounded_up_size(__n);
} }
} }
// Allocate and construct a RopeLeaf using the supplied allocator // Allocate and construct a RopeLeaf using the supplied allocator
// Takes ownership of s instead of copying. // Takes ownership of s instead of copying.
static _RopeLeaf* _S_new_RopeLeaf(__GC_CONST _CharT *__s, static _RopeLeaf* _S_new_RopeLeaf(__GC_CONST _CharT *__s,
...@@ -1466,7 +1466,7 @@ class rope : public _Rope_base<_CharT,_Alloc> { ...@@ -1466,7 +1466,7 @@ class rope : public _Rope_base<_CharT,_Alloc> {
_RopeLeaf* _S_RopeLeaf_from_unowned_char_ptr(const _CharT *__s, _RopeLeaf* _S_RopeLeaf_from_unowned_char_ptr(const _CharT *__s,
size_t __size, allocator_type __a) size_t __size, allocator_type __a)
# define __STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __size, __a) \ # 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)
{ {
if (0 == __size) return 0; if (0 == __size) return 0;
_CharT* __buf = __a.allocate(_S_rounded_up_size(__size)); _CharT* __buf = __a.allocate(_S_rounded_up_size(__size));
...@@ -1482,7 +1482,7 @@ class rope : public _Rope_base<_CharT,_Alloc> { ...@@ -1482,7 +1482,7 @@ class rope : public _Rope_base<_CharT,_Alloc> {
__throw_exception_again; __throw_exception_again;
} }
} }
// Concatenation of nonempty strings. // Concatenation of nonempty strings.
// Always builds a concatenation node. // Always builds a concatenation node.
...@@ -1526,7 +1526,7 @@ class rope : public _Rope_base<_CharT,_Alloc> { ...@@ -1526,7 +1526,7 @@ class rope : public _Rope_base<_CharT,_Alloc> {
size_t __start, size_t __len, size_t __start, size_t __len,
_CharT* __buffer); _CharT* __buffer);
static const unsigned long static const unsigned long
_S_min_len[_RopeRep::_S_max_rope_depth + 1]; _S_min_len[_RopeRep::_S_max_rope_depth + 1];
static bool _S_is_balanced(_RopeRep* __r) static bool _S_is_balanced(_RopeRep* __r)
...@@ -1559,7 +1559,7 @@ class rope : public _Rope_base<_CharT,_Alloc> { ...@@ -1559,7 +1559,7 @@ class rope : public _Rope_base<_CharT,_Alloc> {
// Add all unbalanced subtrees to the forest of balanceed trees. // Add all unbalanced subtrees to the forest of balanceed trees.
// Used only by balance. // Used only by balance.
static void _S_add_to_forest(_RopeRep*__r, _RopeRep** __forest); static void _S_add_to_forest(_RopeRep*__r, _RopeRep** __forest);
// Add __r to forest, assuming __r is already balanced. // Add __r to forest, assuming __r is already balanced.
static void _S_add_leaf_to_forest(_RopeRep* __r, _RopeRep** __forest); static void _S_add_leaf_to_forest(_RopeRep* __r, _RopeRep** __forest);
...@@ -1677,7 +1677,7 @@ class rope : public _Rope_base<_CharT,_Alloc> { ...@@ -1677,7 +1677,7 @@ class rope : public _Rope_base<_CharT,_Alloc> {
void pop_back() void pop_back()
{ {
_RopeRep* __old = this->_M_tree_ptr; _RopeRep* __old = this->_M_tree_ptr;
this->_M_tree_ptr = this->_M_tree_ptr =
_S_substring(this->_M_tree_ptr, _S_substring(this->_M_tree_ptr,
0, 0,
this->_M_tree_ptr->_M_size - 1); this->_M_tree_ptr->_M_size - 1);
...@@ -1736,7 +1736,7 @@ class rope : public _Rope_base<_CharT,_Alloc> { ...@@ -1736,7 +1736,7 @@ class rope : public _Rope_base<_CharT,_Alloc> {
// rest of the interface. // rest of the interface.
// Note that this guaranteed not to compile if the draft standard // Note that this guaranteed not to compile if the draft standard
// order is assumed. // order is assumed.
size_type copy(size_type __pos, size_type __n, _CharT* __buffer) const size_type copy(size_type __pos, size_type __n, _CharT* __buffer) const
{ {
size_t __size = size(); size_t __size = size();
size_t __len = (__pos + __n > __size? __size - __pos : __n); size_t __len = (__pos + __n > __size? __size - __pos : __n);
...@@ -1765,8 +1765,8 @@ class rope : public _Rope_base<_CharT,_Alloc> { ...@@ -1765,8 +1765,8 @@ class rope : public _Rope_base<_CharT,_Alloc> {
// is safe for multiple threads. // is safe for multiple threads.
void delete_c_str () { void delete_c_str () {
if (0 == this->_M_tree_ptr) return; if (0 == this->_M_tree_ptr) return;
if (_RopeRep::_S_leaf == this->_M_tree_ptr->_M_tag && if (_RopeRep::_S_leaf == this->_M_tree_ptr->_M_tag &&
((_RopeLeaf*)this->_M_tree_ptr)->_M_data == ((_RopeLeaf*)this->_M_tree_ptr)->_M_data ==
this->_M_tree_ptr->_M_c_string) { this->_M_tree_ptr->_M_c_string) {
// Representation shared // Representation shared
return; return;
...@@ -1803,7 +1803,7 @@ class rope : public _Rope_base<_CharT,_Alloc> { ...@@ -1803,7 +1803,7 @@ class rope : public _Rope_base<_CharT,_Alloc> {
return(const_iterator(this->_M_tree_ptr, size())); return(const_iterator(this->_M_tree_ptr, size()));
} }
size_type size() const { size_type size() const {
return(0 == this->_M_tree_ptr? 0 : this->_M_tree_ptr->_M_size); return(0 == this->_M_tree_ptr? 0 : this->_M_tree_ptr->_M_size);
} }
...@@ -1840,12 +1840,12 @@ class rope : public _Rope_base<_CharT,_Alloc> { ...@@ -1840,12 +1840,12 @@ class rope : public _Rope_base<_CharT,_Alloc> {
friend rope<_CharT2,_Alloc2> friend rope<_CharT2,_Alloc2>
operator+ (const rope<_CharT2,_Alloc2>& __left, operator+ (const rope<_CharT2,_Alloc2>& __left,
const rope<_CharT2,_Alloc2>& __right); const rope<_CharT2,_Alloc2>& __right);
template<class _CharT2, class _Alloc2> template<class _CharT2, class _Alloc2>
friend rope<_CharT2,_Alloc2> friend rope<_CharT2,_Alloc2>
operator+ (const rope<_CharT2,_Alloc2>& __left, operator+ (const rope<_CharT2,_Alloc2>& __left,
const _CharT2* __right); const _CharT2* __right);
template<class _CharT2, class _Alloc2> template<class _CharT2, class _Alloc2>
friend rope<_CharT2,_Alloc2> friend rope<_CharT2,_Alloc2>
operator+ (const rope<_CharT2,_Alloc2>& __left, _CharT2 __right); operator+ (const rope<_CharT2,_Alloc2>& __left, _CharT2 __right);
...@@ -1856,7 +1856,7 @@ class rope : public _Rope_base<_CharT,_Alloc> { ...@@ -1856,7 +1856,7 @@ class rope : public _Rope_base<_CharT,_Alloc> {
// The first argument should be an input iterator or // The first argument should be an input iterator or
// forward iterator with value_type _CharT. // forward iterator with value_type _CharT.
rope& append(const _CharT* __iter, size_t __n) { rope& append(const _CharT* __iter, size_t __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);
_S_unref(this->_M_tree_ptr); _S_unref(this->_M_tree_ptr);
this->_M_tree_ptr = __result; this->_M_tree_ptr = __result;
...@@ -1880,7 +1880,7 @@ class rope : public _Rope_base<_CharT,_Alloc> { ...@@ -1880,7 +1880,7 @@ class rope : public _Rope_base<_CharT,_Alloc> {
rope& append(const_iterator __s, const_iterator __e) { rope& append(const_iterator __s, const_iterator __e) {
_Self_destruct_ptr __appendee(_S_substring( _Self_destruct_ptr __appendee(_S_substring(
__s._M_root, __s._M_current_pos, __e._M_current_pos)); __s._M_root, __s._M_current_pos, __e._M_current_pos));
_RopeRep* __result = _RopeRep* __result =
_S_concat(this->_M_tree_ptr, (_RopeRep*)__appendee); _S_concat(this->_M_tree_ptr, (_RopeRep*)__appendee);
_S_unref(this->_M_tree_ptr); _S_unref(this->_M_tree_ptr);
this->_M_tree_ptr = __result; this->_M_tree_ptr = __result;
...@@ -1888,7 +1888,7 @@ class rope : public _Rope_base<_CharT,_Alloc> { ...@@ -1888,7 +1888,7 @@ class rope : public _Rope_base<_CharT,_Alloc> {
} }
rope& append(_CharT __c) { rope& append(_CharT __c) {
_RopeRep* __result = _RopeRep* __result =
_S_destr_concat_char_iter(this->_M_tree_ptr, &__c, 1); _S_destr_concat_char_iter(this->_M_tree_ptr, &__c, 1);
_S_unref(this->_M_tree_ptr); _S_unref(this->_M_tree_ptr);
this->_M_tree_ptr = __result; this->_M_tree_ptr = __result;
...@@ -1938,7 +1938,7 @@ class rope : public _Rope_base<_CharT,_Alloc> { ...@@ -1938,7 +1938,7 @@ class rope : public _Rope_base<_CharT,_Alloc> {
public: public:
void insert(size_t __p, const rope& __r) { void insert(size_t __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);
_S_unref(this->_M_tree_ptr); _S_unref(this->_M_tree_ptr);
this->_M_tree_ptr = __result; this->_M_tree_ptr = __result;
...@@ -1996,13 +1996,13 @@ class rope : public _Rope_base<_CharT,_Alloc> { ...@@ -1996,13 +1996,13 @@ class rope : public _Rope_base<_CharT,_Alloc> {
// (position, length) versions of replace operations: // (position, length) versions of replace operations:
void replace(size_t __p, size_t __n, const rope& __r) { void replace(size_t __p, size_t __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);
_S_unref(this->_M_tree_ptr); _S_unref(this->_M_tree_ptr);
this->_M_tree_ptr = __result; this->_M_tree_ptr = __result;
} }
void replace(size_t __p, size_t __n, void replace(size_t __p, size_t __n,
const _CharT* __i, size_t __i_len) { const _CharT* __i, size_t __i_len) {
rope __r(__i, __i_len); rope __r(__i, __i_len);
replace(__p, __n, __r); replace(__p, __n, __r);
...@@ -2018,7 +2018,7 @@ class rope : public _Rope_base<_CharT,_Alloc> { ...@@ -2018,7 +2018,7 @@ class rope : public _Rope_base<_CharT,_Alloc> {
replace(__p, __n, __r); replace(__p, __n, __r);
} }
void replace(size_t __p, size_t __n, void replace(size_t __p, size_t __n,
const _CharT* __i, const _CharT* __j) { const _CharT* __i, const _CharT* __j) {
rope __r(__i, __j); rope __r(__i, __j);
replace(__p, __n, __r); replace(__p, __n, __r);
...@@ -2080,20 +2080,20 @@ class rope : public _Rope_base<_CharT,_Alloc> { ...@@ -2080,20 +2080,20 @@ class rope : public _Rope_base<_CharT,_Alloc> {
erase(__p, __p + 1); erase(__p, __p + 1);
} }
// Insert, iterator variants. // Insert, iterator variants.
iterator insert(const iterator& __p, const rope& __r) iterator insert(const iterator& __p, const rope& __r)
{ insert(__p.index(), __r); return __p; } { insert(__p.index(), __r); return __p; }
iterator insert(const iterator& __p, size_t __n, _CharT __c) iterator insert(const iterator& __p, size_t __n, _CharT __c)
{ insert(__p.index(), __n, __c); return __p; } { insert(__p.index(), __n, __c); return __p; }
iterator insert(const iterator& __p, _CharT __c) iterator insert(const iterator& __p, _CharT __c)
{ insert(__p.index(), __c); return __p; } { insert(__p.index(), __c); return __p; }
iterator insert(const iterator& __p ) iterator insert(const iterator& __p )
{ insert(__p.index()); return __p; } { insert(__p.index()); return __p; }
iterator insert(const iterator& __p, const _CharT* c_string) iterator insert(const iterator& __p, const _CharT* c_string)
{ insert(__p.index(), c_string); return __p; } { insert(__p.index(), c_string); return __p; }
iterator insert(const iterator& __p, const _CharT* __i, size_t __n) iterator insert(const iterator& __p, const _CharT* __i, size_t __n)
{ insert(__p.index(), __i, __n); return __p; } { insert(__p.index(), __i, __n); return __p; }
iterator insert(const iterator& __p, const _CharT* __i, iterator insert(const iterator& __p, const _CharT* __i,
const _CharT* __j) const _CharT* __j)
{ insert(__p.index(), __i, __j); return __p; } { insert(__p.index(), __i, __j); return __p; }
iterator insert(const iterator& __p, iterator insert(const iterator& __p,
...@@ -2136,7 +2136,7 @@ class rope : public _Rope_base<_CharT,_Alloc> { ...@@ -2136,7 +2136,7 @@ class rope : public _Rope_base<_CharT,_Alloc> {
{ replace(__p.index(), __i, __n); } { replace(__p.index(), __i, __n); }
void replace(const iterator& __p, const _CharT* __i, const _CharT* __j) void replace(const iterator& __p, const _CharT* __i, const _CharT* __j)
{ replace(__p.index(), __i, __j); } { replace(__p.index(), __i, __j); }
void replace(const iterator& __p, const_iterator __i, void replace(const iterator& __p, const_iterator __i,
const_iterator __j) const_iterator __j)
{ replace(__p.index(), __i, __j); } { replace(__p.index(), __i, __j); }
void replace(const iterator& __p, iterator __i, iterator __j) void replace(const iterator& __p, iterator __i, iterator __j)
...@@ -2167,13 +2167,13 @@ class rope : public _Rope_base<_CharT,_Alloc> { ...@@ -2167,13 +2167,13 @@ class rope : public _Rope_base<_CharT,_Alloc> {
__start.index(), __start.index(),
__end.index())); __end.index()));
} }
rope substr(iterator __start) const { rope substr(iterator __start) const {
size_t __pos = __start.index(); size_t __pos = __start.index();
return rope<_CharT,_Alloc>( return rope<_CharT,_Alloc>(
_S_substring(this->_M_tree_ptr, __pos, __pos + 1)); _S_substring(this->_M_tree_ptr, __pos, __pos + 1));
} }
rope substr(const_iterator __start, const_iterator __end) const { rope substr(const_iterator __start, const_iterator __end) const {
// This might eventually take advantage of the cache in the // This might eventually take advantage of the cache in the
// iterator. // iterator.
...@@ -2244,7 +2244,7 @@ class rope : public _Rope_base<_CharT,_Alloc> { ...@@ -2244,7 +2244,7 @@ class rope : public _Rope_base<_CharT,_Alloc> {
// Stuff below this line is dangerous because it's error prone. // Stuff below this line is dangerous because it's error prone.
// I would really like to get rid of it. // I would really like to get rid of it.
// copy function with funny arg ordering. // copy function with funny arg ordering.
size_type copy(_CharT* __buffer, size_type __n, size_type copy(_CharT* __buffer, size_type __n,
size_type __pos = 0) const { size_type __pos = 0) const {
return copy(__pos, __n, __buffer); return copy(__pos, __n, __buffer);
} }
...@@ -2264,11 +2264,11 @@ class rope : public _Rope_base<_CharT,_Alloc> { ...@@ -2264,11 +2264,11 @@ class rope : public _Rope_base<_CharT,_Alloc> {
const_iterator begin() { return const_begin(); } const_iterator begin() { return const_begin(); }
const_reverse_iterator rend() { return const_rend(); } const_reverse_iterator rend() { return const_rend(); }
const_reverse_iterator rbegin() { return const_rbegin(); } const_reverse_iterator rbegin() { return const_rbegin(); }
# endif # endif
}; };
template <class _CharT, class _Alloc> template <class _CharT, class _Alloc>
...@@ -2278,7 +2278,7 @@ const typename rope<_CharT, _Alloc>::size_type rope<_CharT, _Alloc>::npos = ...@@ -2278,7 +2278,7 @@ const typename rope<_CharT, _Alloc>::size_type rope<_CharT, _Alloc>::npos =
template <class _CharT, class _Alloc> template <class _CharT, class _Alloc>
inline bool operator== (const _Rope_const_iterator<_CharT,_Alloc>& __x, inline bool operator== (const _Rope_const_iterator<_CharT,_Alloc>& __x,
const _Rope_const_iterator<_CharT,_Alloc>& __y) { const _Rope_const_iterator<_CharT,_Alloc>& __y) {
return (__x._M_current_pos == __y._M_current_pos && return (__x._M_current_pos == __y._M_current_pos &&
__x._M_root == __y._M_root); __x._M_root == __y._M_root);
} }
...@@ -2342,7 +2342,7 @@ operator+(ptrdiff_t __n, const _Rope_const_iterator<_CharT,_Alloc>& __x) { ...@@ -2342,7 +2342,7 @@ operator+(ptrdiff_t __n, const _Rope_const_iterator<_CharT,_Alloc>& __x) {
template <class _CharT, class _Alloc> template <class _CharT, class _Alloc>
inline bool operator== (const _Rope_iterator<_CharT,_Alloc>& __x, inline bool operator== (const _Rope_iterator<_CharT,_Alloc>& __x,
const _Rope_iterator<_CharT,_Alloc>& __y) { const _Rope_iterator<_CharT,_Alloc>& __y) {
return (__x._M_current_pos == __y._M_current_pos && return (__x._M_current_pos == __y._M_current_pos &&
__x._M_root_rope == __y._M_root_rope); __x._M_root_rope == __y._M_root_rope);
} }
...@@ -2420,7 +2420,7 @@ operator+ (const rope<_CharT,_Alloc>& __left, ...@@ -2420,7 +2420,7 @@ operator+ (const rope<_CharT,_Alloc>& __left,
template <class _CharT, class _Alloc> template <class _CharT, class _Alloc>
inline inline
rope<_CharT,_Alloc>& rope<_CharT,_Alloc>&
operator+= (rope<_CharT,_Alloc>& __left, operator+= (rope<_CharT,_Alloc>& __left,
const rope<_CharT,_Alloc>& __right) const rope<_CharT,_Alloc>& __right)
{ {
__left.append(__right); __left.append(__right);
...@@ -2435,7 +2435,7 @@ operator+ (const rope<_CharT,_Alloc>& __left, ...@@ -2435,7 +2435,7 @@ operator+ (const rope<_CharT,_Alloc>& __left,
size_t __rlen = rope<_CharT,_Alloc>::_S_char_ptr_len(__right); size_t __rlen = rope<_CharT,_Alloc>::_S_char_ptr_len(__right);
return rope<_CharT,_Alloc>( return rope<_CharT,_Alloc>(
rope<_CharT,_Alloc>::_S_concat_char_iter( rope<_CharT,_Alloc>::_S_concat_char_iter(
__left._M_tree_ptr, __right, __rlen)); __left._M_tree_ptr, __right, __rlen));
} }
template <class _CharT, class _Alloc> template <class _CharT, class _Alloc>
...@@ -2466,14 +2466,14 @@ operator+= (rope<_CharT,_Alloc>& __left, _CharT __right) { ...@@ -2466,14 +2466,14 @@ operator+= (rope<_CharT,_Alloc>& __left, _CharT __right) {
template <class _CharT, class _Alloc> template <class _CharT, class _Alloc>
bool bool
operator< (const rope<_CharT,_Alloc>& __left, operator< (const rope<_CharT,_Alloc>& __left,
const rope<_CharT,_Alloc>& __right) { const rope<_CharT,_Alloc>& __right) {
return __left.compare(__right) < 0; return __left.compare(__right) < 0;
} }
template <class _CharT, class _Alloc> template <class _CharT, class _Alloc>
bool bool
operator== (const rope<_CharT,_Alloc>& __left, operator== (const rope<_CharT,_Alloc>& __left,
const rope<_CharT,_Alloc>& __right) { const rope<_CharT,_Alloc>& __right) {
return __left.compare(__right) == 0; return __left.compare(__right) == 0;
} }
......
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
* You should not attempt to use it directly. * You should not attempt to use it directly.
*/ */
#include <cstdio> #include <cstdio>
#include <ostream> #include <ostream>
#include <bits/functexcept.h> #include <bits/functexcept.h>
...@@ -57,7 +57,7 @@ namespace __gnu_cxx ...@@ -57,7 +57,7 @@ namespace __gnu_cxx
{ {
using std::size_t; using std::size_t;
using std::printf; using std::printf;
using std::basic_ostream; using std::basic_ostream;
using std::__throw_length_error; using std::__throw_length_error;
using std::__alloc; using std::__alloc;
using std::_Destroy; using std::_Destroy;
...@@ -68,7 +68,7 @@ namespace __gnu_cxx ...@@ -68,7 +68,7 @@ namespace __gnu_cxx
// Results in a valid buf_ptr if the iterator can be legitimately // Results in a valid buf_ptr if the iterator can be legitimately
// dereferenced. // dereferenced.
template <class _CharT, class _Alloc> template <class _CharT, class _Alloc>
void _Rope_iterator_base<_CharT,_Alloc>::_S_setbuf( void _Rope_iterator_base<_CharT,_Alloc>::_S_setbuf(
_Rope_iterator_base<_CharT,_Alloc>& __x) _Rope_iterator_base<_CharT,_Alloc>& __x)
{ {
const _RopeRep* __leaf = __x._M_path_end[__x._M_leaf_index]; const _RopeRep* __leaf = __x._M_path_end[__x._M_leaf_index];
...@@ -77,7 +77,7 @@ void _Rope_iterator_base<_CharT,_Alloc>::_S_setbuf( ...@@ -77,7 +77,7 @@ void _Rope_iterator_base<_CharT,_Alloc>::_S_setbuf(
switch(__leaf->_M_tag) { switch(__leaf->_M_tag) {
case _RopeRep::_S_leaf: case _RopeRep::_S_leaf:
__x._M_buf_start = __x._M_buf_start =
((_Rope_RopeLeaf<_CharT,_Alloc>*)__leaf)->_M_data; ((_Rope_RopeLeaf<_CharT,_Alloc>*)__leaf)->_M_data;
__x._M_buf_ptr = __x._M_buf_start + (__pos - __leaf_pos); __x._M_buf_ptr = __x._M_buf_start + (__pos - __leaf_pos);
__x._M_buf_end = __x._M_buf_start + __leaf->_M_size; __x._M_buf_end = __x._M_buf_start + __leaf->_M_size;
...@@ -111,7 +111,7 @@ void _Rope_iterator_base<_CharT,_Alloc>::_S_setbuf( ...@@ -111,7 +111,7 @@ void _Rope_iterator_base<_CharT,_Alloc>::_S_setbuf(
} }
} }
// Set path and buffer inside a rope iterator. We assume that // Set path and buffer inside a rope iterator. We assume that
// pos and root are already set. // pos and root are already set.
template <class _CharT, class _Alloc> template <class _CharT, class _Alloc>
void _Rope_iterator_base<_CharT,_Alloc>::_S_setcache void _Rope_iterator_base<_CharT,_Alloc>::_S_setcache
...@@ -154,7 +154,7 @@ void _Rope_iterator_base<_CharT,_Alloc>::_S_setcache ...@@ -154,7 +154,7 @@ void _Rope_iterator_base<_CharT,_Alloc>::_S_setcache
(_Rope_RopeConcatenation<_CharT,_Alloc>*)__curr_rope; (_Rope_RopeConcatenation<_CharT,_Alloc>*)__curr_rope;
_RopeRep* __left = __c->_M_left; _RopeRep* __left = __c->_M_left;
size_t __left_len = __left->_M_size; size_t __left_len = __left->_M_size;
__dirns <<= 1; __dirns <<= 1;
if (__pos >= __curr_start_pos + __left_len) { if (__pos >= __curr_start_pos + __left_len) {
__dirns |= 1; __dirns |= 1;
...@@ -203,7 +203,7 @@ void _Rope_iterator_base<_CharT,_Alloc>::_S_setcache_for_incr ...@@ -203,7 +203,7 @@ void _Rope_iterator_base<_CharT,_Alloc>::_S_setcache_for_incr
} }
// node_start_pos is starting position of last_node. // node_start_pos is starting position of last_node.
while (--__current_index >= 0) { while (--__current_index >= 0) {
if (!(__dirns & 1) /* Path turned left */) if (!(__dirns & 1) /* Path turned left */)
break; break;
__current_node = __x._M_path_end[__current_index]; __current_node = __x._M_path_end[__current_index];
__c = (_Rope_RopeConcatenation<_CharT,_Alloc>*)__current_node; __c = (_Rope_RopeConcatenation<_CharT,_Alloc>*)__current_node;
...@@ -288,23 +288,23 @@ void _Rope_iterator<_CharT,_Alloc>::_M_check() { ...@@ -288,23 +288,23 @@ void _Rope_iterator<_CharT,_Alloc>::_M_check() {
} }
template <class _CharT, class _Alloc> template <class _CharT, class _Alloc>
inline inline
_Rope_const_iterator<_CharT, _Alloc>::_Rope_const_iterator( _Rope_const_iterator<_CharT, _Alloc>::_Rope_const_iterator(
const _Rope_iterator<_CharT,_Alloc>& __x) const _Rope_iterator<_CharT,_Alloc>& __x)
: _Rope_iterator_base<_CharT,_Alloc>(__x) : _Rope_iterator_base<_CharT,_Alloc>(__x)
{ } { }
template <class _CharT, class _Alloc> template <class _CharT, class _Alloc>
inline _Rope_iterator<_CharT,_Alloc>::_Rope_iterator( inline _Rope_iterator<_CharT,_Alloc>::_Rope_iterator(
rope<_CharT,_Alloc>& __r, size_t __pos) rope<_CharT,_Alloc>& __r, 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 size_t
rope<_CharT,_Alloc>::_S_char_ptr_len(const _CharT* __s) rope<_CharT,_Alloc>::_S_char_ptr_len(const _CharT* __s)
{ {
const _CharT* __p = __s; const _CharT* __p = __s;
...@@ -409,7 +409,7 @@ rope<_CharT,_Alloc>::_S_leaf_concat_char_iter ...@@ -409,7 +409,7 @@ rope<_CharT,_Alloc>::_S_leaf_concat_char_iter
_CharT* __new_data = (_CharT*) _CharT* __new_data = (_CharT*)
_Data_allocate(_S_rounded_up_size(__old_len + __len)); _Data_allocate(_S_rounded_up_size(__old_len + __len));
_RopeLeaf* __result; _RopeLeaf* __result;
uninitialized_copy_n(__r->_M_data, __old_len, __new_data); uninitialized_copy_n(__r->_M_data, __old_len, __new_data);
uninitialized_copy_n(__iter, __len, __new_data + __old_len); uninitialized_copy_n(__iter, __len, __new_data + __old_len);
_S_cond_store_eos(__new_data[__old_len + __len]); _S_cond_store_eos(__new_data[__old_len + __len]);
...@@ -463,22 +463,22 @@ template <class _CharT, class _Alloc> ...@@ -463,22 +463,22 @@ template <class _CharT, class _Alloc>
typename rope<_CharT,_Alloc>::_RopeRep* typename rope<_CharT,_Alloc>::_RopeRep*
rope<_CharT,_Alloc>::_S_tree_concat (_RopeRep* __left, _RopeRep* __right) rope<_CharT,_Alloc>::_S_tree_concat (_RopeRep* __left, _RopeRep* __right)
{ {
_RopeConcatenation* __result = _S_new_RopeConcatenation(__left, __right, _RopeConcatenation* __result = _S_new_RopeConcatenation(__left, __right,
__left->get_allocator()); __left->get_allocator());
size_t __depth = __result->_M_depth; size_t __depth = __result->_M_depth;
if (__depth > 20 && (__result->_M_size < 1000 || if (__depth > 20 && (__result->_M_size < 1000 ||
__depth > _RopeRep::_S_max_rope_depth)) __depth > _RopeRep::_S_max_rope_depth))
{ {
_RopeRep* __balanced; _RopeRep* __balanced;
try try
{ {
__balanced = _S_balance(__result); __balanced = _S_balance(__result);
__result->_M_unref_nonnil(); __result->_M_unref_nonnil();
} }
catch(...) catch(...)
{ {
_C_deallocate(__result,1); _C_deallocate(__result,1);
__throw_exception_again; __throw_exception_again;
} }
...@@ -487,8 +487,8 @@ rope<_CharT,_Alloc>::_S_tree_concat (_RopeRep* __left, _RopeRep* __right) ...@@ -487,8 +487,8 @@ rope<_CharT,_Alloc>::_S_tree_concat (_RopeRep* __left, _RopeRep* __right)
// still owns its children. Thus unref is // still owns its children. Thus unref is
// inappropriate. // inappropriate.
return __balanced; return __balanced;
} }
else else
return __result; return __result;
} }
...@@ -505,18 +505,18 @@ rope<_CharT,_Alloc>::_RopeRep* rope<_CharT,_Alloc>::_S_concat_char_iter ...@@ -505,18 +505,18 @@ rope<_CharT,_Alloc>::_RopeRep* rope<_CharT,_Alloc>::_S_concat_char_iter
if (0 == __r) if (0 == __r)
return __STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __slen, return __STL_ROPE_FROM_UNOWNED_CHAR_PTR(__s, __slen,
__r->get_allocator()); __r->get_allocator());
if (_RopeRep::_S_leaf == __r->_M_tag && if (_RopeRep::_S_leaf == __r->_M_tag &&
__r->_M_size + __slen <= _S_copy_max) { __r->_M_size + __slen <= _S_copy_max) {
__result = _S_leaf_concat_char_iter((_RopeLeaf*)__r, __s, __slen); __result = _S_leaf_concat_char_iter((_RopeLeaf*)__r, __s, __slen);
return __result; return __result;
} }
if (_RopeRep::_S_concat == __r->_M_tag if (_RopeRep::_S_concat == __r->_M_tag
&& _RopeRep::_S_leaf == ((_RopeConcatenation*)__r)->_M_right->_M_tag) { && _RopeRep::_S_leaf == ((_RopeConcatenation*)__r)->_M_right->_M_tag) {
_RopeLeaf* __right = _RopeLeaf* __right =
(_RopeLeaf* )(((_RopeConcatenation* )__r)->_M_right); (_RopeLeaf* )(((_RopeConcatenation* )__r)->_M_right);
if (__right->_M_size + __slen <= _S_copy_max) { if (__right->_M_size + __slen <= _S_copy_max) {
_RopeRep* __left = ((_RopeConcatenation*)__r)->_M_left; _RopeRep* __left = ((_RopeConcatenation*)__r)->_M_left;
_RopeRep* __nright = _RopeRep* __nright =
_S_leaf_concat_char_iter((_RopeLeaf*)__right, __s, __slen); _S_leaf_concat_char_iter((_RopeLeaf*)__right, __s, __slen);
__left->_M_ref_nonnil(); __left->_M_ref_nonnil();
try { try {
...@@ -524,7 +524,7 @@ rope<_CharT,_Alloc>::_RopeRep* rope<_CharT,_Alloc>::_S_concat_char_iter ...@@ -524,7 +524,7 @@ rope<_CharT,_Alloc>::_RopeRep* rope<_CharT,_Alloc>::_S_concat_char_iter
} }
catch(...) catch(...)
{ {
_S_unref(__left); _S_unref(__left);
_S_unref(__nright); _S_unref(__nright);
__throw_exception_again; __throw_exception_again;
} }
...@@ -539,7 +539,7 @@ rope<_CharT,_Alloc>::_RopeRep* rope<_CharT,_Alloc>::_S_concat_char_iter ...@@ -539,7 +539,7 @@ rope<_CharT,_Alloc>::_RopeRep* rope<_CharT,_Alloc>::_S_concat_char_iter
} }
catch(...) catch(...)
{ {
_S_unref(__r); _S_unref(__r);
_S_unref(__nright); _S_unref(__nright);
__throw_exception_again; __throw_exception_again;
} }
...@@ -548,7 +548,7 @@ rope<_CharT,_Alloc>::_RopeRep* rope<_CharT,_Alloc>::_S_concat_char_iter ...@@ -548,7 +548,7 @@ rope<_CharT,_Alloc>::_RopeRep* rope<_CharT,_Alloc>::_S_concat_char_iter
#ifndef __GC #ifndef __GC
template <class _CharT, class _Alloc> template <class _CharT, class _Alloc>
typename rope<_CharT,_Alloc>::_RopeRep* typename rope<_CharT,_Alloc>::_RopeRep*
rope<_CharT,_Alloc>::_S_destr_concat_char_iter( rope<_CharT,_Alloc>::_S_destr_concat_char_iter(
_RopeRep* __r, const _CharT* __s, size_t __slen) _RopeRep* __r, const _CharT* __s, size_t __slen)
{ {
...@@ -563,7 +563,7 @@ rope<_CharT,_Alloc>::_S_destr_concat_char_iter( ...@@ -563,7 +563,7 @@ rope<_CharT,_Alloc>::_S_destr_concat_char_iter(
__r->_M_ref_count = 2; // One more than before __r->_M_ref_count = 2; // One more than before
return __r; return __r;
} }
if (__orig_size + __slen <= _S_copy_max && if (__orig_size + __slen <= _S_copy_max &&
_RopeRep::_S_leaf == __r->_M_tag) { _RopeRep::_S_leaf == __r->_M_tag) {
__result = _S_destr_leaf_concat_char_iter((_RopeLeaf*)__r, __s, __slen); __result = _S_destr_leaf_concat_char_iter((_RopeLeaf*)__r, __s, __slen);
return __result; return __result;
...@@ -572,11 +572,11 @@ rope<_CharT,_Alloc>::_S_destr_concat_char_iter( ...@@ -572,11 +572,11 @@ rope<_CharT,_Alloc>::_S_destr_concat_char_iter(
_RopeLeaf* __right = (_RopeLeaf*)(((_RopeConcatenation*)__r)->_M_right); _RopeLeaf* __right = (_RopeLeaf*)(((_RopeConcatenation*)__r)->_M_right);
if (_RopeRep::_S_leaf == __right->_M_tag if (_RopeRep::_S_leaf == __right->_M_tag
&& __right->_M_size + __slen <= _S_copy_max) { && __right->_M_size + __slen <= _S_copy_max) {
_RopeRep* __new_right = _RopeRep* __new_right =
_S_destr_leaf_concat_char_iter(__right, __s, __slen); _S_destr_leaf_concat_char_iter(__right, __s, __slen);
if (__right == __new_right) if (__right == __new_right)
__new_right->_M_ref_count = 1; __new_right->_M_ref_count = 1;
else else
__right->_M_unref_nonnil(); __right->_M_unref_nonnil();
__r->_M_ref_count = 2; // One more than before. __r->_M_ref_count = 2; // One more than before.
((_RopeConcatenation*)__r)->_M_right = __new_right; ((_RopeConcatenation*)__r)->_M_right = __new_right;
...@@ -596,7 +596,7 @@ rope<_CharT,_Alloc>::_S_destr_concat_char_iter( ...@@ -596,7 +596,7 @@ rope<_CharT,_Alloc>::_S_destr_concat_char_iter(
} }
catch(...) catch(...)
{ {
_S_unref(__r); _S_unref(__r);
_S_unref(__right); _S_unref(__right);
__throw_exception_again; __throw_exception_again;
} }
...@@ -627,7 +627,7 @@ rope<_CharT,_Alloc>::_S_concat(_RopeRep* __left, _RopeRep* __right) ...@@ -627,7 +627,7 @@ rope<_CharT,_Alloc>::_S_concat(_RopeRep* __left, _RopeRep* __right)
&& _RopeRep::_S_leaf == && _RopeRep::_S_leaf ==
((_RopeConcatenation*)__left)->_M_right->_M_tag) { ((_RopeConcatenation*)__left)->_M_right->_M_tag) {
_RopeLeaf* __leftright = _RopeLeaf* __leftright =
(_RopeLeaf*)(((_RopeConcatenation*)__left)->_M_right); (_RopeLeaf*)(((_RopeConcatenation*)__left)->_M_right);
if (__leftright->_M_size + __right->_M_size <= _S_copy_max) { if (__leftright->_M_size + __right->_M_size <= _S_copy_max) {
_RopeRep* __leftleft = ((_RopeConcatenation*)__left)->_M_left; _RopeRep* __leftleft = ((_RopeConcatenation*)__left)->_M_left;
_RopeRep* __rest = _S_leaf_concat_char_iter(__leftright, _RopeRep* __rest = _S_leaf_concat_char_iter(__leftright,
...@@ -639,7 +639,7 @@ rope<_CharT,_Alloc>::_S_concat(_RopeRep* __left, _RopeRep* __right) ...@@ -639,7 +639,7 @@ rope<_CharT,_Alloc>::_S_concat(_RopeRep* __left, _RopeRep* __right)
} }
catch(...) catch(...)
{ {
_S_unref(__leftleft); _S_unref(__leftleft);
_S_unref(__rest); _S_unref(__rest);
__throw_exception_again; __throw_exception_again;
} }
...@@ -653,7 +653,7 @@ rope<_CharT,_Alloc>::_S_concat(_RopeRep* __left, _RopeRep* __right) ...@@ -653,7 +653,7 @@ rope<_CharT,_Alloc>::_S_concat(_RopeRep* __left, _RopeRep* __right)
} }
catch(...) catch(...)
{ {
_S_unref(__left); _S_unref(__left);
_S_unref(__right); _S_unref(__right);
__throw_exception_again; __throw_exception_again;
} }
...@@ -661,14 +661,14 @@ rope<_CharT,_Alloc>::_S_concat(_RopeRep* __left, _RopeRep* __right) ...@@ -661,14 +661,14 @@ rope<_CharT,_Alloc>::_S_concat(_RopeRep* __left, _RopeRep* __right)
template <class _CharT, class _Alloc> template <class _CharT, class _Alloc>
typename rope<_CharT,_Alloc>::_RopeRep* typename rope<_CharT,_Alloc>::_RopeRep*
rope<_CharT,_Alloc>::_S_substring(_RopeRep* __base, rope<_CharT,_Alloc>::_S_substring(_RopeRep* __base,
size_t __start, size_t __endp1) size_t __start, size_t __endp1)
{ {
if (0 == __base) return 0; if (0 == __base) return 0;
size_t __len = __base->_M_size; size_t __len = __base->_M_size;
size_t __adj_endp1; size_t __adj_endp1;
const size_t __lazy_threshold = 128; const size_t __lazy_threshold = 128;
if (__endp1 >= __len) { if (__endp1 >= __len) {
if (0 == __start) { if (0 == __start) {
__base->_M_ref_nonnil(); __base->_M_ref_nonnil();
...@@ -788,14 +788,14 @@ class _Rope_flatten_char_consumer : public _Rope_char_consumer<_CharT> { ...@@ -788,14 +788,14 @@ class _Rope_flatten_char_consumer : public _Rope_char_consumer<_CharT> {
return true; return true;
} }
}; };
template<class _CharT> template<class _CharT>
class _Rope_find_char_char_consumer : public _Rope_char_consumer<_CharT> { class _Rope_find_char_char_consumer : public _Rope_char_consumer<_CharT> {
private: private:
_CharT _M_pattern; _CharT _M_pattern;
public: public:
size_t _M_count; // Number of nonmatching characters 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) {}
~_Rope_find_char_char_consumer() {} ~_Rope_find_char_char_consumer() {}
bool operator() (const _CharT* __leaf, size_t __n) { bool operator() (const _CharT* __leaf, size_t __n) {
...@@ -808,7 +808,7 @@ class _Rope_find_char_char_consumer : public _Rope_char_consumer<_CharT> { ...@@ -808,7 +808,7 @@ class _Rope_find_char_char_consumer : public _Rope_char_consumer<_CharT> {
_M_count += __n; return true; _M_count += __n; return true;
} }
}; };
template<class _CharT, class _Traits> template<class _CharT, class _Traits>
// Here _CharT is both the stream and rope character type. // Here _CharT is both the stream and rope character type.
class _Rope_insert_char_consumer : public _Rope_char_consumer<_CharT> { class _Rope_insert_char_consumer : public _Rope_char_consumer<_CharT> {
...@@ -816,14 +816,14 @@ class _Rope_insert_char_consumer : public _Rope_char_consumer<_CharT> { ...@@ -816,14 +816,14 @@ class _Rope_insert_char_consumer : public _Rope_char_consumer<_CharT> {
typedef basic_ostream<_CharT,_Traits> _Insert_ostream; typedef 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, size_t __n);
// Returns true to continue traversal. // Returns true to continue traversal.
}; };
template<class _CharT, class _Traits> template<class _CharT, class _Traits>
bool _Rope_insert_char_consumer<_CharT, _Traits>::operator() bool _Rope_insert_char_consumer<_CharT, _Traits>::operator()
(const _CharT* __leaf, size_t __n) (const _CharT* __leaf, size_t __n)
...@@ -901,7 +901,7 @@ bool rope<_CharT, _Alloc>::_S_apply_to_pieces( ...@@ -901,7 +901,7 @@ bool rope<_CharT, _Alloc>::_S_apply_to_pieces(
for (__i = 0; __i < __n; __i++) __o.put(__f); for (__i = 0; __i < __n; __i++) __o.put(__f);
} }
template <class _CharT> inline bool _Rope_is_simple(_CharT*) { return false; } template <class _CharT> inline bool _Rope_is_simple(_CharT*) { return false; }
inline bool _Rope_is_simple(char*) { return true; } inline bool _Rope_is_simple(char*) { return true; }
...@@ -917,7 +917,7 @@ basic_ostream<_CharT, _Traits>& operator<< (basic_ostream<_CharT, _Traits>& __o, ...@@ -917,7 +917,7 @@ basic_ostream<_CharT, _Traits>& operator<< (basic_ostream<_CharT, _Traits>& __o,
size_t __rope_len = __r.size(); size_t __rope_len = __r.size();
_Rope_insert_char_consumer<_CharT, _Traits> __c(__o); _Rope_insert_char_consumer<_CharT, _Traits> __c(__o);
bool __is_simple = _Rope_is_simple((_CharT*)0); bool __is_simple = _Rope_is_simple((_CharT*)0);
if (__rope_len < __w) { if (__rope_len < __w) {
__pad_len = __w - __rope_len; __pad_len = __w - __rope_len;
} else { } else {
...@@ -937,7 +937,7 @@ basic_ostream<_CharT, _Traits>& operator<< (basic_ostream<_CharT, _Traits>& __o, ...@@ -937,7 +937,7 @@ basic_ostream<_CharT, _Traits>& operator<< (basic_ostream<_CharT, _Traits>& __o,
} }
catch(...) catch(...)
{ {
if (!__is_simple) if (!__is_simple)
__o.width(__w); __o.width(__w);
__throw_exception_again; __throw_exception_again;
} }
...@@ -1058,8 +1058,8 @@ rope<_CharT,_Alloc>::_S_dump(_RopeRep* __r, int __indent) ...@@ -1058,8 +1058,8 @@ rope<_CharT,_Alloc>::_S_dump(_RopeRep* __r, int __indent)
bool __too_big = __r->_M_size > __prefix->_M_size; bool __too_big = __r->_M_size > __prefix->_M_size;
_S_flatten(__prefix, __buffer); _S_flatten(__prefix, __buffer);
__buffer[__prefix->_M_size] = _S_eos((_CharT*)0); __buffer[__prefix->_M_size] = _S_eos((_CharT*)0);
printf("%s%s\n", printf("%s%s\n",
(char*)__buffer, __too_big? "...\n" : "\n"); (char*)__buffer, __too_big? "...\n" : "\n");
} else { } else {
printf("\n"); printf("\n");
...@@ -1097,11 +1097,11 @@ rope<_CharT,_Alloc>::_S_balance(_RopeRep* __r) ...@@ -1097,11 +1097,11 @@ rope<_CharT,_Alloc>::_S_balance(_RopeRep* __r)
// __forest[__i]._M_depth = __i // __forest[__i]._M_depth = __i
// References from forest are included in refcount. // References from forest are included in refcount.
for (__i = 0; __i <= _RopeRep::_S_max_rope_depth; ++__i) for (__i = 0; __i <= _RopeRep::_S_max_rope_depth; ++__i)
__forest[__i] = 0; __forest[__i] = 0;
try { try {
_S_add_to_forest(__r, __forest); _S_add_to_forest(__r, __forest);
for (__i = 0; __i <= _RopeRep::_S_max_rope_depth; ++__i) for (__i = 0; __i <= _RopeRep::_S_max_rope_depth; ++__i)
if (0 != __forest[__i]) { if (0 != __forest[__i]) {
# ifndef __GC # ifndef __GC
_Self_destruct_ptr __old(__result); _Self_destruct_ptr __old(__result);
...@@ -1148,9 +1148,9 @@ template <class _CharT, class _Alloc> ...@@ -1148,9 +1148,9 @@ template <class _CharT, class _Alloc>
void void
rope<_CharT,_Alloc>::_S_add_leaf_to_forest(_RopeRep* __r, _RopeRep** __forest) rope<_CharT,_Alloc>::_S_add_leaf_to_forest(_RopeRep* __r, _RopeRep** __forest)
{ {
_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; 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) {
...@@ -1180,7 +1180,7 @@ rope<_CharT,_Alloc>::_S_add_leaf_to_forest(_RopeRep* __r, _RopeRep** __forest) ...@@ -1180,7 +1180,7 @@ rope<_CharT,_Alloc>::_S_add_leaf_to_forest(_RopeRep* __r, _RopeRep** __forest)
__forest[__i]->_M_unref_nonnil(); __forest[__i]->_M_unref_nonnil();
__forest[__i] = 0; __forest[__i] = 0;
} }
if (__i == _RopeRep::_S_max_rope_depth || if (__i == _RopeRep::_S_max_rope_depth ||
__insertee->_M_size < _S_min_len[__i+1]) { __insertee->_M_size < _S_min_len[__i+1]) {
__forest[__i] = __insertee; __forest[__i] = __insertee;
// refcount is OK since __insertee is now dead. // refcount is OK since __insertee is now dead.
...@@ -1195,7 +1195,7 @@ rope<_CharT,_Alloc>::_S_fetch(_RopeRep* __r, size_type __i) ...@@ -1195,7 +1195,7 @@ rope<_CharT,_Alloc>::_S_fetch(_RopeRep* __r, size_type __i)
{ {
__GC_CONST _CharT* __cstr = __r->_M_c_string; __GC_CONST _CharT* __cstr = __r->_M_c_string;
if (0 != __cstr) return __cstr[__i]; if (0 != __cstr) return __cstr[__i];
for(;;) { for(;;) {
switch(__r->_M_tag) { switch(__r->_M_tag) {
case _RopeRep::_S_concat: case _RopeRep::_S_concat:
...@@ -1285,7 +1285,7 @@ rope<_CharT,_Alloc>::_S_fetch_ptr(_RopeRep* __r, size_type __i) ...@@ -1285,7 +1285,7 @@ rope<_CharT,_Alloc>::_S_fetch_ptr(_RopeRep* __r, size_type __i)
// flat strings. // flat strings.
template <class _CharT, class _Alloc> template <class _CharT, class _Alloc>
int int
rope<_CharT,_Alloc>::_S_compare (const _RopeRep* __left, rope<_CharT,_Alloc>::_S_compare (const _RopeRep* __left,
const _RopeRep* __right) const _RopeRep* __right)
{ {
size_t __left_len; size_t __left_len;
...@@ -1387,7 +1387,7 @@ rope<_CharT, _Alloc>::rope(size_t __n, _CharT __c, ...@@ -1387,7 +1387,7 @@ rope<_CharT, _Alloc>::rope(size_t __n, _CharT __c,
if (0 == __n) if (0 == __n)
return; return;
__exponent = __n / __exponentiate_threshold; __exponent = __n / __exponentiate_threshold;
__rest = __n % __exponentiate_threshold; __rest = __n % __exponentiate_threshold;
if (0 == __rest) { if (0 == __rest) {
...@@ -1419,12 +1419,12 @@ rope<_CharT, _Alloc>::rope(size_t __n, _CharT __c, ...@@ -1419,12 +1419,12 @@ rope<_CharT, _Alloc>::rope(size_t __n, _CharT __c,
} }
catch(...) catch(...)
{ {
_RopeRep::__STL_FREE_STRING(__base_buffer, _RopeRep::__STL_FREE_STRING(__base_buffer,
__exponentiate_threshold, __a); __exponentiate_threshold, __a);
__throw_exception_again; __throw_exception_again;
} }
__base_rope._M_tree_ptr = __base_leaf; __base_rope._M_tree_ptr = __base_leaf;
if (1 == __exponent) { if (1 == __exponent) {
__result = __base_rope; __result = __base_rope;
} else { } else {
__result = power(__base_rope, __exponent, __result = power(__base_rope, __exponent,
...@@ -1494,14 +1494,14 @@ _Rope_rotate(_Rope_iterator __first, ...@@ -1494,14 +1494,14 @@ _Rope_rotate(_Rope_iterator __first,
{ {
typedef typename _Rope_iterator::value_type _CharT; typedef typename _Rope_iterator::value_type _CharT;
typedef typename _Rope_iterator::_allocator_type _Alloc; typedef typename _Rope_iterator::_allocator_type _Alloc;
rope<_CharT,_Alloc>& __r(__first.container()); rope<_CharT,_Alloc>& __r(__first.container());
rope<_CharT,_Alloc> __prefix = __r.substr(0, __first.index()); rope<_CharT,_Alloc> __prefix = __r.substr(0, __first.index());
rope<_CharT,_Alloc> __suffix = rope<_CharT,_Alloc> __suffix =
__r.substr(__last.index(), __r.size() - __last.index()); __r.substr(__last.index(), __r.size() - __last.index());
rope<_CharT,_Alloc> __part1 = rope<_CharT,_Alloc> __part1 =
__r.substr(__middle.index(), __last.index() - __middle.index()); __r.substr(__middle.index(), __last.index() - __middle.index());
rope<_CharT,_Alloc> __part2 = rope<_CharT,_Alloc> __part2 =
__r.substr(__first.index(), __middle.index() - __first.index()); __r.substr(__first.index(), __middle.index() - __first.index());
__r = __prefix; __r = __prefix;
__r += __part1; __r += __part1;
......
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
#include <bits/concept_check.h> #include <bits/concept_check.h>
namespace __gnu_cxx namespace __gnu_cxx
{ {
using std::size_t; using std::size_t;
using std::ptrdiff_t; using std::ptrdiff_t;
using std::_Alloc_traits; using std::_Alloc_traits;
...@@ -79,7 +79,7 @@ __slist_make_link(_Slist_node_base* __prev_node, ...@@ -79,7 +79,7 @@ __slist_make_link(_Slist_node_base* __prev_node,
return __new_node; return __new_node;
} }
inline _Slist_node_base* inline _Slist_node_base*
__slist_previous(_Slist_node_base* __head, __slist_previous(_Slist_node_base* __head,
const _Slist_node_base* __node) const _Slist_node_base* __node)
{ {
...@@ -88,7 +88,7 @@ __slist_previous(_Slist_node_base* __head, ...@@ -88,7 +88,7 @@ __slist_previous(_Slist_node_base* __head,
return __head; return __head;
} }
inline const _Slist_node_base* inline const _Slist_node_base*
__slist_previous(const _Slist_node_base* __head, __slist_previous(const _Slist_node_base* __head,
const _Slist_node_base* __node) const _Slist_node_base* __node)
{ {
...@@ -206,7 +206,7 @@ struct _Slist_iterator : public _Slist_iterator_base ...@@ -206,7 +206,7 @@ struct _Slist_iterator : public _Slist_iterator_base
// an ordinary standard-conforming allocator, a standard-conforming // an ordinary standard-conforming allocator, a standard-conforming
// allocator with no non-static data, and an SGI-style allocator. // allocator with no non-static data, and an SGI-style allocator.
// This complexity is necessary only because we're worrying about backward // This complexity is necessary only because we're worrying about backward
// compatibility and because we want to avoid wasting storage on an // compatibility and because we want to avoid wasting storage on an
// allocator instance if it isn't necessary. // allocator instance if it isn't necessary.
// Base for general standard-conforming allocators. // Base for general standard-conforming allocators.
...@@ -220,9 +220,9 @@ public: ...@@ -220,9 +220,9 @@ public:
_Slist_alloc_base(const allocator_type& __a) : _M_node_allocator(__a) {} _Slist_alloc_base(const allocator_type& __a) : _M_node_allocator(__a) {}
protected: protected:
_Slist_node<_Tp>* _M_get_node() _Slist_node<_Tp>* _M_get_node()
{ return _M_node_allocator.allocate(1); } { return _M_node_allocator.allocate(1); }
void _M_put_node(_Slist_node<_Tp>* __p) void _M_put_node(_Slist_node<_Tp>* __p)
{ _M_node_allocator.deallocate(__p, 1); } { _M_node_allocator.deallocate(__p, 1); }
protected: protected:
...@@ -280,7 +280,7 @@ protected: ...@@ -280,7 +280,7 @@ protected:
_Slist_node_base* _M_erase_after(_Slist_node_base*, _Slist_node_base*); _Slist_node_base* _M_erase_after(_Slist_node_base*, _Slist_node_base*);
}; };
template <class _Tp, class _Alloc> template <class _Tp, class _Alloc>
_Slist_node_base* _Slist_node_base*
_Slist_base<_Tp,_Alloc>::_M_erase_after(_Slist_node_base* __before_first, _Slist_base<_Tp,_Alloc>::_M_erase_after(_Slist_node_base* __before_first,
_Slist_node_base* __last_node) { _Slist_node_base* __last_node) {
...@@ -341,7 +341,7 @@ private: ...@@ -341,7 +341,7 @@ private:
} }
return __node; return __node;
} }
_Node* _M_create_node() { _Node* _M_create_node() {
_Node* __node = this->_M_get_node(); _Node* __node = this->_M_get_node();
try { try {
...@@ -408,7 +408,7 @@ public: ...@@ -408,7 +408,7 @@ public:
public: public:
iterator begin() { return iterator((_Node*)this->_M_head._M_next); } iterator begin() { return iterator((_Node*)this->_M_head._M_next); }
const_iterator begin() const const_iterator begin() const
{ return const_iterator((_Node*)this->_M_head._M_next);} { return const_iterator((_Node*)this->_M_head._M_next);}
iterator end() { return iterator(0); } iterator end() { return iterator(0); }
...@@ -417,8 +417,8 @@ public: ...@@ -417,8 +417,8 @@ public:
// Experimental new feature: before_begin() returns a // Experimental new feature: before_begin() returns a
// non-dereferenceable iterator that, when incremented, yields // non-dereferenceable iterator that, when incremented, yields
// begin(). This iterator may be used as the argument to // begin(). This iterator may be used as the argument to
// insert_after, erase_after, etc. Note that even for an empty // insert_after, erase_after, etc. Note that even for an empty
// slist, before_begin() is not the same iterator as end(). It // slist, before_begin() is not the same iterator as end(). It
// is always necessary to increment before_begin() at least once to // is always necessary to increment before_begin() at least once to
// obtain end(). // obtain end().
iterator before_begin() { return iterator((_Node*) &this->_M_head); } iterator before_begin() { return iterator((_Node*) &this->_M_head); }
...@@ -426,7 +426,7 @@ public: ...@@ -426,7 +426,7 @@ public:
{ return const_iterator((_Node*) &this->_M_head); } { return const_iterator((_Node*) &this->_M_head); }
size_type size() const { return __slist_size(this->_M_head._M_next); } size_type size() const { return __slist_size(this->_M_head._M_next); }
size_type max_size() const { return size_type(-1); } size_type max_size() const { return size_type(-1); }
bool empty() const { return this->_M_head._M_next == 0; } bool empty() const { return this->_M_head._M_next == 0; }
...@@ -437,7 +437,7 @@ public: ...@@ -437,7 +437,7 @@ public:
public: public:
reference front() { return ((_Node*) this->_M_head._M_next)->_M_data; } reference front() { return ((_Node*) this->_M_head._M_next)->_M_data; }
const_reference front() const const_reference front() const
{ return ((_Node*) this->_M_head._M_next)->_M_data; } { return ((_Node*) this->_M_head._M_next)->_M_data; }
void push_front(const value_type& __x) { void push_front(const value_type& __x) {
__slist_make_link(&this->_M_head, _M_create_node(__x)); __slist_make_link(&this->_M_head, _M_create_node(__x));
...@@ -475,7 +475,7 @@ private: ...@@ -475,7 +475,7 @@ private:
// Check whether it's an integral type. If so, it's not an iterator. // Check whether it's an integral type. If so, it's not an iterator.
template <class _InIterator> template <class _InIterator>
void _M_insert_after_range(_Node_base* __pos, void _M_insert_after_range(_Node_base* __pos,
_InIterator __first, _InIterator __last) { _InIterator __first, _InIterator __last) {
typedef typename _Is_integer<_InIterator>::_Integral _Integral; typedef typename _Is_integer<_InIterator>::_Integral _Integral;
_M_insert_after_range(__pos, __first, __last, _Integral()); _M_insert_after_range(__pos, __first, __last, _Integral());
...@@ -533,13 +533,13 @@ public: ...@@ -533,13 +533,13 @@ public:
void insert(iterator __pos, size_type __n, const value_type& __x) { void insert(iterator __pos, size_type __n, const value_type& __x) {
_M_insert_after_fill(__slist_previous(&this->_M_head, __pos._M_node), _M_insert_after_fill(__slist_previous(&this->_M_head, __pos._M_node),
__n, __x); __n, __x);
} }
// We don't need any dispatching tricks here, because _M_insert_after_range // We don't need any dispatching tricks here, because _M_insert_after_range
// already does them. // already does them.
template <class _InIterator> template <class _InIterator>
void insert(iterator __pos, _InIterator __first, _InIterator __last) { void insert(iterator __pos, _InIterator __first, _InIterator __last) {
_M_insert_after_range(__slist_previous(&this->_M_head, __pos._M_node), _M_insert_after_range(__slist_previous(&this->_M_head, __pos._M_node),
__first, __last); __first, __last);
} }
...@@ -548,12 +548,12 @@ public: ...@@ -548,12 +548,12 @@ public:
return iterator((_Node*) this->_M_erase_after(__pos._M_node)); return iterator((_Node*) this->_M_erase_after(__pos._M_node));
} }
iterator erase_after(iterator __before_first, iterator __last) { iterator erase_after(iterator __before_first, iterator __last) {
return iterator((_Node*) this->_M_erase_after(__before_first._M_node, return iterator((_Node*) this->_M_erase_after(__before_first._M_node,
__last._M_node)); __last._M_node));
} }
iterator erase(iterator __pos) { iterator erase(iterator __pos) {
return (_Node*) this->_M_erase_after(__slist_previous(&this->_M_head, return (_Node*) this->_M_erase_after(__slist_previous(&this->_M_head,
__pos._M_node)); __pos._M_node));
} }
iterator erase(iterator __first, iterator __last) { iterator erase(iterator __first, iterator __last) {
...@@ -568,11 +568,11 @@ public: ...@@ -568,11 +568,11 @@ public:
public: public:
// Moves the range [__before_first + 1, __before_last + 1) to *this, // Moves the range [__before_first + 1, __before_last + 1) to *this,
// inserting it immediately after __pos. This is constant time. // inserting it immediately after __pos. This is constant time.
void splice_after(iterator __pos, void splice_after(iterator __pos,
iterator __before_first, iterator __before_last) iterator __before_first, iterator __before_last)
{ {
if (__before_first != __before_last) if (__before_first != __before_last)
__slist_splice_after(__pos._M_node, __before_first._M_node, __slist_splice_after(__pos._M_node, __before_first._M_node,
__before_last._M_node); __before_last._M_node);
} }
...@@ -618,27 +618,27 @@ public: ...@@ -618,27 +618,27 @@ public:
} }
public: public:
void reverse() { void reverse() {
if (this->_M_head._M_next) if (this->_M_head._M_next)
this->_M_head._M_next = __slist_reverse(this->_M_head._M_next); this->_M_head._M_next = __slist_reverse(this->_M_head._M_next);
} }
void remove(const _Tp& __val); void remove(const _Tp& __val);
void unique(); void unique();
void merge(slist& __x); void merge(slist& __x);
void sort(); void sort();
template <class _Predicate> template <class _Predicate>
void remove_if(_Predicate __pred); void remove_if(_Predicate __pred);
template <class _BinaryPredicate> template <class _BinaryPredicate>
void unique(_BinaryPredicate __pred); void unique(_BinaryPredicate __pred);
template <class _StrictWeakOrdering> template <class _StrictWeakOrdering>
void merge(slist&, _StrictWeakOrdering); void merge(slist&, _StrictWeakOrdering);
template <class _StrictWeakOrdering> template <class _StrictWeakOrdering>
void sort(_StrictWeakOrdering __comp); void sort(_StrictWeakOrdering __comp);
}; };
template <class _Tp, class _Alloc> template <class _Tp, class _Alloc>
...@@ -657,7 +657,7 @@ slist<_Tp,_Alloc>& slist<_Tp,_Alloc>::operator=(const slist<_Tp,_Alloc>& __x) ...@@ -657,7 +657,7 @@ slist<_Tp,_Alloc>& slist<_Tp,_Alloc>::operator=(const slist<_Tp,_Alloc>& __x)
if (__n2 == 0) if (__n2 == 0)
this->_M_erase_after(__p1, 0); this->_M_erase_after(__p1, 0);
else else
_M_insert_after_range(__p1, const_iterator((_Node*)__n2), _M_insert_after_range(__p1, const_iterator((_Node*)__n2),
const_iterator(0)); const_iterator(0));
} }
return *this; return *this;
...@@ -698,7 +698,7 @@ slist<_Tp, _Alloc>::_M_assign_dispatch(_InputIterator __first, _InputIterator __ ...@@ -698,7 +698,7 @@ slist<_Tp, _Alloc>::_M_assign_dispatch(_InputIterator __first, _InputIterator __
} }
template <class _Tp, class _Alloc> template <class _Tp, class _Alloc>
inline bool inline bool
operator==(const slist<_Tp,_Alloc>& _SL1, const slist<_Tp,_Alloc>& _SL2) operator==(const slist<_Tp,_Alloc>& _SL1, const slist<_Tp,_Alloc>& _SL2)
{ {
typedef typename slist<_Tp,_Alloc>::const_iterator const_iterator; typedef typename slist<_Tp,_Alloc>::const_iterator const_iterator;
...@@ -719,30 +719,30 @@ template <class _Tp, class _Alloc> ...@@ -719,30 +719,30 @@ template <class _Tp, class _Alloc>
inline bool inline bool
operator<(const slist<_Tp,_Alloc>& _SL1, const slist<_Tp,_Alloc>& _SL2) operator<(const slist<_Tp,_Alloc>& _SL1, const slist<_Tp,_Alloc>& _SL2)
{ {
return std::lexicographical_compare(_SL1.begin(), _SL1.end(), return std::lexicographical_compare(_SL1.begin(), _SL1.end(),
_SL2.begin(), _SL2.end()); _SL2.begin(), _SL2.end());
} }
template <class _Tp, class _Alloc> template <class _Tp, class _Alloc>
inline bool inline bool
operator!=(const slist<_Tp,_Alloc>& _SL1, const slist<_Tp,_Alloc>& _SL2) { operator!=(const slist<_Tp,_Alloc>& _SL1, const slist<_Tp,_Alloc>& _SL2) {
return !(_SL1 == _SL2); return !(_SL1 == _SL2);
} }
template <class _Tp, class _Alloc> template <class _Tp, class _Alloc>
inline bool inline bool
operator>(const slist<_Tp,_Alloc>& _SL1, const slist<_Tp,_Alloc>& _SL2) { operator>(const slist<_Tp,_Alloc>& _SL1, const slist<_Tp,_Alloc>& _SL2) {
return _SL2 < _SL1; return _SL2 < _SL1;
} }
template <class _Tp, class _Alloc> template <class _Tp, class _Alloc>
inline bool inline bool
operator<=(const slist<_Tp,_Alloc>& _SL1, const slist<_Tp,_Alloc>& _SL2) { operator<=(const slist<_Tp,_Alloc>& _SL1, const slist<_Tp,_Alloc>& _SL2) {
return !(_SL2 < _SL1); return !(_SL2 < _SL1);
} }
template <class _Tp, class _Alloc> template <class _Tp, class _Alloc>
inline bool inline bool
operator>=(const slist<_Tp,_Alloc>& _SL1, const slist<_Tp,_Alloc>& _SL2) { operator>=(const slist<_Tp,_Alloc>& _SL1, const slist<_Tp,_Alloc>& _SL2) {
return !(_SL1 < _SL2); return !(_SL1 < _SL2);
} }
...@@ -761,7 +761,7 @@ void slist<_Tp,_Alloc>::resize(size_type __len, const _Tp& __x) ...@@ -761,7 +761,7 @@ void slist<_Tp,_Alloc>::resize(size_type __len, const _Tp& __x)
--__len; --__len;
__cur = __cur->_M_next; __cur = __cur->_M_next;
} }
if (__cur->_M_next) if (__cur->_M_next)
this->_M_erase_after(__cur, 0); this->_M_erase_after(__cur, 0);
else else
_M_insert_after_fill(__cur, __len, __x); _M_insert_after_fill(__cur, __len, __x);
...@@ -779,13 +779,13 @@ void slist<_Tp,_Alloc>::remove(const _Tp& __val) ...@@ -779,13 +779,13 @@ void slist<_Tp,_Alloc>::remove(const _Tp& __val)
} }
} }
template <class _Tp, class _Alloc> template <class _Tp, class _Alloc>
void slist<_Tp,_Alloc>::unique() void slist<_Tp,_Alloc>::unique()
{ {
_Node_base* __cur = this->_M_head._M_next; _Node_base* __cur = this->_M_head._M_next;
if (__cur) { if (__cur) {
while (__cur->_M_next) { while (__cur->_M_next) {
if (((_Node*)__cur)->_M_data == if (((_Node*)__cur)->_M_data ==
((_Node*)(__cur->_M_next))->_M_data) ((_Node*)(__cur->_M_next))->_M_data)
this->_M_erase_after(__cur); this->_M_erase_after(__cur);
else else
...@@ -799,8 +799,8 @@ void slist<_Tp,_Alloc>::merge(slist<_Tp,_Alloc>& __x) ...@@ -799,8 +799,8 @@ void slist<_Tp,_Alloc>::merge(slist<_Tp,_Alloc>& __x)
{ {
_Node_base* __n1 = &this->_M_head; _Node_base* __n1 = &this->_M_head;
while (__n1->_M_next && __x._M_head._M_next) { while (__n1->_M_next && __x._M_head._M_next) {
if (((_Node*) __x._M_head._M_next)->_M_data < if (((_Node*) __x._M_head._M_next)->_M_data <
((_Node*) __n1->_M_next)->_M_data) ((_Node*) __n1->_M_next)->_M_data)
__slist_splice_after(__n1, &__x._M_head, __x._M_head._M_next); __slist_splice_after(__n1, &__x._M_head, __x._M_head._M_next);
__n1 = __n1->_M_next; __n1 = __n1->_M_next;
} }
...@@ -837,7 +837,7 @@ void slist<_Tp,_Alloc>::sort() ...@@ -837,7 +837,7 @@ void slist<_Tp,_Alloc>::sort()
} }
} }
template <class _Tp, class _Alloc> template <class _Tp, class _Alloc>
template <class _Predicate> template <class _Predicate>
void slist<_Tp,_Alloc>::remove_if(_Predicate __pred) void slist<_Tp,_Alloc>::remove_if(_Predicate __pred)
{ {
...@@ -850,13 +850,13 @@ void slist<_Tp,_Alloc>::remove_if(_Predicate __pred) ...@@ -850,13 +850,13 @@ void slist<_Tp,_Alloc>::remove_if(_Predicate __pred)
} }
} }
template <class _Tp, class _Alloc> template <class _BinaryPredicate> template <class _Tp, class _Alloc> template <class _BinaryPredicate>
void slist<_Tp,_Alloc>::unique(_BinaryPredicate __pred) void slist<_Tp,_Alloc>::unique(_BinaryPredicate __pred)
{ {
_Node* __cur = (_Node*) this->_M_head._M_next; _Node* __cur = (_Node*) this->_M_head._M_next;
if (__cur) { if (__cur) {
while (__cur->_M_next) { while (__cur->_M_next) {
if (__pred(((_Node*)__cur)->_M_data, if (__pred(((_Node*)__cur)->_M_data,
((_Node*)(__cur->_M_next))->_M_data)) ((_Node*)(__cur->_M_next))->_M_data))
this->_M_erase_after(__cur); this->_M_erase_after(__cur);
else else
...@@ -882,7 +882,7 @@ void slist<_Tp,_Alloc>::merge(slist<_Tp,_Alloc>& __x, ...@@ -882,7 +882,7 @@ void slist<_Tp,_Alloc>::merge(slist<_Tp,_Alloc>& __x,
} }
} }
template <class _Tp, class _Alloc> template <class _StrictWeakOrdering> template <class _Tp, class _Alloc> template <class _StrictWeakOrdering>
void slist<_Tp,_Alloc>::sort(_StrictWeakOrdering __comp) void slist<_Tp,_Alloc>::sort(_StrictWeakOrdering __comp)
{ {
if (this->_M_head._M_next && this->_M_head._M_next->_M_next) { if (this->_M_head._M_next && this->_M_head._M_next->_M_next) {
...@@ -930,7 +930,7 @@ public: ...@@ -930,7 +930,7 @@ public:
typedef void pointer; typedef void pointer;
typedef void reference; typedef void reference;
insert_iterator(_Container& __x, typename _Container::iterator __i) insert_iterator(_Container& __x, typename _Container::iterator __i)
: container(&__x) { : container(&__x) {
if (__i == __x.begin()) if (__i == __x.begin())
iter = __x.before_begin(); iter = __x.before_begin();
...@@ -939,7 +939,7 @@ public: ...@@ -939,7 +939,7 @@ public:
} }
insert_iterator<_Container>& insert_iterator<_Container>&
operator=(const typename _Container::value_type& __value) { operator=(const typename _Container::value_type& __value) {
iter = container->insert_after(iter, __value); iter = container->insert_after(iter, __value);
return *this; return *this;
} }
...@@ -950,4 +950,4 @@ public: ...@@ -950,4 +950,4 @@ public:
} // namespace std } // namespace std
#endif #endif
...@@ -54,13 +54,13 @@ namespace __gnu_cxx ...@@ -54,13 +54,13 @@ namespace __gnu_cxx
{ {
public: public:
// Types: // Types:
typedef _CharT char_type; typedef _CharT char_type;
typedef _Traits traits_type; typedef _Traits traits_type;
typedef typename traits_type::int_type int_type; typedef typename traits_type::int_type int_type;
typedef typename traits_type::pos_type pos_type; typedef typename traits_type::pos_type pos_type;
typedef typename traits_type::off_type off_type; typedef typename traits_type::off_type off_type;
typedef std::size_t size_t; typedef std::size_t size_t;
public: public:
/** /**
* @param fd An open file descriptor. * @param fd An open file descriptor.
...@@ -70,20 +70,20 @@ namespace __gnu_cxx ...@@ -70,20 +70,20 @@ namespace __gnu_cxx
* This constructor associates a file stream buffer with an open * This constructor associates a file stream buffer with an open
* POSIX file descriptor. * POSIX file descriptor.
*/ */
stdio_filebuf(int __fd, std::ios_base::openmode __mode, stdio_filebuf(int __fd, std::ios_base::openmode __mode,
size_t __size = static_cast<size_t>(BUFSIZ)); size_t __size = static_cast<size_t>(BUFSIZ));
/** /**
* @param f An open @c FILE*. * @param f An open @c FILE*.
* @param mode Same meaning as in a standard filebuf. * @param mode Same meaning as in a standard filebuf.
* @param size Optimal or preferred size of internal buffer, in chars. * @param size Optimal or preferred size of internal buffer, in chars.
* Defaults to system's @c BUFSIZ. * Defaults to system's @c BUFSIZ.
* *
* This constructor associates a file stream buffer with an open * This constructor associates a file stream buffer with an open
* C @c FILE*. The @c FILE* will not be automatically closed when the * C @c FILE*. The @c FILE* will not be automatically closed when the
* stdio_filebuf is closed/destroyed. * stdio_filebuf is closed/destroyed.
*/ */
stdio_filebuf(std::__c_file* __f, std::ios_base::openmode __mode, stdio_filebuf(std::__c_file* __f, std::ios_base::openmode __mode,
size_t __size = static_cast<size_t>(BUFSIZ)); size_t __size = static_cast<size_t>(BUFSIZ));
/** /**
...@@ -128,7 +128,7 @@ namespace __gnu_cxx ...@@ -128,7 +128,7 @@ namespace __gnu_cxx
template<typename _CharT, typename _Traits> template<typename _CharT, typename _Traits>
stdio_filebuf<_CharT, _Traits>:: stdio_filebuf<_CharT, _Traits>::
stdio_filebuf(std::__c_file* __f, std::ios_base::openmode __mode, stdio_filebuf(std::__c_file* __f, std::ios_base::openmode __mode,
size_t __size) size_t __size)
{ {
this->_M_file.sys_open(__f, __mode); this->_M_file.sys_open(__f, __mode);
...@@ -144,4 +144,4 @@ namespace __gnu_cxx ...@@ -144,4 +144,4 @@ namespace __gnu_cxx
} }
} // namespace __gnu_cxx } // namespace __gnu_cxx
#endif #endif
...@@ -61,22 +61,22 @@ namespace __gnu_cxx ...@@ -61,22 +61,22 @@ namespace __gnu_cxx
{ {
public: public:
// Types: // Types:
typedef _CharT char_type; typedef _CharT char_type;
typedef _Traits traits_type; typedef _Traits traits_type;
typedef typename traits_type::int_type int_type; typedef typename traits_type::int_type int_type;
typedef typename traits_type::pos_type pos_type; typedef typename traits_type::pos_type pos_type;
typedef typename traits_type::off_type off_type; typedef typename traits_type::off_type off_type;
private: private:
// Underlying stdio FILE // Underlying stdio FILE
std::__c_file* const _M_file; std::__c_file* const _M_file;
// Last character gotten. This is used when pbackfail is // Last character gotten. This is used when pbackfail is
// called from basic_streambuf::sungetc() // called from basic_streambuf::sungetc()
int_type _M_unget_buf; int_type _M_unget_buf;
public: public:
explicit explicit
stdio_sync_filebuf(std::__c_file* __f) stdio_sync_filebuf(std::__c_file* __f)
: _M_file(__f), _M_unget_buf(traits_type::eof()) : _M_file(__f), _M_unget_buf(traits_type::eof())
{ } { }
...@@ -131,10 +131,10 @@ namespace __gnu_cxx ...@@ -131,10 +131,10 @@ namespace __gnu_cxx
virtual std::streamsize virtual std::streamsize
xsgetn(char_type* __s, std::streamsize __n); xsgetn(char_type* __s, std::streamsize __n);
virtual std::streamsize virtual std::streamsize
showmanyc() showmanyc()
{ {
#if defined(_GLIBCXX_HAVE_S_ISREG) || defined(_GLIBCXX_HAVE_S_IFREG) #if defined(_GLIBCXX_HAVE_S_ISREG) || defined(_GLIBCXX_HAVE_S_IFREG)
// Regular files. // Regular files.
struct stat __buffer; struct stat __buffer;
...@@ -142,7 +142,7 @@ namespace __gnu_cxx ...@@ -142,7 +142,7 @@ namespace __gnu_cxx
if (!__ret && _GLIBCXX_ISREG(__buffer.st_mode)) if (!__ret && _GLIBCXX_ISREG(__buffer.st_mode))
return __buffer.st_size - ftell(_M_file); return __buffer.st_size - ftell(_M_file);
#endif #endif
return 0; return 0;
} }
virtual int_type virtual int_type
...@@ -183,7 +183,7 @@ namespace __gnu_cxx ...@@ -183,7 +183,7 @@ namespace __gnu_cxx
#ifdef _GLIBCXX_USE_LFS #ifdef _GLIBCXX_USE_LFS
if (!fseeko64(_M_file, __off, __whence)) if (!fseeko64(_M_file, __off, __whence))
__ret = std::streampos(ftello64(_M_file)); __ret = std::streampos(ftello64(_M_file));
#else #else
if (!fseek(_M_file, __off, __whence)) if (!fseek(_M_file, __off, __whence))
__ret = std::streampos(std::ftell(_M_file)); __ret = std::streampos(std::ftell(_M_file));
#endif #endif
...@@ -248,7 +248,7 @@ namespace __gnu_cxx ...@@ -248,7 +248,7 @@ namespace __gnu_cxx
template<> template<>
inline std::streamsize inline std::streamsize
stdio_sync_filebuf<wchar_t>::xsgetn(wchar_t* __s, std::streamsize __n) stdio_sync_filebuf<wchar_t>::xsgetn(wchar_t* __s, std::streamsize __n)
{ {
std::streamsize __ret = 0; std::streamsize __ret = 0;
const int_type __eof = traits_type::eof(); const int_type __eof = traits_type::eof();
while (__n--) while (__n--)
...@@ -266,10 +266,10 @@ namespace __gnu_cxx ...@@ -266,10 +266,10 @@ namespace __gnu_cxx
_M_unget_buf = traits_type::eof(); _M_unget_buf = traits_type::eof();
return __ret; return __ret;
} }
template<> template<>
inline std::streamsize inline std::streamsize
stdio_sync_filebuf<wchar_t>::xsputn(const wchar_t* __s, stdio_sync_filebuf<wchar_t>::xsputn(const wchar_t* __s,
std::streamsize __n) std::streamsize __n)
{ {
std::streamsize __ret = 0; std::streamsize __ret = 0;
...@@ -292,4 +292,4 @@ namespace __gnu_cxx ...@@ -292,4 +292,4 @@ namespace __gnu_cxx
#endif #endif
} // namespace __gnu_cxx } // namespace __gnu_cxx
#endif #endif
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