Commit 526da49c by Bernardo Innocenti Committed by Bernardo Innocenti

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

	* include/debug/bitset, include/debug/debug.h, include/debug/deque,
	include/debug/formatter.h, include/debug/hash_map.h,
	include/debug/hash_multimap.h, include/debug/hash_multiset.h,
	include/debug/hash_set, include/debug/hash_set.h, include/debug/list,
	include/debug/map.h, include/debug/multimap.h,
	include/debug/multiset.h, include/debug/safe_base.h,
	include/debug/safe_iterator.h, include/debug/safe_iterator.tcc,
	include/debug/safe_sequence.h, include/debug/set.h,
	include/debug/string, include/debug/vector: Remove trailing whitespace.

From-SVN: r74463
parent a6f86b51
2003-12-09 Bernardo Innocenti <bernie@develer.com> 2003-12-09 Bernardo Innocenti <bernie@develer.com>
* include/debug/bitset, include/debug/debug.h, include/debug/deque,
include/debug/formatter.h, include/debug/hash_map.h,
include/debug/hash_multimap.h, include/debug/hash_multiset.h,
include/debug/hash_set, include/debug/hash_set.h, include/debug/list,
include/debug/map.h, include/debug/multimap.h,
include/debug/multiset.h, include/debug/safe_base.h,
include/debug/safe_iterator.h, include/debug/safe_iterator.tcc,
include/debug/safe_sequence.h, include/debug/set.h,
include/debug/string, include/debug/vector: Remove trailing whitespace.
2003-12-09 Bernardo Innocenti <bernie@develer.com>
* include/c_compatibility/iso646.h, include/c_compatibility/limits.h, * include/c_compatibility/iso646.h, include/c_compatibility/limits.h,
include/c_compatibility/locale.h, include/c_compatibility/stdio.h, include/c_compatibility/locale.h, include/c_compatibility/stdio.h,
include/c_compatibility/string.h, include/c_compatibility/time.h, include/c_compatibility/string.h, include/c_compatibility/time.h,
......
...@@ -36,25 +36,25 @@ ...@@ -36,25 +36,25 @@
#include <debug/safe_iterator.h> #include <debug/safe_iterator.h>
namespace __gnu_debug_def namespace __gnu_debug_def
{ {
template<size_t _Nb> template<size_t _Nb>
class bitset class bitset
: public __gnu_norm::bitset<_Nb>, public __gnu_debug::_Safe_sequence_base : public __gnu_norm::bitset<_Nb>, public __gnu_debug::_Safe_sequence_base
{ {
typedef __gnu_norm::bitset<_Nb> _Base; typedef __gnu_norm::bitset<_Nb> _Base;
typedef __gnu_debug::_Safe_sequence_base _Safe_base; typedef __gnu_debug::_Safe_sequence_base _Safe_base;
public: public:
// bit reference: // bit reference:
class reference class reference
: private _Base::reference, public __gnu_debug::_Safe_iterator_base : private _Base::reference, public __gnu_debug::_Safe_iterator_base
{ {
typedef typename _Base::reference _Base_ref; typedef typename _Base::reference _Base_ref;
friend class bitset; friend class bitset;
reference(); reference();
reference(const _Base_ref& __base, bitset* __seq) reference(const _Base_ref& __base, bitset* __seq)
: _Base_ref(__base), _Safe_iterator_base(__seq, false) : _Base_ref(__base), _Safe_iterator_base(__seq, false)
{ } { }
...@@ -63,7 +63,7 @@ namespace __gnu_debug_def ...@@ -63,7 +63,7 @@ namespace __gnu_debug_def
: _Base_ref(__x), _Safe_iterator_base(__x, false) : _Base_ref(__x), _Safe_iterator_base(__x, false)
{ } { }
reference& reference&
operator=(bool __x) operator=(bool __x)
{ {
_GLIBCXX_DEBUG_VERIFY(! this->_M_singular(), _GLIBCXX_DEBUG_VERIFY(! this->_M_singular(),
...@@ -73,7 +73,7 @@ namespace __gnu_debug_def ...@@ -73,7 +73,7 @@ namespace __gnu_debug_def
return *this; return *this;
} }
reference& reference&
operator=(const reference& __x) operator=(const reference& __x)
{ {
_GLIBCXX_DEBUG_VERIFY(! __x._M_singular(), _GLIBCXX_DEBUG_VERIFY(! __x._M_singular(),
...@@ -85,8 +85,8 @@ namespace __gnu_debug_def ...@@ -85,8 +85,8 @@ namespace __gnu_debug_def
*static_cast<_Base_ref*>(this) = __x; *static_cast<_Base_ref*>(this) = __x;
return *this; return *this;
} }
bool bool
operator~() const operator~() const
{ {
_GLIBCXX_DEBUG_VERIFY(! this->_M_singular(), _GLIBCXX_DEBUG_VERIFY(! this->_M_singular(),
...@@ -94,7 +94,7 @@ namespace __gnu_debug_def ...@@ -94,7 +94,7 @@ namespace __gnu_debug_def
._M_iterator(*this)); ._M_iterator(*this));
return ~(*static_cast<const _Base_ref*>(this)); return ~(*static_cast<const _Base_ref*>(this));
} }
operator bool() const operator bool() const
{ {
_GLIBCXX_DEBUG_VERIFY(! this->_M_singular(), _GLIBCXX_DEBUG_VERIFY(! this->_M_singular(),
...@@ -102,8 +102,8 @@ namespace __gnu_debug_def ...@@ -102,8 +102,8 @@ namespace __gnu_debug_def
._M_iterator(*this)); ._M_iterator(*this));
return *static_cast<const _Base_ref*>(this); return *static_cast<const _Base_ref*>(this);
} }
reference& reference&
flip() flip()
{ {
_GLIBCXX_DEBUG_VERIFY(! this->_M_singular(), _GLIBCXX_DEBUG_VERIFY(! this->_M_singular(),
...@@ -116,170 +116,170 @@ namespace __gnu_debug_def ...@@ -116,170 +116,170 @@ namespace __gnu_debug_def
// 23.3.5.1 constructors: // 23.3.5.1 constructors:
bitset() : _Base() { } bitset() : _Base() { }
bitset(unsigned long __val) : _Base(__val) { } bitset(unsigned long __val) : _Base(__val) { }
template<typename _CharT, typename _Traits, typename _Allocator> template<typename _CharT, typename _Traits, typename _Allocator>
explicit explicit
bitset(const std::basic_string<_CharT,_Traits,_Allocator>& __str, bitset(const std::basic_string<_CharT,_Traits,_Allocator>& __str,
typename std::basic_string<_CharT,_Traits,_Allocator>::size_type typename std::basic_string<_CharT,_Traits,_Allocator>::size_type
__pos = 0, __pos = 0,
typename std::basic_string<_CharT,_Traits,_Allocator>::size_type typename std::basic_string<_CharT,_Traits,_Allocator>::size_type
__n = (std::basic_string<_CharT,_Traits,_Allocator>::npos)) __n = (std::basic_string<_CharT,_Traits,_Allocator>::npos))
: _Base(__str, __pos, __n) { } : _Base(__str, __pos, __n) { }
bitset(const _Base& __x) : _Base(__x), _Safe_base() { } bitset(const _Base& __x) : _Base(__x), _Safe_base() { }
// 23.3.5.2 bitset operations: // 23.3.5.2 bitset operations:
bitset<_Nb>& bitset<_Nb>&
operator&=(const bitset<_Nb>& __rhs) operator&=(const bitset<_Nb>& __rhs)
{ {
_M_base() &= __rhs; _M_base() &= __rhs;
return *this; return *this;
} }
bitset<_Nb>& bitset<_Nb>&
operator|=(const bitset<_Nb>& __rhs) operator|=(const bitset<_Nb>& __rhs)
{ {
_M_base() != __rhs; _M_base() != __rhs;
return *this; return *this;
} }
bitset<_Nb>& bitset<_Nb>&
operator^=(const bitset<_Nb>& __rhs) operator^=(const bitset<_Nb>& __rhs)
{ {
_M_base() ^= __rhs; _M_base() ^= __rhs;
return *this; return *this;
} }
bitset<_Nb>& bitset<_Nb>&
operator<<=(size_t __pos) operator<<=(size_t __pos)
{ {
_M_base() <<= __pos; _M_base() <<= __pos;
return *this; return *this;
} }
bitset<_Nb>& bitset<_Nb>&
operator>>=(size_t __pos) operator>>=(size_t __pos)
{ {
_M_base() >>= __pos; _M_base() >>= __pos;
return *this; return *this;
} }
bitset<_Nb>& bitset<_Nb>&
set() set()
{ {
_Base::set(); _Base::set();
return *this; return *this;
} }
// _GLIBCXX_RESOLVE_LIB_DEFECTS // _GLIBCXX_RESOLVE_LIB_DEFECTS
// 186. bitset::set() second parameter should be bool // 186. bitset::set() second parameter should be bool
bitset<_Nb>& bitset<_Nb>&
set(size_t __pos, bool __val = true) set(size_t __pos, bool __val = true)
{ {
_Base::set(__pos, __val); _Base::set(__pos, __val);
return *this; return *this;
} }
bitset<_Nb>& bitset<_Nb>&
reset() reset()
{ {
_Base::reset(); _Base::reset();
return *this; return *this;
} }
bitset<_Nb>& bitset<_Nb>&
reset(size_t __pos) reset(size_t __pos)
{ {
_Base::reset(__pos); _Base::reset(__pos);
return *this; return *this;
} }
bitset<_Nb> operator~() const { return bitset(~_M_base()); } bitset<_Nb> operator~() const { return bitset(~_M_base()); }
bitset<_Nb>& bitset<_Nb>&
flip() flip()
{ {
_Base::flip(); _Base::flip();
return *this; return *this;
} }
bitset<_Nb>& bitset<_Nb>&
flip(size_t __pos) flip(size_t __pos)
{ {
_Base::flip(__pos); _Base::flip(__pos);
return *this; return *this;
} }
// element access: // element access:
// _GLIBCXX_RESOLVE_LIB_DEFECTS // _GLIBCXX_RESOLVE_LIB_DEFECTS
// 11. Bitset minor problems // 11. Bitset minor problems
reference reference
operator[](size_t __pos) operator[](size_t __pos)
{ {
__glibcxx_check_subscript(__pos); __glibcxx_check_subscript(__pos);
return reference(_M_base()[__pos], this); return reference(_M_base()[__pos], this);
} }
// _GLIBCXX_RESOLVE_LIB_DEFECTS // _GLIBCXX_RESOLVE_LIB_DEFECTS
// 11. Bitset minor problems // 11. Bitset minor problems
bool bool
operator[](size_t __pos) const operator[](size_t __pos) const
{ {
__glibcxx_check_subscript(__pos); __glibcxx_check_subscript(__pos);
return _M_base()[__pos]; return _M_base()[__pos];
} }
using _Base::to_ulong; using _Base::to_ulong;
template <typename _CharT, typename _Traits, typename _Allocator> template <typename _CharT, typename _Traits, typename _Allocator>
std::basic_string<_CharT, _Traits, _Allocator> std::basic_string<_CharT, _Traits, _Allocator>
to_string() const to_string() const
{ return _M_base().template to_string<_CharT, _Traits, _Allocator>(); } { return _M_base().template to_string<_CharT, _Traits, _Allocator>(); }
using _Base::count; using _Base::count;
using _Base::size; using _Base::size;
bool bool
operator==(const bitset<_Nb>& __rhs) const operator==(const bitset<_Nb>& __rhs) const
{ return _M_base() == __rhs; } { return _M_base() == __rhs; }
bool bool
operator!=(const bitset<_Nb>& __rhs) const operator!=(const bitset<_Nb>& __rhs) const
{ return _M_base() != __rhs; } { return _M_base() != __rhs; }
using _Base::test; using _Base::test;
using _Base::any; using _Base::any;
using _Base::none; using _Base::none;
bitset<_Nb> bitset<_Nb>
operator<<(size_t __pos) const operator<<(size_t __pos) const
{ return bitset<_Nb>(_M_base() << __pos); } { return bitset<_Nb>(_M_base() << __pos); }
bitset<_Nb> bitset<_Nb>
operator>>(size_t __pos) const operator>>(size_t __pos) const
{ return bitset<_Nb>(_M_base() >> __pos); } { return bitset<_Nb>(_M_base() >> __pos); }
_Base& _Base&
_M_base() { return *this; } _M_base() { return *this; }
const _Base& const _Base&
_M_base() const { return *this; } _M_base() const { return *this; }
}; };
template<size_t _Nb> template<size_t _Nb>
bitset<_Nb> bitset<_Nb>
operator&(const bitset<_Nb>& __x, const bitset<_Nb>& __y) operator&(const bitset<_Nb>& __x, const bitset<_Nb>& __y)
{ return bitset<_Nb>(__x) &= __y; } { return bitset<_Nb>(__x) &= __y; }
template<size_t _Nb> template<size_t _Nb>
bitset<_Nb> bitset<_Nb>
operator|(const bitset<_Nb>& __x, const bitset<_Nb>& __y) operator|(const bitset<_Nb>& __x, const bitset<_Nb>& __y)
{ return bitset<_Nb>(__x) |= __y; } { return bitset<_Nb>(__x) |= __y; }
template<size_t _Nb> template<size_t _Nb>
bitset<_Nb> bitset<_Nb>
operator^(const bitset<_Nb>& __x, const bitset<_Nb>& __y) operator^(const bitset<_Nb>& __x, const bitset<_Nb>& __y)
{ return bitset<_Nb>(__x) ^= __y; } { return bitset<_Nb>(__x) ^= __y; }
...@@ -290,7 +290,7 @@ namespace __gnu_debug_def ...@@ -290,7 +290,7 @@ namespace __gnu_debug_def
template<typename _CharT, typename _Traits, size_t _Nb> template<typename _CharT, typename _Traits, size_t _Nb>
std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>&
operator<<(std::basic_ostream<_CharT, _Traits>& __os, operator<<(std::basic_ostream<_CharT, _Traits>& __os,
const bitset<_Nb>& __x) const bitset<_Nb>& __x)
{ return __os << __x._M_base(); } { return __os << __x._M_base(); }
} // namespace __gnu_debug_def } // namespace __gnu_debug_def
......
...@@ -174,7 +174,7 @@ _GLIBCXX_DEBUG_VERIFY(::__gnu_debug::__check_partitioned(_First, _Last, \ ...@@ -174,7 +174,7 @@ _GLIBCXX_DEBUG_VERIFY(::__gnu_debug::__check_partitioned(_First, _Last, \
_Value), \ _Value), \
_M_message(::__gnu_debug::__msg_unpartitioned) \ _M_message(::__gnu_debug::__msg_unpartitioned) \
._M_iterator(_First, #_First) \ ._M_iterator(_First, #_First) \
._M_iterator(_Last, #_Last) \ ._M_iterator(_Last, #_Last) \
._M_string(#_Value)) ._M_string(#_Value))
/** Verify that the iterator range [_First, _Last) is partitioned /** Verify that the iterator range [_First, _Last) is partitioned
...@@ -185,7 +185,7 @@ _GLIBCXX_DEBUG_VERIFY(::__gnu_debug::__check_partitioned(_First, _Last, \ ...@@ -185,7 +185,7 @@ _GLIBCXX_DEBUG_VERIFY(::__gnu_debug::__check_partitioned(_First, _Last, \
_Value, _Pred), \ _Value, _Pred), \
_M_message(::__gnu_debug::__msg_unpartitioned_pred) \ _M_message(::__gnu_debug::__msg_unpartitioned_pred) \
._M_iterator(_First, #_First) \ ._M_iterator(_First, #_First) \
._M_iterator(_Last, #_Last) \ ._M_iterator(_Last, #_Last) \
._M_string(#_Pred) \ ._M_string(#_Pred) \
._M_string(#_Value)) ._M_string(#_Value))
...@@ -267,7 +267,7 @@ _GLIBCXX_DEBUG_VERIFY(::std::__is_heap(_First, _Last, _Pred), \ ...@@ -267,7 +267,7 @@ _GLIBCXX_DEBUG_VERIFY(::std::__is_heap(_First, _Last, _Pred), \
# define __glibcxx_requires_string(_String) # define __glibcxx_requires_string(_String)
# define __glibcxx_requires_string_len(_String,_Len) # define __glibcxx_requires_string_len(_String,_Len)
# define __glibcxx_requires_subscript(_N) # define __glibcxx_requires_subscript(_N)
#endif #endif
#include <cassert> // TBD: temporary #include <cassert> // TBD: temporary
...@@ -277,11 +277,11 @@ _GLIBCXX_DEBUG_VERIFY(::std::__is_heap(_First, _Last, _Pred), \ ...@@ -277,11 +277,11 @@ _GLIBCXX_DEBUG_VERIFY(::std::__is_heap(_First, _Last, _Pred), \
namespace __gnu_debug namespace __gnu_debug
{ {
template<typename _Iterator, typename _Sequence> template<typename _Iterator, typename _Sequence>
class _Safe_iterator; class _Safe_iterator;
// An arbitrary iterator pointer is not singular. // An arbitrary iterator pointer is not singular.
inline bool inline bool
__check_singular_aux(const void*) { return false; } __check_singular_aux(const void*) { return false; }
// We may have an iterator that derives from _Safe_iterator_base but isn't // We may have an iterator that derives from _Safe_iterator_base but isn't
...@@ -323,11 +323,11 @@ namespace __gnu_debug ...@@ -323,11 +323,11 @@ namespace __gnu_debug
{ return __x._M_dereferenceable(); } { return __x._M_dereferenceable(); }
/** If the distance between two random access iterators is /** If the distance between two random access iterators is
* nonnegative, assume the range is valid. * nonnegative, assume the range is valid.
*/ */
template<typename _RandomAccessIterator> template<typename _RandomAccessIterator>
inline bool inline bool
__valid_range_aux2(const _RandomAccessIterator& __first, __valid_range_aux2(const _RandomAccessIterator& __first,
const _RandomAccessIterator& __last, const _RandomAccessIterator& __last,
std::random_access_iterator_tag) std::random_access_iterator_tag)
{ return __last - __first >= 0; } { return __last - __first >= 0; }
...@@ -344,7 +344,7 @@ namespace __gnu_debug ...@@ -344,7 +344,7 @@ namespace __gnu_debug
/** We say that integral types for a valid range, and defer to other /** We say that integral types for a valid range, and defer to other
* routines to realize what to do with integral types instead of * routines to realize what to do with integral types instead of
* iterators. * iterators.
*/ */
template<typename _Integral> template<typename _Integral>
inline bool inline bool
...@@ -356,12 +356,12 @@ namespace __gnu_debug ...@@ -356,12 +356,12 @@ namespace __gnu_debug
*/ */
template<typename _InputIterator> template<typename _InputIterator>
inline bool inline bool
__valid_range_aux(const _InputIterator& __first, __valid_range_aux(const _InputIterator& __first,
const _InputIterator& __last, __false_type) const _InputIterator& __last, __false_type)
{ {
typedef typename std::iterator_traits<_InputIterator>::iterator_category typedef typename std::iterator_traits<_InputIterator>::iterator_category
_Category; _Category;
return __gnu_debug::__valid_range_aux2(__first, __last, _Category()); return __gnu_debug::__valid_range_aux2(__first, __last, _Category());
} }
/** Don't know what these iterators are, or if they are even /** Don't know what these iterators are, or if they are even
...@@ -372,25 +372,25 @@ namespace __gnu_debug ...@@ -372,25 +372,25 @@ namespace __gnu_debug
template<typename _InputIterator> template<typename _InputIterator>
inline bool inline bool
__valid_range(const _InputIterator& __first, const _InputIterator& __last) __valid_range(const _InputIterator& __first, const _InputIterator& __last)
{ {
typedef typename _Is_integer<_InputIterator>::_Integral _Integral; typedef typename _Is_integer<_InputIterator>::_Integral _Integral;
return __gnu_debug::__valid_range_aux(__first, __last, _Integral()); return __gnu_debug::__valid_range_aux(__first, __last, _Integral());
} }
/** Safe iterators know how to check if they form a valid range. */ /** Safe iterators know how to check if they form a valid range. */
template<typename _Iterator, typename _Sequence> template<typename _Iterator, typename _Sequence>
inline bool inline bool
__valid_range(const _Safe_iterator<_Iterator, _Sequence>& __first, __valid_range(const _Safe_iterator<_Iterator, _Sequence>& __first,
const _Safe_iterator<_Iterator, _Sequence>& __last) const _Safe_iterator<_Iterator, _Sequence>& __last)
{ return __first._M_valid_range(__last); } { return __first._M_valid_range(__last); }
/* Checks that [first, last) is a valid range, and then returns /* Checks that [first, last) is a valid range, and then returns
* __first. This routine is useful when we can't use a separate * __first. This routine is useful when we can't use a separate
* assertion statement because, e.g., we are in a constructor. * assertion statement because, e.g., we are in a constructor.
*/ */
template<typename _InputIterator> template<typename _InputIterator>
inline _InputIterator inline _InputIterator
__check_valid_range(const _InputIterator& __first, __check_valid_range(const _InputIterator& __first,
const _InputIterator& __last) const _InputIterator& __last)
{ {
_GLIBCXX_DEBUG_ASSERT(__gnu_debug::__valid_range(__first, __last)); _GLIBCXX_DEBUG_ASSERT(__gnu_debug::__valid_range(__first, __last));
...@@ -422,7 +422,7 @@ namespace __gnu_debug ...@@ -422,7 +422,7 @@ namespace __gnu_debug
// Can't check if an input iterator sequence is sorted, because we // Can't check if an input iterator sequence is sorted, because we
// can't step through the sequence. // can't step through the sequence.
template<typename _InputIterator> template<typename _InputIterator>
inline bool inline bool
__check_sorted_aux(const _InputIterator&, const _InputIterator&, __check_sorted_aux(const _InputIterator&, const _InputIterator&,
std::input_iterator_tag) std::input_iterator_tag)
{ return true; } { return true; }
...@@ -433,7 +433,7 @@ namespace __gnu_debug ...@@ -433,7 +433,7 @@ namespace __gnu_debug
inline bool inline bool
__check_sorted_aux(_ForwardIterator __first, _ForwardIterator __last, __check_sorted_aux(_ForwardIterator __first, _ForwardIterator __last,
std::forward_iterator_tag) std::forward_iterator_tag)
{ {
if (__first == __last) if (__first == __last)
return true; return true;
...@@ -449,7 +449,7 @@ namespace __gnu_debug ...@@ -449,7 +449,7 @@ namespace __gnu_debug
// Can't check if an input iterator sequence is sorted, because we can't step // Can't check if an input iterator sequence is sorted, because we can't step
// through the sequence. // through the sequence.
template<typename _InputIterator, typename _Predicate> template<typename _InputIterator, typename _Predicate>
inline bool inline bool
__check_sorted_aux(const _InputIterator&, const _InputIterator&, __check_sorted_aux(const _InputIterator&, const _InputIterator&,
_Predicate, std::input_iterator_tag) _Predicate, std::input_iterator_tag)
{ return true; } { return true; }
...@@ -458,9 +458,9 @@ namespace __gnu_debug ...@@ -458,9 +458,9 @@ namespace __gnu_debug
// std::__is_sorted // std::__is_sorted
template<typename _ForwardIterator, typename _Predicate> template<typename _ForwardIterator, typename _Predicate>
inline bool inline bool
__check_sorted_aux(_ForwardIterator __first, _ForwardIterator __last, __check_sorted_aux(_ForwardIterator __first, _ForwardIterator __last,
_Predicate __pred, std::forward_iterator_tag) _Predicate __pred, std::forward_iterator_tag)
{ {
if (__first == __last) if (__first == __last)
return true; return true;
...@@ -477,8 +477,8 @@ namespace __gnu_debug ...@@ -477,8 +477,8 @@ namespace __gnu_debug
template<typename _InputIterator> template<typename _InputIterator>
inline bool inline bool
__check_sorted(const _InputIterator& __first, const _InputIterator& __last) __check_sorted(const _InputIterator& __first, const _InputIterator& __last)
{ {
typedef typename std::iterator_traits<_InputIterator>::iterator_category typedef typename std::iterator_traits<_InputIterator>::iterator_category
_Category; _Category;
return __gnu_debug::__check_sorted_aux(__first, __last, _Category()); return __gnu_debug::__check_sorted_aux(__first, __last, _Category());
} }
...@@ -487,15 +487,15 @@ namespace __gnu_debug ...@@ -487,15 +487,15 @@ namespace __gnu_debug
inline bool inline bool
__check_sorted(const _InputIterator& __first, const _InputIterator& __last, __check_sorted(const _InputIterator& __first, const _InputIterator& __last,
_Predicate __pred) _Predicate __pred)
{ {
typedef typename std::iterator_traits<_InputIterator>::iterator_category typedef typename std::iterator_traits<_InputIterator>::iterator_category
_Category; _Category;
return __gnu_debug::__check_sorted_aux(__first, __last, __pred, return __gnu_debug::__check_sorted_aux(__first, __last, __pred,
_Category()); _Category());
} }
// _GLIBCXX_RESOLVE_LIB_DEFECTS // _GLIBCXX_RESOLVE_LIB_DEFECTS
// 270. Binary search requirements overly strict // 270. Binary search requirements overly strict
// Determine if a sequence is partitioned w.r.t. this element. // Determine if a sequence is partitioned w.r.t. this element.
template<typename _ForwardIterator, typename _Tp> template<typename _ForwardIterator, typename _Tp>
inline bool inline bool
...@@ -528,4 +528,4 @@ namespace __gnu_debug ...@@ -528,4 +528,4 @@ namespace __gnu_debug
# include <debug/formatter.h> # include <debug/formatter.h>
#endif #endif
#endif #endif
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
namespace __gnu_debug_def namespace __gnu_debug_def
{ {
template<typename _Tp, typename _Allocator = std::allocator<_Tp> > template<typename _Tp, typename _Allocator = std::allocator<_Tp> >
class deque class deque
: public __gnu_norm::deque<_Tp, _Allocator>, : public __gnu_norm::deque<_Tp, _Allocator>,
public __gnu_debug::_Safe_sequence<deque<_Tp, _Allocator> > public __gnu_debug::_Safe_sequence<deque<_Tp, _Allocator> >
{ {
...@@ -48,17 +48,17 @@ namespace __gnu_debug_def ...@@ -48,17 +48,17 @@ namespace __gnu_debug_def
public: public:
typedef typename _Allocator::reference reference; typedef typename _Allocator::reference reference;
typedef typename _Allocator::const_reference const_reference; typedef typename _Allocator::const_reference const_reference;
typedef __gnu_debug::_Safe_iterator<typename _Base::iterator,deque> typedef __gnu_debug::_Safe_iterator<typename _Base::iterator,deque>
iterator; iterator;
typedef __gnu_debug::_Safe_iterator<typename _Base::const_iterator,deque> typedef __gnu_debug::_Safe_iterator<typename _Base::const_iterator,deque>
const_iterator; const_iterator;
typedef typename _Base::size_type size_type; typedef typename _Base::size_type size_type;
typedef typename _Base::difference_type difference_type; typedef typename _Base::difference_type difference_type;
typedef _Tp value_type; typedef _Tp value_type;
typedef _Allocator allocator_type; typedef _Allocator allocator_type;
typedef typename _Allocator::pointer pointer; typedef typename _Allocator::pointer pointer;
typedef typename _Allocator::const_pointer const_pointer; typedef typename _Allocator::const_pointer const_pointer;
typedef std::reverse_iterator<iterator> reverse_iterator; typedef std::reverse_iterator<iterator> reverse_iterator;
...@@ -81,19 +81,19 @@ namespace __gnu_debug_def ...@@ -81,19 +81,19 @@ namespace __gnu_debug_def
deque(const deque<_Tp,_Allocator>& __x) : _Base(__x), _Safe_base() { } deque(const deque<_Tp,_Allocator>& __x) : _Base(__x), _Safe_base() { }
deque(const _Base& __x) : _Base(__x), _Safe_base() { } deque(const _Base& __x) : _Base(__x), _Safe_base() { }
~deque() { } ~deque() { }
deque<_Tp,_Allocator>& deque<_Tp,_Allocator>&
operator=(const deque<_Tp,_Allocator>& __x) operator=(const deque<_Tp,_Allocator>& __x)
{ {
*static_cast<_Base*>(this) = __x; *static_cast<_Base*>(this) = __x;
this->_M_invalidate_all(); this->_M_invalidate_all();
return *this; return *this;
} }
template<class _InputIterator> template<class _InputIterator>
void void
assign(_InputIterator __first, _InputIterator __last) assign(_InputIterator __first, _InputIterator __last)
{ {
__glibcxx_check_valid_range(__first, __last); __glibcxx_check_valid_range(__first, __last);
...@@ -101,131 +101,131 @@ namespace __gnu_debug_def ...@@ -101,131 +101,131 @@ namespace __gnu_debug_def
this->_M_invalidate_all(); this->_M_invalidate_all();
} }
void void
assign(size_type __n, const _Tp& __t) assign(size_type __n, const _Tp& __t)
{ {
_Base::assign(__n, __t); _Base::assign(__n, __t);
this->_M_invalidate_all(); this->_M_invalidate_all();
} }
using _Base::get_allocator; using _Base::get_allocator;
// iterators: // iterators:
iterator iterator
begin() begin()
{ return iterator(_Base::begin(), this); } { return iterator(_Base::begin(), this); }
const_iterator const_iterator
begin() const begin() const
{ return const_iterator(_Base::begin(), this); } { return const_iterator(_Base::begin(), this); }
iterator iterator
end() end()
{ return iterator(_Base::end(), this); } { return iterator(_Base::end(), this); }
const_iterator const_iterator
end() const end() const
{ return const_iterator(_Base::end(), this); } { return const_iterator(_Base::end(), this); }
reverse_iterator reverse_iterator
rbegin() rbegin()
{ return reverse_iterator(end()); } { return reverse_iterator(end()); }
const_reverse_iterator const_reverse_iterator
rbegin() const rbegin() const
{ return const_reverse_iterator(end()); } { return const_reverse_iterator(end()); }
reverse_iterator reverse_iterator
rend() rend()
{ return reverse_iterator(begin()); } { return reverse_iterator(begin()); }
const_reverse_iterator const_reverse_iterator
rend() const rend() const
{ return const_reverse_iterator(begin()); } { return const_reverse_iterator(begin()); }
// 23.2.1.2 capacity: // 23.2.1.2 capacity:
using _Base::size; using _Base::size;
using _Base::max_size; using _Base::max_size;
void void
resize(size_type __sz, _Tp __c = _Tp()) resize(size_type __sz, _Tp __c = _Tp())
{ {
typedef typename _Base::const_iterator _Base_const_iterator; typedef typename _Base::const_iterator _Base_const_iterator;
typedef __gnu_debug::_After_nth_from<_Base_const_iterator> _After_nth; typedef __gnu_debug::_After_nth_from<_Base_const_iterator> _After_nth;
bool __invalidate_all = __sz > this->size(); bool __invalidate_all = __sz > this->size();
if (__sz < this->size()) if (__sz < this->size())
this->_M_invalidate_if(_After_nth(__sz, _M_base().begin())); this->_M_invalidate_if(_After_nth(__sz, _M_base().begin()));
_Base::resize(__sz, __c); _Base::resize(__sz, __c);
if (__invalidate_all) if (__invalidate_all)
this->_M_invalidate_all(); this->_M_invalidate_all();
} }
using _Base::empty; using _Base::empty;
// element access: // element access:
reference reference
operator[](size_type __n) operator[](size_type __n)
{ {
__glibcxx_check_subscript(__n); __glibcxx_check_subscript(__n);
return _M_base()[__n]; return _M_base()[__n];
} }
const_reference const_reference
operator[](size_type __n) const operator[](size_type __n) const
{ {
__glibcxx_check_subscript(__n); __glibcxx_check_subscript(__n);
return _M_base()[__n]; return _M_base()[__n];
} }
using _Base::at; using _Base::at;
reference reference
front() front()
{ {
__glibcxx_check_nonempty(); __glibcxx_check_nonempty();
return _Base::front(); return _Base::front();
} }
const_reference const_reference
front() const front() const
{ {
__glibcxx_check_nonempty(); __glibcxx_check_nonempty();
return _Base::front(); return _Base::front();
} }
reference reference
back() back()
{ {
__glibcxx_check_nonempty(); __glibcxx_check_nonempty();
return _Base::back(); return _Base::back();
} }
const_reference const_reference
back() const back() const
{ {
__glibcxx_check_nonempty(); __glibcxx_check_nonempty();
return _Base::back(); return _Base::back();
} }
// 23.2.1.3 modifiers: // 23.2.1.3 modifiers:
void void
push_front(const _Tp& __x) push_front(const _Tp& __x)
{ {
_Base::push_front(__x); _Base::push_front(__x);
this->_M_invalidate_all(); this->_M_invalidate_all();
} }
void void
push_back(const _Tp& __x) push_back(const _Tp& __x)
{ {
_Base::push_back(__x); _Base::push_back(__x);
this->_M_invalidate_all(); this->_M_invalidate_all();
} }
iterator iterator
insert(iterator __position, const _Tp& __x) insert(iterator __position, const _Tp& __x)
{ {
__glibcxx_check_insert(__position); __glibcxx_check_insert(__position);
...@@ -233,26 +233,26 @@ namespace __gnu_debug_def ...@@ -233,26 +233,26 @@ namespace __gnu_debug_def
this->_M_invalidate_all(); this->_M_invalidate_all();
return iterator(__res, this); return iterator(__res, this);
} }
void void
insert(iterator __position, size_type __n, const _Tp& __x) insert(iterator __position, size_type __n, const _Tp& __x)
{ {
__glibcxx_check_insert(__position); __glibcxx_check_insert(__position);
_Base::insert(__position.base(), __n, __x); _Base::insert(__position.base(), __n, __x);
this->_M_invalidate_all(); this->_M_invalidate_all();
} }
template<class _InputIterator> template<class _InputIterator>
void void
insert(iterator __position, insert(iterator __position,
_InputIterator __first, _InputIterator __last) _InputIterator __first, _InputIterator __last)
{ {
__glibcxx_check_insert_range(__position, __first, __last); __glibcxx_check_insert_range(__position, __first, __last);
_Base::insert(__position.base(), __first, __last); _Base::insert(__position.base(), __first, __last);
this->_M_invalidate_all(); this->_M_invalidate_all();
} }
void void
pop_front() pop_front()
{ {
__glibcxx_check_nonempty(); __glibcxx_check_nonempty();
...@@ -260,8 +260,8 @@ namespace __gnu_debug_def ...@@ -260,8 +260,8 @@ namespace __gnu_debug_def
__victim._M_invalidate(); __victim._M_invalidate();
_Base::pop_front(); _Base::pop_front();
} }
void void
pop_back() pop_back()
{ {
__glibcxx_check_nonempty(); __glibcxx_check_nonempty();
...@@ -270,8 +270,8 @@ namespace __gnu_debug_def ...@@ -270,8 +270,8 @@ namespace __gnu_debug_def
__victim._M_invalidate(); __victim._M_invalidate();
_Base::pop_back(); _Base::pop_back();
} }
iterator iterator
erase(iterator __position) erase(iterator __position)
{ {
__glibcxx_check_erase(__position); __glibcxx_check_erase(__position);
...@@ -287,8 +287,8 @@ namespace __gnu_debug_def ...@@ -287,8 +287,8 @@ namespace __gnu_debug_def
return iterator(__res, this); return iterator(__res, this);
} }
} }
iterator iterator
erase(iterator __first, iterator __last) erase(iterator __first, iterator __last)
{ {
// _GLIBCXX_RESOLVE_LIB_DEFECTS // _GLIBCXX_RESOLVE_LIB_DEFECTS
...@@ -302,10 +302,10 @@ namespace __gnu_debug_def ...@@ -302,10 +302,10 @@ namespace __gnu_debug_def
iterator __victim = __position++; iterator __victim = __position++;
__victim._M_invalidate(); __victim._M_invalidate();
} }
try try
{ {
return iterator(_Base::erase(__first.base(), __last.base()), return iterator(_Base::erase(__first.base(), __last.base()),
this); this);
} }
catch (...) catch (...)
{ {
...@@ -315,43 +315,43 @@ namespace __gnu_debug_def ...@@ -315,43 +315,43 @@ namespace __gnu_debug_def
} }
else else
{ {
typename _Base::iterator __res = _Base::erase(__first.base(), typename _Base::iterator __res = _Base::erase(__first.base(),
__last.base()); __last.base());
this->_M_invalidate_all(); this->_M_invalidate_all();
return iterator(__res, this); return iterator(__res, this);
} }
} }
void void
swap(deque<_Tp,_Allocator>& __x) swap(deque<_Tp,_Allocator>& __x)
{ {
_Base::swap(__x); _Base::swap(__x);
this->_M_swap(__x); this->_M_swap(__x);
} }
void void
clear() clear()
{ {
_Base::clear(); _Base::clear();
this->_M_invalidate_all(); this->_M_invalidate_all();
} }
_Base& _Base&
_M_base() { return *this; } _M_base() { return *this; }
const _Base& const _Base&
_M_base() const { return *this; } _M_base() const { return *this; }
}; };
template<typename _Tp, typename _Alloc> template<typename _Tp, typename _Alloc>
inline bool inline bool
operator==(const deque<_Tp, _Alloc>& __lhs, operator==(const deque<_Tp, _Alloc>& __lhs,
const deque<_Tp, _Alloc>& __rhs) const deque<_Tp, _Alloc>& __rhs)
{ return __lhs._M_base() == __rhs._M_base(); } { return __lhs._M_base() == __rhs._M_base(); }
template<typename _Tp, typename _Alloc> template<typename _Tp, typename _Alloc>
inline bool inline bool
operator!=(const deque<_Tp, _Alloc>& __lhs, operator!=(const deque<_Tp, _Alloc>& __lhs,
const deque<_Tp, _Alloc>& __rhs) const deque<_Tp, _Alloc>& __rhs)
{ return __lhs._M_base() != __rhs._M_base(); } { return __lhs._M_base() != __rhs._M_base(); }
...@@ -362,13 +362,13 @@ namespace __gnu_debug_def ...@@ -362,13 +362,13 @@ namespace __gnu_debug_def
template<typename _Tp, typename _Alloc> template<typename _Tp, typename _Alloc>
inline bool inline bool
operator<=(const deque<_Tp, _Alloc>& __lhs, operator<=(const deque<_Tp, _Alloc>& __lhs,
const deque<_Tp, _Alloc>& __rhs) const deque<_Tp, _Alloc>& __rhs)
{ return __lhs._M_base() <= __rhs._M_base(); } { return __lhs._M_base() <= __rhs._M_base(); }
template<typename _Tp, typename _Alloc> template<typename _Tp, typename _Alloc>
inline bool inline bool
operator>=(const deque<_Tp, _Alloc>& __lhs, operator>=(const deque<_Tp, _Alloc>& __lhs,
const deque<_Tp, _Alloc>& __rhs) const deque<_Tp, _Alloc>& __rhs)
{ return __lhs._M_base() >= __rhs._M_base(); } { return __lhs._M_base() >= __rhs._M_base(); }
......
...@@ -55,10 +55,10 @@ namespace __gnu_debug ...@@ -55,10 +55,10 @@ namespace __gnu_debug
class _Safe_sequence_base; class _Safe_sequence_base;
template<typename _Iterator, typename _Sequence> template<typename _Iterator, typename _Sequence>
class _Safe_iterator; class _Safe_iterator;
template<typename _Sequence> template<typename _Sequence>
class _Safe_sequence; class _Safe_sequence;
enum _Debug_msg_id enum _Debug_msg_id
...@@ -123,7 +123,7 @@ namespace __gnu_debug ...@@ -123,7 +123,7 @@ namespace __gnu_debug
__const_iterator, __const_iterator,
__mutable_iterator, __mutable_iterator,
__last_constness __last_constness
}; };
// The state of the iterator (fine-grained), if we know it. // The state of the iterator (fine-grained), if we know it.
enum _Iterator_state enum _Iterator_state
...@@ -143,29 +143,29 @@ namespace __gnu_debug ...@@ -143,29 +143,29 @@ namespace __gnu_debug
// A parameter that may be referenced by an error message // A parameter that may be referenced by an error message
struct _Parameter struct _Parameter
{ {
enum enum
{ {
__unused_param, __unused_param,
__iterator, __iterator,
__sequence, __sequence,
__integer, __integer,
__string __string
} _M_kind; } _M_kind;
union union
{ {
// When _M_kind == __iterator // When _M_kind == __iterator
struct struct
{ {
const char* _M_name; const char* _M_name;
const void* _M_address; const void* _M_address;
const type_info* _M_type; const type_info* _M_type;
_Constness _M_constness; _Constness _M_constness;
_Iterator_state _M_state; _Iterator_state _M_state;
const void* _M_sequence; const void* _M_sequence;
const type_info* _M_seq_type; const type_info* _M_seq_type;
} _M_iterator; } _M_iterator;
// When _M_kind == __sequence // When _M_kind == __sequence
struct struct
{ {
...@@ -190,17 +190,17 @@ namespace __gnu_debug ...@@ -190,17 +190,17 @@ namespace __gnu_debug
} _M_variant; } _M_variant;
_Parameter() : _M_kind(__unused_param) { } _Parameter() : _M_kind(__unused_param) { }
_Parameter(long __value, const char* __name) : _M_kind(__integer) _Parameter(long __value, const char* __name) : _M_kind(__integer)
{ {
_M_variant._M_integer._M_name = __name; _M_variant._M_integer._M_name = __name;
_M_variant._M_integer._M_value = __value; _M_variant._M_integer._M_value = __value;
} }
_Parameter(const char* __value, const char* __name) : _M_kind(__string) _Parameter(const char* __value, const char* __name) : _M_kind(__string)
{ {
_M_variant._M_string._M_name = __name; _M_variant._M_string._M_name = __name;
_M_variant._M_string._M_value = __value; _M_variant._M_string._M_value = __value;
} }
template<typename _Iterator, typename _Sequence> template<typename _Iterator, typename _Sequence>
...@@ -211,7 +211,7 @@ namespace __gnu_debug ...@@ -211,7 +211,7 @@ namespace __gnu_debug
_M_variant._M_iterator._M_name = __name; _M_variant._M_iterator._M_name = __name;
_M_variant._M_iterator._M_address = &__it; _M_variant._M_iterator._M_address = &__it;
_M_variant._M_iterator._M_type = &typeid(__it); _M_variant._M_iterator._M_type = &typeid(__it);
_M_variant._M_iterator._M_constness = _M_variant._M_iterator._M_constness =
__is_same<_Safe_iterator<_Iterator, _Sequence>, __is_same<_Safe_iterator<_Iterator, _Sequence>,
typename _Sequence::iterator>:: typename _Sequence::iterator>::
value? __mutable_iterator : __const_iterator; value? __mutable_iterator : __const_iterator;
...@@ -258,7 +258,7 @@ namespace __gnu_debug ...@@ -258,7 +258,7 @@ namespace __gnu_debug
_M_variant._M_iterator._M_sequence = 0; _M_variant._M_iterator._M_sequence = 0;
_M_variant._M_iterator._M_seq_type = 0; _M_variant._M_iterator._M_seq_type = 0;
} }
template<typename _Iterator> template<typename _Iterator>
_Parameter(const _Iterator& __it, const char* __name, _Is_iterator) _Parameter(const _Iterator& __it, const char* __name, _Is_iterator)
: _M_kind(__iterator) : _M_kind(__iterator)
...@@ -267,19 +267,19 @@ namespace __gnu_debug ...@@ -267,19 +267,19 @@ namespace __gnu_debug
_M_variant._M_iterator._M_address = &__it; _M_variant._M_iterator._M_address = &__it;
_M_variant._M_iterator._M_type = &typeid(__it); _M_variant._M_iterator._M_type = &typeid(__it);
_M_variant._M_iterator._M_constness = __unknown_constness; _M_variant._M_iterator._M_constness = __unknown_constness;
_M_variant._M_iterator._M_state = _M_variant._M_iterator._M_state =
__gnu_debug::__check_singular(__it)? __singular : __unknown_state; __gnu_debug::__check_singular(__it)? __singular : __unknown_state;
_M_variant._M_iterator._M_sequence = 0; _M_variant._M_iterator._M_sequence = 0;
_M_variant._M_iterator._M_seq_type = 0; _M_variant._M_iterator._M_seq_type = 0;
} }
template<typename _Sequence> template<typename _Sequence>
_Parameter(const _Safe_sequence<_Sequence>& __seq, _Parameter(const _Safe_sequence<_Sequence>& __seq,
const char* __name, _Is_sequence) const char* __name, _Is_sequence)
: _M_kind(__sequence) : _M_kind(__sequence)
{ {
_M_variant._M_sequence._M_name = __name; _M_variant._M_sequence._M_name = __name;
_M_variant._M_sequence._M_address = _M_variant._M_sequence._M_address =
static_cast<const _Sequence*>(&__seq); static_cast<const _Sequence*>(&__seq);
_M_variant._M_sequence._M_type = &typeid(_Sequence); _M_variant._M_sequence._M_type = &typeid(_Sequence);
} }
...@@ -292,18 +292,18 @@ namespace __gnu_debug ...@@ -292,18 +292,18 @@ namespace __gnu_debug
_M_variant._M_sequence._M_address = &__seq; _M_variant._M_sequence._M_address = &__seq;
_M_variant._M_sequence._M_type = &typeid(_Sequence); _M_variant._M_sequence._M_type = &typeid(_Sequence);
} }
void void
_M_print_field(const _Error_formatter* __formatter, _M_print_field(const _Error_formatter* __formatter,
const char* __name) const; const char* __name) const;
void void
_M_print_description(const _Error_formatter* __formatter) const; _M_print_description(const _Error_formatter* __formatter) const;
}; };
friend struct _Parameter; friend struct _Parameter;
public: public:
template<typename _Iterator> template<typename _Iterator>
const _Error_formatter& const _Error_formatter&
_M_iterator(const _Iterator& __it, const char* __name = 0) const _M_iterator(const _Iterator& __it, const char* __name = 0) const
...@@ -335,7 +335,7 @@ namespace __gnu_debug ...@@ -335,7 +335,7 @@ namespace __gnu_debug
_M_sequence(const _Sequence& __seq, const char* __name = 0) const _M_sequence(const _Sequence& __seq, const char* __name = 0) const
{ {
if (_M_num_parameters < __max_parameters) if (_M_num_parameters < __max_parameters)
_M_parameters[_M_num_parameters++] = _Parameter(__seq, __name, _M_parameters[_M_num_parameters++] = _Parameter(__seq, __name,
_Is_sequence()); _Is_sequence());
return *this; return *this;
} }
...@@ -347,7 +347,7 @@ namespace __gnu_debug ...@@ -347,7 +347,7 @@ namespace __gnu_debug
const _Error_formatter& const _Error_formatter&
_M_message(_Debug_msg_id __id) const; _M_message(_Debug_msg_id __id) const;
void void
_M_error() const; _M_error() const;
private: private:
...@@ -360,10 +360,10 @@ namespace __gnu_debug ...@@ -360,10 +360,10 @@ namespace __gnu_debug
void void
_M_format_word(char*, int, const char*, _Tp) const; _M_format_word(char*, int, const char*, _Tp) const;
void void
_M_print_word(const char* __word) const; _M_print_word(const char* __word) const;
void void
_M_print_string(const char* __string) const; _M_print_string(const char* __string) const;
enum { __max_parameters = 9 }; enum { __max_parameters = 9 };
...@@ -386,4 +386,4 @@ namespace __gnu_debug ...@@ -386,4 +386,4 @@ namespace __gnu_debug
}; };
} // namespace __gnu_debug } // namespace __gnu_debug
#endif #endif
...@@ -45,7 +45,7 @@ namespace __gnu_debug_def ...@@ -45,7 +45,7 @@ namespace __gnu_debug_def
public __gnu_debug::_Safe_sequence<hash_map<_Value, _Tp, _HashFcn, public __gnu_debug::_Safe_sequence<hash_map<_Value, _Tp, _HashFcn,
_EqualKey, _Alloc> > _EqualKey, _Alloc> >
{ {
typedef __gnu_cxx::hash_map<_Value, _Tp, _HashFcn, _EqualKey, _Alloc> typedef __gnu_cxx::hash_map<_Value, _Tp, _HashFcn, _EqualKey, _Alloc>
_Base; _Base;
typedef __gnu_debug::_Safe_sequence<hash_map> _Safe_base; typedef __gnu_debug::_Safe_sequence<hash_map> _Safe_base;
...@@ -62,29 +62,29 @@ namespace __gnu_debug_def ...@@ -62,29 +62,29 @@ namespace __gnu_debug_def
typedef typename _Base::const_pointer const_pointer; typedef typename _Base::const_pointer const_pointer;
typedef typename _Base::reference reference; typedef typename _Base::reference reference;
typedef typename _Base::const_reference const_reference; typedef typename _Base::const_reference const_reference;
typedef __gnu_debug::_Safe_iterator<typename _Base::iterator, hash_map> typedef __gnu_debug::_Safe_iterator<typename _Base::iterator, hash_map>
iterator; iterator;
typedef __gnu_debug::_Safe_iterator<typename _Base::const_iterator, typedef __gnu_debug::_Safe_iterator<typename _Base::const_iterator,
hash_map> hash_map>
const_iterator; const_iterator;
typedef typename _Base::allocator_type allocator_type; typedef typename _Base::allocator_type allocator_type;
using _Base::hash_funct; using _Base::hash_funct;
using _Base::key_eq; using _Base::key_eq;
using _Base::get_allocator; using _Base::get_allocator;
hash_map() { } hash_map() { }
explicit hash_map(size_type __n) : _Base(__n) { } explicit hash_map(size_type __n) : _Base(__n) { }
hash_map(size_type __n, const hasher& __hf) : _Base(__n, __hf) { } hash_map(size_type __n, const hasher& __hf) : _Base(__n, __hf) { }
hash_map(size_type __n, const hasher& __hf, const key_equal& __eql, hash_map(size_type __n, const hasher& __hf, const key_equal& __eql,
const allocator_type& __a = allocator_type()) const allocator_type& __a = allocator_type())
: _Base(__n, __hf, __eql, __a) { } : _Base(__n, __hf, __eql, __a) { }
template<typename _InputIterator> template<typename _InputIterator>
hash_map(_InputIterator __f, _InputIterator __l) hash_map(_InputIterator __f, _InputIterator __l)
: _Base(__gnu_debug::__check_valid_range(__f, __l), __l) { } : _Base(__gnu_debug::__check_valid_range(__f, __l), __l) { }
...@@ -110,102 +110,102 @@ namespace __gnu_debug_def ...@@ -110,102 +110,102 @@ namespace __gnu_debug_def
using _Base::size; using _Base::size;
using _Base::max_size; using _Base::max_size;
using _Base::empty; using _Base::empty;
void void
swap(hash_map& __x) swap(hash_map& __x)
{ {
_Base::swap(__x); _Base::swap(__x);
this->_M_swap(__x); this->_M_swap(__x);
} }
iterator iterator
begin() { return iterator(_Base::begin(), this); } begin() { return iterator(_Base::begin(), this); }
iterator iterator
end() { return iterator(_Base::end(), this); } end() { return iterator(_Base::end(), this); }
const_iterator const_iterator
begin() const begin() const
{ return const_iterator(_Base::begin(), this); } { return const_iterator(_Base::begin(), this); }
const_iterator const_iterator
end() const end() const
{ return const_iterator(_Base::end(), this); } { return const_iterator(_Base::end(), this); }
std::pair<iterator, bool> std::pair<iterator, bool>
insert(const value_type& __obj) insert(const value_type& __obj)
{ {
std::pair<typename _Base::iterator, bool> __res = _Base::insert(__obj); std::pair<typename _Base::iterator, bool> __res = _Base::insert(__obj);
return std::make_pair(iterator(__res.first, this), __res.second); return std::make_pair(iterator(__res.first, this), __res.second);
} }
template <typename _InputIterator> template <typename _InputIterator>
void void
insert(_InputIterator __first, _InputIterator __last) insert(_InputIterator __first, _InputIterator __last)
{ {
__glibcxx_check_valid_range(__first, __last); __glibcxx_check_valid_range(__first, __last);
_Base::insert(__first.base(), __last.base()); _Base::insert(__first.base(), __last.base());
} }
std::pair<iterator, bool> std::pair<iterator, bool>
insert_noresize(const value_type& __obj) insert_noresize(const value_type& __obj)
{ {
std::pair<typename _Base::iterator, bool> __res = std::pair<typename _Base::iterator, bool> __res =
_Base::insert_noresize(__obj); _Base::insert_noresize(__obj);
return std::make_pair(iterator(__res.first, this), __res.second); return std::make_pair(iterator(__res.first, this), __res.second);
} }
iterator iterator
find(const key_type& __key) find(const key_type& __key)
{ return iterator(_Base::find(__key), this); } { return iterator(_Base::find(__key), this); }
const_iterator const_iterator
find(const key_type& __key) const find(const key_type& __key) const
{ return const_iterator(_Base::find(__key), this); } { return const_iterator(_Base::find(__key), this); }
using _Base::operator[]; using _Base::operator[];
using _Base::count; using _Base::count;
std::pair<iterator, iterator> std::pair<iterator, iterator>
equal_range(const key_type& __key) equal_range(const key_type& __key)
{ {
typedef typename _Base::iterator _Base_iterator; typedef typename _Base::iterator _Base_iterator;
std::pair<_Base_iterator, _Base_iterator> __res = std::pair<_Base_iterator, _Base_iterator> __res =
_Base::equal_range(__key); _Base::equal_range(__key);
return std::make_pair(iterator(__res.first, this), return std::make_pair(iterator(__res.first, this),
iterator(__res.second, this)); iterator(__res.second, this));
} }
std::pair<const_iterator, const_iterator> std::pair<const_iterator, const_iterator>
equal_range(const key_type& __key) const equal_range(const key_type& __key) const
{ {
typedef typename _Base::const_iterator _Base_iterator; typedef typename _Base::const_iterator _Base_iterator;
std::pair<_Base_iterator, _Base_iterator> __res = std::pair<_Base_iterator, _Base_iterator> __res =
_Base::equal_range(__key); _Base::equal_range(__key);
return std::make_pair(const_iterator(__res.first, this), return std::make_pair(const_iterator(__res.first, this),
const_iterator(__res.second, this)); const_iterator(__res.second, this));
} }
size_type size_type
erase(const key_type& __key) erase(const key_type& __key)
{ {
iterator __victim(_Base::find(__key), this); iterator __victim(_Base::find(__key), this);
if (__victim != end()) if (__victim != end())
return this->erase(__victim), 1; return this->erase(__victim), 1;
else else
return 0; return 0;
} }
void void
erase(iterator __it) erase(iterator __it)
{ {
__glibcxx_check_erase(__it); __glibcxx_check_erase(__it);
__it._M_invalidate(); __it._M_invalidate();
_Base::erase(__it.base()); _Base::erase(__it.base());
} }
void void
erase(iterator __first, iterator __last) erase(iterator __first, iterator __last)
{ {
__glibcxx_check_erase_range(__first, __last); __glibcxx_check_erase_range(__first, __last);
...@@ -216,27 +216,27 @@ namespace __gnu_debug_def ...@@ -216,27 +216,27 @@ namespace __gnu_debug_def
} }
_Base::erase(__first.base(), __last.base()); _Base::erase(__first.base(), __last.base());
} }
void void
clear() clear()
{ {
_Base::clear(); _Base::clear();
this->_M_invalidate_all(); this->_M_invalidate_all();
} }
using _Base::resize; using _Base::resize;
using _Base::bucket_count; using _Base::bucket_count;
using _Base::max_bucket_count; using _Base::max_bucket_count;
using _Base::elems_in_bucket; using _Base::elems_in_bucket;
_Base& _Base&
_M_base() { return *this; } _M_base() { return *this; }
const _Base& const _Base&
_M_base() const { return *this; } _M_base() const { return *this; }
private: private:
void void
_M_invalidate_all() _M_invalidate_all()
{ {
typedef typename _Base::const_iterator _Base_const_iterator; typedef typename _Base::const_iterator _Base_const_iterator;
...@@ -244,22 +244,22 @@ namespace __gnu_debug_def ...@@ -244,22 +244,22 @@ namespace __gnu_debug_def
this->_M_invalidate_if(_Not_equal(_M_base().end())); this->_M_invalidate_if(_Not_equal(_M_base().end()));
} }
}; };
template<typename _Value, typename _Tp, typename _HashFcn, template<typename _Value, typename _Tp, typename _HashFcn,
typename _EqualKey, typename _Alloc> typename _EqualKey, typename _Alloc>
inline bool inline bool
operator==(const hash_map<_Value, _Tp, _HashFcn, _EqualKey, _Alloc>& __x, operator==(const hash_map<_Value, _Tp, _HashFcn, _EqualKey, _Alloc>& __x,
const hash_map<_Value, _Tp, _HashFcn, _EqualKey, _Alloc>& __y) const hash_map<_Value, _Tp, _HashFcn, _EqualKey, _Alloc>& __y)
{ return __x._M_base() == __y._M_base(); } { return __x._M_base() == __y._M_base(); }
template<typename _Value, typename _Tp, typename _HashFcn, template<typename _Value, typename _Tp, typename _HashFcn,
typename _EqualKey, typename _Alloc> typename _EqualKey, typename _Alloc>
inline bool inline bool
operator!=(const hash_map<_Value, _Tp, _HashFcn, _EqualKey, _Alloc>& __x, operator!=(const hash_map<_Value, _Tp, _HashFcn, _EqualKey, _Alloc>& __x,
const hash_map<_Value, _Tp, _HashFcn, _EqualKey, _Alloc>& __y) const hash_map<_Value, _Tp, _HashFcn, _EqualKey, _Alloc>& __y)
{ return __x._M_base() != __y._M_base(); } { return __x._M_base() != __y._M_base(); }
template<typename _Value, typename _Tp, typename _HashFcn, template<typename _Value, typename _Tp, typename _HashFcn,
typename _EqualKey, typename _Alloc> typename _EqualKey, typename _Alloc>
inline void inline void
swap(hash_map<_Value, _Tp, _HashFcn, _EqualKey, _Alloc>& __x, swap(hash_map<_Value, _Tp, _HashFcn, _EqualKey, _Alloc>& __x,
...@@ -267,4 +267,4 @@ namespace __gnu_debug_def ...@@ -267,4 +267,4 @@ namespace __gnu_debug_def
{ __x.swap(__y); } { __x.swap(__y); }
} // namespace __gnu_debug_def } // namespace __gnu_debug_def
#endif #endif
...@@ -46,24 +46,24 @@ namespace __gnu_debug_def ...@@ -46,24 +46,24 @@ namespace __gnu_debug_def
_EqualKey, _Alloc> > _EqualKey, _Alloc> >
{ {
typedef __gnu_cxx::hash_multimap<_Value,_Tp,_HashFcn, _EqualKey,_Alloc> typedef __gnu_cxx::hash_multimap<_Value,_Tp,_HashFcn, _EqualKey,_Alloc>
_Base; _Base;
typedef __gnu_debug::_Safe_sequence<hash_multimap> _Safe_base; typedef __gnu_debug::_Safe_sequence<hash_multimap> _Safe_base;
public: public:
typedef typename _Base::key_type key_type; typedef typename _Base::key_type key_type;
typedef typename _Base::data_type data_type; typedef typename _Base::data_type data_type;
typedef typename _Base::mapped_type mapped_type; typedef typename _Base::mapped_type mapped_type;
typedef typename _Base::value_type value_type; typedef typename _Base::value_type value_type;
typedef typename _Base::hasher hasher; typedef typename _Base::hasher hasher;
typedef typename _Base::key_equal key_equal; typedef typename _Base::key_equal key_equal;
typedef typename _Base::size_type size_type; typedef typename _Base::size_type size_type;
typedef typename _Base::difference_type difference_type; typedef typename _Base::difference_type difference_type;
typedef typename _Base::pointer pointer; typedef typename _Base::pointer pointer;
typedef typename _Base::const_pointer const_pointer; typedef typename _Base::const_pointer const_pointer;
typedef typename _Base::reference reference; typedef typename _Base::reference reference;
typedef typename _Base::const_reference const_reference; typedef typename _Base::const_reference const_reference;
typedef __gnu_debug::_Safe_iterator<typename _Base::iterator, typedef __gnu_debug::_Safe_iterator<typename _Base::iterator,
hash_multimap> iterator; hash_multimap> iterator;
typedef __gnu_debug::_Safe_iterator<typename _Base::const_iterator, typedef __gnu_debug::_Safe_iterator<typename _Base::const_iterator,
hash_multimap> const_iterator; hash_multimap> const_iterator;
...@@ -73,17 +73,17 @@ namespace __gnu_debug_def ...@@ -73,17 +73,17 @@ namespace __gnu_debug_def
using _Base::hash_funct; using _Base::hash_funct;
using _Base::key_eq; using _Base::key_eq;
using _Base::get_allocator; using _Base::get_allocator;
hash_multimap() { } hash_multimap() { }
explicit hash_multimap(size_type __n) : _Base(__n) { } explicit hash_multimap(size_type __n) : _Base(__n) { }
hash_multimap(size_type __n, const hasher& __hf) : _Base(__n, __hf) { } hash_multimap(size_type __n, const hasher& __hf) : _Base(__n, __hf) { }
hash_multimap(size_type __n, const hasher& __hf, const key_equal& __eql, hash_multimap(size_type __n, const hasher& __hf, const key_equal& __eql,
const allocator_type& __a = allocator_type()) const allocator_type& __a = allocator_type())
: _Base(__n, __hf, __eql, __a) { } : _Base(__n, __hf, __eql, __a) { }
template<typename _InputIterator> template<typename _InputIterator>
hash_multimap(_InputIterator __f, _InputIterator __l) hash_multimap(_InputIterator __f, _InputIterator __l)
: _Base(__gnu_debug::__check_valid_range(__f, __l), __l) { } : _Base(__gnu_debug::__check_valid_range(__f, __l), __l) { }
...@@ -107,96 +107,96 @@ namespace __gnu_debug_def ...@@ -107,96 +107,96 @@ namespace __gnu_debug_def
using _Base::size; using _Base::size;
using _Base::max_size; using _Base::max_size;
using _Base::empty; using _Base::empty;
void void
swap(hash_multimap& __x) swap(hash_multimap& __x)
{ {
_Base::swap(__x); _Base::swap(__x);
this->_M_swap(__x); this->_M_swap(__x);
} }
iterator iterator
begin() { return iterator(_Base::begin(), this); } begin() { return iterator(_Base::begin(), this); }
iterator iterator
end() { return iterator(_Base::end(), this); } end() { return iterator(_Base::end(), this); }
const_iterator const_iterator
begin() const begin() const
{ return const_iterator(_Base::begin(), this); } { return const_iterator(_Base::begin(), this); }
const_iterator const_iterator
end() const end() const
{ return const_iterator(_Base::end(), this); } { return const_iterator(_Base::end(), this); }
iterator iterator
insert(const value_type& __obj) insert(const value_type& __obj)
{ return iterator(_Base::insert(__obj), this); } { return iterator(_Base::insert(__obj), this); }
template <typename _InputIterator> template <typename _InputIterator>
void void
insert(_InputIterator __first, _InputIterator __last) insert(_InputIterator __first, _InputIterator __last)
{ {
__glibcxx_check_valid_range(__first, __last); __glibcxx_check_valid_range(__first, __last);
_Base::insert(__first.base(), __last.base()); _Base::insert(__first.base(), __last.base());
} }
iterator iterator
insert_noresize(const value_type& __obj) insert_noresize(const value_type& __obj)
{ return iterator(_Base::insert_noresize(__obj), this); } { return iterator(_Base::insert_noresize(__obj), this); }
iterator iterator
find(const key_type& __key) find(const key_type& __key)
{ return iterator(_Base::find(__key), this); } { return iterator(_Base::find(__key), this); }
const_iterator const_iterator
find(const key_type& __key) const find(const key_type& __key) const
{ return const_iterator(_Base::find(__key), this); } { return const_iterator(_Base::find(__key), this); }
using _Base::count; using _Base::count;
std::pair<iterator, iterator> std::pair<iterator, iterator>
equal_range(const key_type& __key) equal_range(const key_type& __key)
{ {
typedef typename _Base::iterator _Base_iterator; typedef typename _Base::iterator _Base_iterator;
std::pair<_Base_iterator, _Base_iterator> __res = std::pair<_Base_iterator, _Base_iterator> __res =
_Base::equal_range(__key); _Base::equal_range(__key);
return std::make_pair(iterator(__res.first, this), return std::make_pair(iterator(__res.first, this),
iterator(__res.second, this)); iterator(__res.second, this));
} }
std::pair<const_iterator, const_iterator> std::pair<const_iterator, const_iterator>
equal_range(const key_type& __key) const equal_range(const key_type& __key) const
{ {
typedef typename _Base::const_iterator _Base_iterator; typedef typename _Base::const_iterator _Base_iterator;
std::pair<_Base_iterator, _Base_iterator> __res = std::pair<_Base_iterator, _Base_iterator> __res =
_Base::equal_range(__key); _Base::equal_range(__key);
return std::make_pair(const_iterator(__res.first, this), return std::make_pair(const_iterator(__res.first, this),
const_iterator(__res.second, this)); const_iterator(__res.second, this));
} }
size_type size_type
erase(const key_type& __key) erase(const key_type& __key)
{ {
std::pair<iterator, iterator> __victims = this->equal_range(__key); std::pair<iterator, iterator> __victims = this->equal_range(__key);
size_t __num_victims = 0; size_t __num_victims = 0;
while (__victims.first != __victims.second) while (__victims.first != __victims.second)
{ {
this->erase(__victims.first++); this->erase(__victims.first++);
++__num_victims; ++__num_victims;
} }
return __num_victims; return __num_victims;
} }
void void
erase(iterator __it) erase(iterator __it)
{ {
__glibcxx_check_erase(__it); __glibcxx_check_erase(__it);
__it._M_invalidate(); __it._M_invalidate();
_Base::erase(__it.base()); _Base::erase(__it.base());
} }
void void
erase(iterator __first, iterator __last) erase(iterator __first, iterator __last)
{ {
__glibcxx_check_erase_range(__first, __last); __glibcxx_check_erase_range(__first, __last);
...@@ -207,27 +207,27 @@ namespace __gnu_debug_def ...@@ -207,27 +207,27 @@ namespace __gnu_debug_def
} }
_Base::erase(__first.base(), __last.base()); _Base::erase(__first.base(), __last.base());
} }
void void
clear() clear()
{ {
_Base::clear(); _Base::clear();
this->_M_invalidate_all(); this->_M_invalidate_all();
} }
using _Base::resize; using _Base::resize;
using _Base::bucket_count; using _Base::bucket_count;
using _Base::max_bucket_count; using _Base::max_bucket_count;
using _Base::elems_in_bucket; using _Base::elems_in_bucket;
_Base& _Base&
_M_base() { return *this; } _M_base() { return *this; }
const _Base& const _Base&
_M_base() const { return *this; } _M_base() const { return *this; }
private: private:
void void
_M_invalidate_all() _M_invalidate_all()
{ {
typedef typename _Base::const_iterator _Base_const_iterator; typedef typename _Base::const_iterator _Base_const_iterator;
...@@ -235,22 +235,22 @@ namespace __gnu_debug_def ...@@ -235,22 +235,22 @@ namespace __gnu_debug_def
this->_M_invalidate_if(_Not_equal(_M_base().end())); this->_M_invalidate_if(_Not_equal(_M_base().end()));
} }
}; };
template<typename _Value, typename _Tp, typename _HashFcn, template<typename _Value, typename _Tp, typename _HashFcn,
typename _EqualKey, typename _Alloc> typename _EqualKey, typename _Alloc>
inline bool inline bool
operator==(const hash_multimap<_Value,_Tp,_HashFcn,_EqualKey,_Alloc>& __x, operator==(const hash_multimap<_Value,_Tp,_HashFcn,_EqualKey,_Alloc>& __x,
const hash_multimap<_Value,_Tp,_HashFcn,_EqualKey,_Alloc>& __y) const hash_multimap<_Value,_Tp,_HashFcn,_EqualKey,_Alloc>& __y)
{ return __x._M_base() == __y._M_base(); } { return __x._M_base() == __y._M_base(); }
template<typename _Value, typename _Tp, typename _HashFcn, template<typename _Value, typename _Tp, typename _HashFcn,
typename _EqualKey, typename _Alloc> typename _EqualKey, typename _Alloc>
inline bool inline bool
operator!=(const hash_multimap<_Value,_Tp,_HashFcn,_EqualKey,_Alloc>& __x, operator!=(const hash_multimap<_Value,_Tp,_HashFcn,_EqualKey,_Alloc>& __x,
const hash_multimap<_Value,_Tp,_HashFcn,_EqualKey,_Alloc>& __y) const hash_multimap<_Value,_Tp,_HashFcn,_EqualKey,_Alloc>& __y)
{ return __x._M_base() != __y._M_base(); } { return __x._M_base() != __y._M_base(); }
template<typename _Value, typename _Tp, typename _HashFcn, template<typename _Value, typename _Tp, typename _HashFcn,
typename _EqualKey, typename _Alloc> typename _EqualKey, typename _Alloc>
inline void inline void
swap(hash_multimap<_Value, _Tp, _HashFcn, _EqualKey, _Alloc>& __x, swap(hash_multimap<_Value, _Tp, _HashFcn, _EqualKey, _Alloc>& __x,
......
...@@ -46,22 +46,22 @@ namespace __gnu_debug_def ...@@ -46,22 +46,22 @@ namespace __gnu_debug_def
_EqualKey, _Alloc> > _EqualKey, _Alloc> >
{ {
typedef __gnu_cxx:: hash_multiset<_Value,_HashFcn, _EqualKey,_Alloc> typedef __gnu_cxx:: hash_multiset<_Value,_HashFcn, _EqualKey,_Alloc>
_Base; _Base;
typedef __gnu_debug::_Safe_sequence<hash_multiset> _Safe_base; typedef __gnu_debug::_Safe_sequence<hash_multiset> _Safe_base;
public: public:
typedef typename _Base::key_type key_type; typedef typename _Base::key_type key_type;
typedef typename _Base::value_type value_type; typedef typename _Base::value_type value_type;
typedef typename _Base::hasher hasher; typedef typename _Base::hasher hasher;
typedef typename _Base::key_equal key_equal; typedef typename _Base::key_equal key_equal;
typedef typename _Base::size_type size_type; typedef typename _Base::size_type size_type;
typedef typename _Base::difference_type difference_type; typedef typename _Base::difference_type difference_type;
typedef typename _Base::pointer pointer; typedef typename _Base::pointer pointer;
typedef typename _Base::const_pointer const_pointer; typedef typename _Base::const_pointer const_pointer;
typedef typename _Base::reference reference; typedef typename _Base::reference reference;
typedef typename _Base::const_reference const_reference; typedef typename _Base::const_reference const_reference;
typedef __gnu_debug::_Safe_iterator<typename _Base::iterator, typedef __gnu_debug::_Safe_iterator<typename _Base::iterator,
hash_multiset> iterator; hash_multiset> iterator;
typedef __gnu_debug::_Safe_iterator<typename _Base::const_iterator, typedef __gnu_debug::_Safe_iterator<typename _Base::const_iterator,
hash_multiset> const_iterator; hash_multiset> const_iterator;
...@@ -82,7 +82,7 @@ namespace __gnu_debug_def ...@@ -82,7 +82,7 @@ namespace __gnu_debug_def
const allocator_type& __a = allocator_type()) const allocator_type& __a = allocator_type())
: _Base(__n, __hf, __eql, __a) : _Base(__n, __hf, __eql, __a)
{ } { }
template<typename _InputIterator> template<typename _InputIterator>
hash_multiset(_InputIterator __f, _InputIterator __l) hash_multiset(_InputIterator __f, _InputIterator __l)
: _Base(__gnu_debug::__check_valid_range(__f, __l), __l) : _Base(__gnu_debug::__check_valid_range(__f, __l), __l)
...@@ -113,7 +113,7 @@ namespace __gnu_debug_def ...@@ -113,7 +113,7 @@ namespace __gnu_debug_def
using _Base::max_size; using _Base::max_size;
using _Base::empty; using _Base::empty;
void void
swap(hash_multiset& __x) swap(hash_multiset& __x)
{ {
_Base::swap(__x); _Base::swap(__x);
...@@ -128,8 +128,8 @@ namespace __gnu_debug_def ...@@ -128,8 +128,8 @@ namespace __gnu_debug_def
{ return iterator(_Base::insert(__obj), this); } { return iterator(_Base::insert(__obj), this); }
template <typename _InputIterator> template <typename _InputIterator>
void void
insert(_InputIterator __first, _InputIterator __last) insert(_InputIterator __first, _InputIterator __last)
{ {
__glibcxx_check_valid_range(__first, __last); __glibcxx_check_valid_range(__first, __last);
_Base::insert(__first.base(), __last.base()); _Base::insert(__first.base(), __last.base());
...@@ -140,24 +140,24 @@ namespace __gnu_debug_def ...@@ -140,24 +140,24 @@ namespace __gnu_debug_def
insert_noresize(const value_type& __obj) insert_noresize(const value_type& __obj)
{ return iterator(_Base::insert_noresize(__obj), this); } { return iterator(_Base::insert_noresize(__obj), this); }
iterator iterator
find(const key_type& __key) const find(const key_type& __key) const
{ return iterator(_Base::find(__key), this); } { return iterator(_Base::find(__key), this); }
using _Base::count; using _Base::count;
std::pair<iterator, iterator> std::pair<iterator, iterator>
equal_range(const key_type& __key) const equal_range(const key_type& __key) const
{ {
typedef typename _Base::iterator _Base_iterator; typedef typename _Base::iterator _Base_iterator;
std::pair<_Base_iterator, _Base_iterator> __res = std::pair<_Base_iterator, _Base_iterator> __res =
_Base::equal_range(__key); _Base::equal_range(__key);
return std::make_pair(iterator(__res.first, this), return std::make_pair(iterator(__res.first, this),
iterator(__res.second, this)); iterator(__res.second, this));
} }
size_type size_type
erase(const key_type& __key) erase(const key_type& __key)
{ {
size_type __count = 0; size_type __count = 0;
std::pair<iterator, iterator> __victims = this->equal_range(__key); std::pair<iterator, iterator> __victims = this->equal_range(__key);
...@@ -168,16 +168,16 @@ namespace __gnu_debug_def ...@@ -168,16 +168,16 @@ namespace __gnu_debug_def
} }
return __count; return __count;
} }
void void
erase(iterator __it) erase(iterator __it)
{ {
__glibcxx_check_erase(__it); __glibcxx_check_erase(__it);
__it._M_invalidate(); __it._M_invalidate();
_Base::erase(__it.base()); _Base::erase(__it.base());
} }
void void
erase(iterator __first, iterator __last) erase(iterator __first, iterator __last)
{ {
__glibcxx_check_erase_range(__first, __last); __glibcxx_check_erase_range(__first, __last);
...@@ -189,11 +189,11 @@ namespace __gnu_debug_def ...@@ -189,11 +189,11 @@ namespace __gnu_debug_def
_Base::erase(__first.base(), __last.base()); _Base::erase(__first.base(), __last.base());
} }
void void
clear() clear()
{ {
_Base::clear(); _Base::clear();
this->_M_invalidate_all(); this->_M_invalidate_all();
} }
using _Base::resize; using _Base::resize;
...@@ -205,7 +205,7 @@ namespace __gnu_debug_def ...@@ -205,7 +205,7 @@ namespace __gnu_debug_def
const _Base& _M_base() const { return *this; } const _Base& _M_base() const { return *this; }
private: private:
void void
_M_invalidate_all() _M_invalidate_all()
{ {
typedef typename _Base::const_iterator _Base_const_iterator; typedef typename _Base::const_iterator _Base_const_iterator;
......
...@@ -35,4 +35,4 @@ ...@@ -35,4 +35,4 @@
#include <debug/dbg_hash_set.h> #include <debug/dbg_hash_set.h>
#include <debug/dbg_hash_multiset.h> #include <debug/dbg_hash_multiset.h>
#endif #endif
...@@ -47,7 +47,7 @@ namespace __gnu_debug_def ...@@ -47,7 +47,7 @@ namespace __gnu_debug_def
{ {
typedef __gnu_cxx::hash_set<_Value, _HashFcn, _EqualKey, _Alloc> _Base; typedef __gnu_cxx::hash_set<_Value, _HashFcn, _EqualKey, _Alloc> _Base;
typedef __gnu_debug::_Safe_sequence<hash_set> _Safe_base; typedef __gnu_debug::_Safe_sequence<hash_set> _Safe_base;
public: public:
typedef typename _Base::key_type key_type; typedef typename _Base::key_type key_type;
typedef typename _Base::value_type value_type; typedef typename _Base::value_type value_type;
...@@ -67,21 +67,21 @@ namespace __gnu_debug_def ...@@ -67,21 +67,21 @@ namespace __gnu_debug_def
const_iterator; const_iterator;
typedef typename _Base::allocator_type allocator_type; typedef typename _Base::allocator_type allocator_type;
using _Base::hash_funct; using _Base::hash_funct;
using _Base::key_eq; using _Base::key_eq;
using _Base::get_allocator; using _Base::get_allocator;
hash_set() { } hash_set() { }
explicit hash_set(size_type __n) : _Base(__n) { } explicit hash_set(size_type __n) : _Base(__n) { }
hash_set(size_type __n, const hasher& __hf) : _Base(__n, __hf) { } hash_set(size_type __n, const hasher& __hf) : _Base(__n, __hf) { }
hash_set(size_type __n, const hasher& __hf, const key_equal& __eql, hash_set(size_type __n, const hasher& __hf, const key_equal& __eql,
const allocator_type& __a = allocator_type()) const allocator_type& __a = allocator_type())
: _Base(__n, __hf, __eql, __a) { } : _Base(__n, __hf, __eql, __a) { }
template<typename _InputIterator> template<typename _InputIterator>
hash_set(_InputIterator __f, _InputIterator __l) hash_set(_InputIterator __f, _InputIterator __l)
: _Base(__gnu_debug::__check_valid_range(__f, __l), __l) { } : _Base(__gnu_debug::__check_valid_range(__f, __l), __l) { }
...@@ -103,67 +103,67 @@ namespace __gnu_debug_def ...@@ -103,67 +103,67 @@ namespace __gnu_debug_def
__eql, __a) { } __eql, __a) { }
hash_set(const _Base& __x) : _Base(__x), _Safe_base() { } hash_set(const _Base& __x) : _Base(__x), _Safe_base() { }
using _Base::size; using _Base::size;
using _Base::max_size; using _Base::max_size;
using _Base::empty; using _Base::empty;
void void
swap(hash_set& __x) swap(hash_set& __x)
{ {
_Base::swap(__x); _Base::swap(__x);
this->_M_swap(__x); this->_M_swap(__x);
} }
iterator iterator
begin() const { return iterator(_Base::begin(), this); } begin() const { return iterator(_Base::begin(), this); }
iterator iterator
end() const { return iterator(_Base::end(), this); } end() const { return iterator(_Base::end(), this); }
std::pair<iterator, bool> std::pair<iterator, bool>
insert(const value_type& __obj) insert(const value_type& __obj)
{ {
std::pair<typename _Base::iterator, bool> __res = std::pair<typename _Base::iterator, bool> __res =
_Base::insert(__obj); _Base::insert(__obj);
return std::make_pair(iterator(__res.first, this), __res.second); return std::make_pair(iterator(__res.first, this), __res.second);
} }
template <typename _InputIterator> template <typename _InputIterator>
void void
insert(_InputIterator __first, _InputIterator __last) insert(_InputIterator __first, _InputIterator __last)
{ {
__glibcxx_check_valid_range(__first, __last); __glibcxx_check_valid_range(__first, __last);
_Base::insert(__first.base(), __last.base()); _Base::insert(__first.base(), __last.base());
} }
std::pair<iterator, bool>
std::pair<iterator, bool>
insert_noresize(const value_type& __obj) insert_noresize(const value_type& __obj)
{ {
std::pair<typename _Base::iterator, bool> __res = std::pair<typename _Base::iterator, bool> __res =
_Base::insert_noresize(__obj); _Base::insert_noresize(__obj);
return std::make_pair(iterator(__res.first, this), __res.second); return std::make_pair(iterator(__res.first, this), __res.second);
} }
iterator iterator
find(const key_type& __key) const find(const key_type& __key) const
{ return iterator(_Base::find(__key), this); } { return iterator(_Base::find(__key), this); }
using _Base::count; using _Base::count;
std::pair<iterator, iterator> std::pair<iterator, iterator>
equal_range(const key_type& __key) const equal_range(const key_type& __key) const
{ {
typedef typename _Base::iterator _Base_iterator; typedef typename _Base::iterator _Base_iterator;
std::pair<_Base_iterator, _Base_iterator> __res = std::pair<_Base_iterator, _Base_iterator> __res =
_Base::equal_range(__key); _Base::equal_range(__key);
return std::make_pair(iterator(__res.first, this), return std::make_pair(iterator(__res.first, this),
iterator(__res.second, this)); iterator(__res.second, this));
} }
size_type size_type
erase(const key_type& __key) erase(const key_type& __key)
{ {
iterator __victim(_Base::find(__key), this); iterator __victim(_Base::find(__key), this);
if (__victim != end()) if (__victim != end())
...@@ -171,16 +171,16 @@ namespace __gnu_debug_def ...@@ -171,16 +171,16 @@ namespace __gnu_debug_def
else else
return 0; return 0;
} }
void void
erase(iterator __it) erase(iterator __it)
{ {
__glibcxx_check_erase(__it); __glibcxx_check_erase(__it);
__it._M_invalidate(); __it._M_invalidate();
_Base::erase(__it.base()); _Base::erase(__it.base());
} }
void void
erase(iterator __first, iterator __last) erase(iterator __first, iterator __last)
{ {
__glibcxx_check_erase_range(__first, __last); __glibcxx_check_erase_range(__first, __last);
...@@ -191,27 +191,27 @@ namespace __gnu_debug_def ...@@ -191,27 +191,27 @@ namespace __gnu_debug_def
} }
_Base::erase(__first.base(), __last.base()); _Base::erase(__first.base(), __last.base());
} }
void void
clear() clear()
{ {
_Base::clear(); _Base::clear();
this->_M_invalidate_all(); this->_M_invalidate_all();
} }
using _Base::resize; using _Base::resize;
using _Base::bucket_count; using _Base::bucket_count;
using _Base::max_bucket_count; using _Base::max_bucket_count;
using _Base::elems_in_bucket; using _Base::elems_in_bucket;
_Base& _Base&
_M_base() { return *this; } _M_base() { return *this; }
const _Base& const _Base&
_M_base() const { return *this; } _M_base() const { return *this; }
private: private:
void void
_M_invalidate_all() _M_invalidate_all()
{ {
typedef typename _Base::const_iterator _Base_const_iterator; typedef typename _Base::const_iterator _Base_const_iterator;
...@@ -220,21 +220,21 @@ namespace __gnu_debug_def ...@@ -220,21 +220,21 @@ namespace __gnu_debug_def
} }
}; };
template<typename _Value, typename _HashFcn, typename _EqualKey, template<typename _Value, typename _HashFcn, typename _EqualKey,
typename _Alloc> typename _Alloc>
inline bool inline bool
operator==(const hash_set<_Value, _HashFcn, _EqualKey, _Alloc>& __x, operator==(const hash_set<_Value, _HashFcn, _EqualKey, _Alloc>& __x,
const hash_set<_Value, _HashFcn, _EqualKey, _Alloc>& __y) const hash_set<_Value, _HashFcn, _EqualKey, _Alloc>& __y)
{ return __x._M_base() == __y._M_base(); } { return __x._M_base() == __y._M_base(); }
template<typename _Value, typename _HashFcn, typename _EqualKey, template<typename _Value, typename _HashFcn, typename _EqualKey,
typename _Alloc> typename _Alloc>
inline bool inline bool
operator!=(const hash_set<_Value, _HashFcn, _EqualKey, _Alloc>& __x, operator!=(const hash_set<_Value, _HashFcn, _EqualKey, _Alloc>& __x,
const hash_set<_Value, _HashFcn, _EqualKey, _Alloc>& __y) const hash_set<_Value, _HashFcn, _EqualKey, _Alloc>& __y)
{ return __x._M_base() != __y._M_base(); } { return __x._M_base() != __y._M_base(); }
template<typename _Value, typename _HashFcn, typename _EqualKey, template<typename _Value, typename _HashFcn, typename _EqualKey,
typename _Alloc> typename _Alloc>
inline void inline void
swap(hash_set<_Value, _HashFcn, _EqualKey, _Alloc>& __x, swap(hash_set<_Value, _HashFcn, _EqualKey, _Alloc>& __x,
......
...@@ -55,8 +55,8 @@ namespace __gnu_debug_def ...@@ -55,8 +55,8 @@ namespace __gnu_debug_def
typedef _Allocator allocator_type; typedef _Allocator allocator_type;
typedef typename _Allocator::reference reference; typedef typename _Allocator::reference reference;
typedef typename _Allocator::const_reference const_reference; typedef typename _Allocator::const_reference const_reference;
typedef __gnu_debug::_Safe_iterator<typename _Base::iterator, map> typedef __gnu_debug::_Safe_iterator<typename _Base::iterator, map>
iterator; iterator;
typedef __gnu_debug::_Safe_iterator<typename _Base::const_iterator, map> typedef __gnu_debug::_Safe_iterator<typename _Base::const_iterator, map>
const_iterator; const_iterator;
...@@ -67,28 +67,28 @@ namespace __gnu_debug_def ...@@ -67,28 +67,28 @@ namespace __gnu_debug_def
typedef typename _Allocator::const_pointer const_pointer; typedef typename _Allocator::const_pointer const_pointer;
typedef std::reverse_iterator<iterator> reverse_iterator; typedef std::reverse_iterator<iterator> reverse_iterator;
typedef std::reverse_iterator<const_iterator> const_reverse_iterator; typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
using _Base::value_compare; using _Base::value_compare;
// 23.3.1.1 construct/copy/destroy: // 23.3.1.1 construct/copy/destroy:
explicit map(const _Compare& __comp = _Compare(), explicit map(const _Compare& __comp = _Compare(),
const _Allocator& __a = _Allocator()) const _Allocator& __a = _Allocator())
: _Base(__comp, __a) { } : _Base(__comp, __a) { }
template<typename _InputIterator> template<typename _InputIterator>
map(_InputIterator __first, _InputIterator __last, map(_InputIterator __first, _InputIterator __last,
const _Compare& __comp = _Compare(), const _Compare& __comp = _Compare(),
const _Allocator& __a = _Allocator()) const _Allocator& __a = _Allocator())
: _Base(__gnu_debug::__check_valid_range(__first, __last), __last, : _Base(__gnu_debug::__check_valid_range(__first, __last), __last,
__comp, __a), _Safe_base() { } __comp, __a), _Safe_base() { }
map(const map<_Key,_Tp,_Compare,_Allocator>& __x) map(const map<_Key,_Tp,_Compare,_Allocator>& __x)
: _Base(__x), _Safe_base() { } : _Base(__x), _Safe_base() { }
map(const _Base& __x) : _Base(__x), _Safe_base() { } map(const _Base& __x) : _Base(__x), _Safe_base() { }
~map() { } ~map() { }
map<_Key,_Tp,_Compare,_Allocator>& map<_Key,_Tp,_Compare,_Allocator>&
operator=(const map<_Key,_Tp,_Compare,_Allocator>& __x) operator=(const map<_Key,_Tp,_Compare,_Allocator>& __x)
{ {
...@@ -96,86 +96,86 @@ namespace __gnu_debug_def ...@@ -96,86 +96,86 @@ namespace __gnu_debug_def
this->_M_invalidate_all(); this->_M_invalidate_all();
return *this; return *this;
} }
// _GLIBCXX_RESOLVE_LIB_DEFECTS // _GLIBCXX_RESOLVE_LIB_DEFECTS
// 133. map missing get_allocator() // 133. map missing get_allocator()
using _Base::get_allocator; using _Base::get_allocator;
// iterators: // iterators:
iterator iterator
begin() begin()
{ return iterator(_Base::begin(), this); } { return iterator(_Base::begin(), this); }
const_iterator const_iterator
begin() const begin() const
{ return const_iterator(_Base::begin(), this); } { return const_iterator(_Base::begin(), this); }
iterator iterator
end() end()
{ return iterator(_Base::end(), this); } { return iterator(_Base::end(), this); }
const_iterator const_iterator
end() const end() const
{ return const_iterator(_Base::end(), this); } { return const_iterator(_Base::end(), this); }
reverse_iterator reverse_iterator
rbegin() rbegin()
{ return reverse_iterator(end()); } { return reverse_iterator(end()); }
const_reverse_iterator const_reverse_iterator
rbegin() const rbegin() const
{ return const_reverse_iterator(end()); } { return const_reverse_iterator(end()); }
reverse_iterator reverse_iterator
rend() rend()
{ return reverse_iterator(begin()); } { return reverse_iterator(begin()); }
const_reverse_iterator const_reverse_iterator
rend() const rend() const
{ return const_reverse_iterator(begin()); } { return const_reverse_iterator(begin()); }
// capacity: // capacity:
using _Base::empty; using _Base::empty;
using _Base::size; using _Base::size;
using _Base::max_size; using _Base::max_size;
// 23.3.1.2 element access: // 23.3.1.2 element access:
using _Base::operator[]; using _Base::operator[];
// modifiers: // modifiers:
std::pair<iterator, bool> std::pair<iterator, bool>
insert(const value_type& __x) insert(const value_type& __x)
{ {
typedef typename _Base::iterator _Base_iterator; typedef typename _Base::iterator _Base_iterator;
std::pair<_Base_iterator, bool> __res = _Base::insert(__x); std::pair<_Base_iterator, bool> __res = _Base::insert(__x);
return std::pair<iterator, bool>(iterator(__res.first, this), return std::pair<iterator, bool>(iterator(__res.first, this),
__res.second); __res.second);
} }
iterator iterator
insert(iterator __position, const value_type& __x) insert(iterator __position, const value_type& __x)
{ {
__glibcxx_check_insert(__position); __glibcxx_check_insert(__position);
return iterator(_Base::insert(__position.base(), __x), this); return iterator(_Base::insert(__position.base(), __x), this);
} }
template<typename _InputIterator> template<typename _InputIterator>
void void
insert(_InputIterator __first, _InputIterator __last) insert(_InputIterator __first, _InputIterator __last)
{ {
__glibcxx_valid_range(__first, __last); __glibcxx_valid_range(__first, __last);
_Base::insert(__first, __last); _Base::insert(__first, __last);
} }
void void
erase(iterator __position) erase(iterator __position)
{ {
__glibcxx_check_erase(__position); __glibcxx_check_erase(__position);
__position._M_invalidate(); __position._M_invalidate();
_Base::erase(__position.base()); _Base::erase(__position.base());
} }
size_type size_type
erase(const key_type& __x) erase(const key_type& __x)
{ {
iterator __victim = find(__x); iterator __victim = find(__x);
...@@ -188,8 +188,8 @@ namespace __gnu_debug_def ...@@ -188,8 +188,8 @@ namespace __gnu_debug_def
return 1; return 1;
} }
} }
void void
erase(iterator __first, iterator __last) erase(iterator __first, iterator __last)
{ {
// _GLIBCXX_RESOLVE_LIB_DEFECTS // _GLIBCXX_RESOLVE_LIB_DEFECTS
...@@ -198,49 +198,49 @@ namespace __gnu_debug_def ...@@ -198,49 +198,49 @@ namespace __gnu_debug_def
while (__first != __last) while (__first != __last)
this->erase(__first++); this->erase(__first++);
} }
void void
swap(map<_Key,_Tp,_Compare,_Allocator>& __x) swap(map<_Key,_Tp,_Compare,_Allocator>& __x)
{ {
_Base::swap(__x); _Base::swap(__x);
this->_M_swap(__x); this->_M_swap(__x);
} }
void void
clear() clear()
{ this->erase(begin(), end()); } { this->erase(begin(), end()); }
// observers: // observers:
using _Base::key_comp; using _Base::key_comp;
using _Base::value_comp; using _Base::value_comp;
// 23.3.1.3 map operations: // 23.3.1.3 map operations:
iterator iterator
find(const key_type& __x) find(const key_type& __x)
{ return iterator(_Base::find(__x), this); } { return iterator(_Base::find(__x), this); }
const_iterator const_iterator
find(const key_type& __x) const find(const key_type& __x) const
{ return const_iterator(_Base::find(__x), this); } { return const_iterator(_Base::find(__x), this); }
using _Base::count; using _Base::count;
iterator iterator
lower_bound(const key_type& __x) lower_bound(const key_type& __x)
{ return iterator(_Base::lower_bound(__x), this); } { return iterator(_Base::lower_bound(__x), this); }
const_iterator const_iterator
lower_bound(const key_type& __x) const lower_bound(const key_type& __x) const
{ return const_iterator(_Base::lower_bound(__x), this); } { return const_iterator(_Base::lower_bound(__x), this); }
iterator iterator
upper_bound(const key_type& __x) upper_bound(const key_type& __x)
{ return iterator(_Base::upper_bound(__x), this); } { return iterator(_Base::upper_bound(__x), this); }
const_iterator const_iterator
upper_bound(const key_type& __x) const upper_bound(const key_type& __x) const
{ return const_iterator(_Base::upper_bound(__x), this); } { return const_iterator(_Base::upper_bound(__x), this); }
std::pair<iterator,iterator> std::pair<iterator,iterator>
equal_range(const key_type& __x) equal_range(const key_type& __x)
{ {
...@@ -250,7 +250,7 @@ namespace __gnu_debug_def ...@@ -250,7 +250,7 @@ namespace __gnu_debug_def
return std::make_pair(iterator(__res.first, this), return std::make_pair(iterator(__res.first, this),
iterator(__res.second, this)); iterator(__res.second, this));
} }
std::pair<const_iterator,const_iterator> std::pair<const_iterator,const_iterator>
equal_range(const key_type& __x) const equal_range(const key_type& __x) const
{ {
...@@ -260,15 +260,15 @@ namespace __gnu_debug_def ...@@ -260,15 +260,15 @@ namespace __gnu_debug_def
return std::make_pair(const_iterator(__res.first, this), return std::make_pair(const_iterator(__res.first, this),
const_iterator(__res.second, this)); const_iterator(__res.second, this));
} }
_Base& _Base&
_M_base() { return *this; } _M_base() { return *this; }
const _Base& const _Base&
_M_base() const { return *this; } _M_base() const { return *this; }
private: private:
void void
_M_invalidate_all() _M_invalidate_all()
{ {
typedef typename _Base::const_iterator _Base_const_iterator; typedef typename _Base::const_iterator _Base_const_iterator;
...@@ -277,47 +277,47 @@ namespace __gnu_debug_def ...@@ -277,47 +277,47 @@ namespace __gnu_debug_def
} }
}; };
template<typename _Key,typename _Tp,typename _Compare,typename _Allocator> template<typename _Key,typename _Tp,typename _Compare,typename _Allocator>
inline bool inline bool
operator==(const map<_Key,_Tp,_Compare,_Allocator>& __lhs, operator==(const map<_Key,_Tp,_Compare,_Allocator>& __lhs,
const map<_Key,_Tp,_Compare,_Allocator>& __rhs) const map<_Key,_Tp,_Compare,_Allocator>& __rhs)
{ return __lhs._M_base() == __rhs._M_base(); } { return __lhs._M_base() == __rhs._M_base(); }
template<typename _Key,typename _Tp,typename _Compare,typename _Allocator> template<typename _Key,typename _Tp,typename _Compare,typename _Allocator>
inline bool inline bool
operator!=(const map<_Key,_Tp,_Compare,_Allocator>& __lhs, operator!=(const map<_Key,_Tp,_Compare,_Allocator>& __lhs,
const map<_Key,_Tp,_Compare,_Allocator>& __rhs) const map<_Key,_Tp,_Compare,_Allocator>& __rhs)
{ return __lhs._M_base() != __rhs._M_base(); } { return __lhs._M_base() != __rhs._M_base(); }
template<typename _Key,typename _Tp,typename _Compare,typename _Allocator> template<typename _Key,typename _Tp,typename _Compare,typename _Allocator>
inline bool inline bool
operator<(const map<_Key,_Tp,_Compare,_Allocator>& __lhs, operator<(const map<_Key,_Tp,_Compare,_Allocator>& __lhs,
const map<_Key,_Tp,_Compare,_Allocator>& __rhs) const map<_Key,_Tp,_Compare,_Allocator>& __rhs)
{ return __lhs._M_base() < __rhs._M_base(); } { return __lhs._M_base() < __rhs._M_base(); }
template<typename _Key,typename _Tp,typename _Compare,typename _Allocator> template<typename _Key,typename _Tp,typename _Compare,typename _Allocator>
inline bool inline bool
operator<=(const map<_Key,_Tp,_Compare,_Allocator>& __lhs, operator<=(const map<_Key,_Tp,_Compare,_Allocator>& __lhs,
const map<_Key,_Tp,_Compare,_Allocator>& __rhs) const map<_Key,_Tp,_Compare,_Allocator>& __rhs)
{ return __lhs._M_base() <= __rhs._M_base(); } { return __lhs._M_base() <= __rhs._M_base(); }
template<typename _Key,typename _Tp,typename _Compare,typename _Allocator> template<typename _Key,typename _Tp,typename _Compare,typename _Allocator>
inline bool inline bool
operator>=(const map<_Key,_Tp,_Compare,_Allocator>& __lhs, operator>=(const map<_Key,_Tp,_Compare,_Allocator>& __lhs,
const map<_Key,_Tp,_Compare,_Allocator>& __rhs) const map<_Key,_Tp,_Compare,_Allocator>& __rhs)
{ return __lhs._M_base() >= __rhs._M_base(); } { return __lhs._M_base() >= __rhs._M_base(); }
template<typename _Key,typename _Tp,typename _Compare,typename _Allocator> template<typename _Key,typename _Tp,typename _Compare,typename _Allocator>
inline bool inline bool
operator>(const map<_Key,_Tp,_Compare,_Allocator>& __lhs, operator>(const map<_Key,_Tp,_Compare,_Allocator>& __lhs,
const map<_Key,_Tp,_Compare,_Allocator>& __rhs) const map<_Key,_Tp,_Compare,_Allocator>& __rhs)
{ return __lhs._M_base() > __rhs._M_base(); } { return __lhs._M_base() > __rhs._M_base(); }
template<typename _Key,typename _Tp,typename _Compare,typename _Allocator> template<typename _Key,typename _Tp,typename _Compare,typename _Allocator>
inline void inline void
swap(map<_Key,_Tp,_Compare,_Allocator>& __lhs, swap(map<_Key,_Tp,_Compare,_Allocator>& __lhs,
map<_Key,_Tp,_Compare,_Allocator>& __rhs) map<_Key,_Tp,_Compare,_Allocator>& __rhs)
{ __lhs.swap(__rhs); } { __lhs.swap(__rhs); }
} // namespace __gnu_debug_def } // namespace __gnu_debug_def
#endif #endif
...@@ -39,24 +39,24 @@ namespace __gnu_debug_def ...@@ -39,24 +39,24 @@ namespace __gnu_debug_def
{ {
template<typename _Key, typename _Tp, typename _Compare = std::less<_Key>, template<typename _Key, typename _Tp, typename _Compare = std::less<_Key>,
typename _Allocator = std::allocator<std::pair<const _Key, _Tp> > > typename _Allocator = std::allocator<std::pair<const _Key, _Tp> > >
class multimap class multimap
: public __gnu_norm::multimap<_Key, _Tp, _Compare, _Allocator>, : public __gnu_norm::multimap<_Key, _Tp, _Compare, _Allocator>,
public __gnu_debug::_Safe_sequence<multimap<_Key,_Tp,_Compare,_Allocator> > public __gnu_debug::_Safe_sequence<multimap<_Key,_Tp,_Compare,_Allocator> >
{ {
typedef __gnu_norm::multimap<_Key, _Tp, _Compare, _Allocator> _Base; typedef __gnu_norm::multimap<_Key, _Tp, _Compare, _Allocator> _Base;
typedef __gnu_debug::_Safe_sequence<multimap> _Safe_base; typedef __gnu_debug::_Safe_sequence<multimap> _Safe_base;
public: public:
// types: // types:
typedef _Key key_type; typedef _Key key_type;
typedef _Tp mapped_type; typedef _Tp mapped_type;
typedef std::pair<const _Key, _Tp> value_type; typedef std::pair<const _Key, _Tp> value_type;
typedef _Compare key_compare; typedef _Compare key_compare;
typedef _Allocator allocator_type; typedef _Allocator allocator_type;
typedef typename _Allocator::reference reference; typedef typename _Allocator::reference reference;
typedef typename _Allocator::const_reference const_reference; typedef typename _Allocator::const_reference const_reference;
typedef __gnu_debug::_Safe_iterator<typename _Base::iterator, multimap> typedef __gnu_debug::_Safe_iterator<typename _Base::iterator, multimap>
iterator; iterator;
typedef __gnu_debug::_Safe_iterator<typename _Base::const_iterator, typedef __gnu_debug::_Safe_iterator<typename _Base::const_iterator,
multimap> const_iterator; multimap> const_iterator;
...@@ -67,9 +67,9 @@ namespace __gnu_debug_def ...@@ -67,9 +67,9 @@ namespace __gnu_debug_def
typedef typename _Allocator::const_pointer const_pointer; typedef typename _Allocator::const_pointer const_pointer;
typedef std::reverse_iterator<iterator> reverse_iterator; typedef std::reverse_iterator<iterator> reverse_iterator;
typedef std::reverse_iterator<const_iterator> const_reverse_iterator; typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
using _Base::value_compare; using _Base::value_compare;
// 23.3.1.1 construct/copy/destroy: // 23.3.1.1 construct/copy/destroy:
explicit multimap(const _Compare& __comp = _Compare(), explicit multimap(const _Compare& __comp = _Compare(),
const _Allocator& __a = _Allocator()) const _Allocator& __a = _Allocator())
...@@ -77,13 +77,13 @@ namespace __gnu_debug_def ...@@ -77,13 +77,13 @@ namespace __gnu_debug_def
template<typename _InputIterator> template<typename _InputIterator>
multimap(_InputIterator __first, _InputIterator __last, multimap(_InputIterator __first, _InputIterator __last,
const _Compare& __comp = _Compare(), const _Compare& __comp = _Compare(),
const _Allocator& __a = _Allocator()) const _Allocator& __a = _Allocator())
: _Base(__gnu_debug::__check_valid_range(__first, __last), __last, : _Base(__gnu_debug::__check_valid_range(__first, __last), __last,
__comp, __a) { } __comp, __a) { }
multimap(const multimap<_Key,_Tp,_Compare,_Allocator>& __x) multimap(const multimap<_Key,_Tp,_Compare,_Allocator>& __x)
: _Base(__x), _Safe_base() { } : _Base(__x), _Safe_base() { }
multimap(const _Base& __x) : _Base(__x), _Safe_base() { } multimap(const _Base& __x) : _Base(__x), _Safe_base() { }
...@@ -100,36 +100,36 @@ namespace __gnu_debug_def ...@@ -100,36 +100,36 @@ namespace __gnu_debug_def
using _Base::get_allocator; using _Base::get_allocator;
// iterators: // iterators:
iterator iterator
begin() begin()
{ return iterator(_Base::begin(), this); } { return iterator(_Base::begin(), this); }
const_iterator const_iterator
begin() const begin() const
{ return const_iterator(_Base::begin(), this); } { return const_iterator(_Base::begin(), this); }
iterator iterator
end() end()
{ return iterator(_Base::end(), this); } { return iterator(_Base::end(), this); }
const_iterator const_iterator
end() const end() const
{ return const_iterator(_Base::end(), this); } { return const_iterator(_Base::end(), this); }
reverse_iterator reverse_iterator
rbegin() rbegin()
{ return reverse_iterator(end()); } { return reverse_iterator(end()); }
const_reverse_iterator const_reverse_iterator
rbegin() const rbegin() const
{ return const_reverse_iterator(end()); } { return const_reverse_iterator(end()); }
reverse_iterator reverse_iterator
rend() rend()
{ return reverse_iterator(begin()); } { return reverse_iterator(begin()); }
const_reverse_iterator const_reverse_iterator
rend() const rend() const
{ return const_reverse_iterator(begin()); } { return const_reverse_iterator(begin()); }
// capacity: // capacity:
...@@ -138,11 +138,11 @@ namespace __gnu_debug_def ...@@ -138,11 +138,11 @@ namespace __gnu_debug_def
using _Base::max_size; using _Base::max_size;
// modifiers: // modifiers:
iterator iterator
insert(const value_type& __x) insert(const value_type& __x)
{ return iterator(_Base::insert(__x), this); } { return iterator(_Base::insert(__x), this); }
iterator iterator
insert(iterator __position, const value_type& __x) insert(iterator __position, const value_type& __x)
{ {
__glibcxx_check_insert(__position); __glibcxx_check_insert(__position);
...@@ -150,14 +150,14 @@ namespace __gnu_debug_def ...@@ -150,14 +150,14 @@ namespace __gnu_debug_def
} }
template<typename _InputIterator> template<typename _InputIterator>
void void
insert(_InputIterator __first, _InputIterator __last) insert(_InputIterator __first, _InputIterator __last)
{ {
__glibcxx_check_valid_range(__first, __last); __glibcxx_check_valid_range(__first, __last);
_Base::insert(__first, __last); _Base::insert(__first, __last);
} }
void void
erase(iterator __position) erase(iterator __position)
{ {
__glibcxx_check_erase(__position); __glibcxx_check_erase(__position);
...@@ -165,7 +165,7 @@ namespace __gnu_debug_def ...@@ -165,7 +165,7 @@ namespace __gnu_debug_def
_Base::erase(__position.base()); _Base::erase(__position.base());
} }
size_type size_type
erase(const key_type& __x) erase(const key_type& __x)
{ {
std::pair<iterator, iterator> __victims = this->equal_range(__x); std::pair<iterator, iterator> __victims = this->equal_range(__x);
...@@ -180,7 +180,7 @@ namespace __gnu_debug_def ...@@ -180,7 +180,7 @@ namespace __gnu_debug_def
return __count; return __count;
} }
void void
erase(iterator __first, iterator __last) erase(iterator __first, iterator __last)
{ {
// _GLIBCXX_RESOLVE_LIB_DEFECTS // _GLIBCXX_RESOLVE_LIB_DEFECTS
...@@ -190,14 +190,14 @@ namespace __gnu_debug_def ...@@ -190,14 +190,14 @@ namespace __gnu_debug_def
this->erase(__first++); this->erase(__first++);
} }
void void
swap(multimap<_Key,_Tp,_Compare,_Allocator>& __x) swap(multimap<_Key,_Tp,_Compare,_Allocator>& __x)
{ {
_Base::swap(__x); _Base::swap(__x);
this->_M_swap(__x); this->_M_swap(__x);
} }
void void
clear() clear()
{ this->erase(begin(), end()); } { this->erase(begin(), end()); }
...@@ -206,29 +206,29 @@ namespace __gnu_debug_def ...@@ -206,29 +206,29 @@ namespace __gnu_debug_def
using _Base::value_comp; using _Base::value_comp;
// 23.3.1.3 multimap operations: // 23.3.1.3 multimap operations:
iterator iterator
find(const key_type& __x) find(const key_type& __x)
{ return iterator(_Base::find(__x), this); } { return iterator(_Base::find(__x), this); }
const_iterator const_iterator
find(const key_type& __x) const find(const key_type& __x) const
{ return const_iterator(_Base::find(__x), this); } { return const_iterator(_Base::find(__x), this); }
using _Base::count; using _Base::count;
iterator iterator
lower_bound(const key_type& __x) lower_bound(const key_type& __x)
{ return iterator(_Base::lower_bound(__x), this); } { return iterator(_Base::lower_bound(__x), this); }
const_iterator const_iterator
lower_bound(const key_type& __x) const lower_bound(const key_type& __x) const
{ return const_iterator(_Base::lower_bound(__x), this); } { return const_iterator(_Base::lower_bound(__x), this); }
iterator iterator
upper_bound(const key_type& __x) upper_bound(const key_type& __x)
{ return iterator(_Base::upper_bound(__x), this); } { return iterator(_Base::upper_bound(__x), this); }
const_iterator const_iterator
upper_bound(const key_type& __x) const upper_bound(const key_type& __x) const
{ return const_iterator(_Base::upper_bound(__x), this); } { return const_iterator(_Base::upper_bound(__x), this); }
...@@ -252,14 +252,14 @@ namespace __gnu_debug_def ...@@ -252,14 +252,14 @@ namespace __gnu_debug_def
const_iterator(__res.second, this)); const_iterator(__res.second, this));
} }
_Base& _Base&
_M_base() { return *this; } _M_base() { return *this; }
const _Base& const _Base&
_M_base() const { return *this; } _M_base() const { return *this; }
private: private:
void void
_M_invalidate_all() _M_invalidate_all()
{ {
typedef typename _Base::const_iterator _Base_const_iterator; typedef typename _Base::const_iterator _Base_const_iterator;
...@@ -270,45 +270,45 @@ namespace __gnu_debug_def ...@@ -270,45 +270,45 @@ namespace __gnu_debug_def
template<typename _Key,typename _Tp,typename _Compare,typename _Allocator> template<typename _Key,typename _Tp,typename _Compare,typename _Allocator>
inline bool inline bool
operator==(const multimap<_Key,_Tp,_Compare,_Allocator>& __lhs, operator==(const multimap<_Key,_Tp,_Compare,_Allocator>& __lhs,
const multimap<_Key,_Tp,_Compare,_Allocator>& __rhs) const multimap<_Key,_Tp,_Compare,_Allocator>& __rhs)
{ return __lhs._M_base() == __rhs._M_base(); } { return __lhs._M_base() == __rhs._M_base(); }
template<typename _Key,typename _Tp,typename _Compare,typename _Allocator> template<typename _Key,typename _Tp,typename _Compare,typename _Allocator>
inline bool inline bool
operator!=(const multimap<_Key,_Tp,_Compare,_Allocator>& __lhs, operator!=(const multimap<_Key,_Tp,_Compare,_Allocator>& __lhs,
const multimap<_Key,_Tp,_Compare,_Allocator>& __rhs) const multimap<_Key,_Tp,_Compare,_Allocator>& __rhs)
{ return __lhs._M_base() != __rhs._M_base(); } { return __lhs._M_base() != __rhs._M_base(); }
template<typename _Key,typename _Tp,typename _Compare,typename _Allocator> template<typename _Key,typename _Tp,typename _Compare,typename _Allocator>
inline bool inline bool
operator<(const multimap<_Key,_Tp,_Compare,_Allocator>& __lhs, operator<(const multimap<_Key,_Tp,_Compare,_Allocator>& __lhs,
const multimap<_Key,_Tp,_Compare,_Allocator>& __rhs) const multimap<_Key,_Tp,_Compare,_Allocator>& __rhs)
{ return __lhs._M_base() < __rhs._M_base(); } { return __lhs._M_base() < __rhs._M_base(); }
template<typename _Key,typename _Tp,typename _Compare,typename _Allocator> template<typename _Key,typename _Tp,typename _Compare,typename _Allocator>
inline bool inline bool
operator<=(const multimap<_Key,_Tp,_Compare,_Allocator>& __lhs, operator<=(const multimap<_Key,_Tp,_Compare,_Allocator>& __lhs,
const multimap<_Key,_Tp,_Compare,_Allocator>& __rhs) const multimap<_Key,_Tp,_Compare,_Allocator>& __rhs)
{ return __lhs._M_base() <= __rhs._M_base(); } { return __lhs._M_base() <= __rhs._M_base(); }
template<typename _Key,typename _Tp,typename _Compare,typename _Allocator> template<typename _Key,typename _Tp,typename _Compare,typename _Allocator>
inline bool inline bool
operator>=(const multimap<_Key,_Tp,_Compare,_Allocator>& __lhs, operator>=(const multimap<_Key,_Tp,_Compare,_Allocator>& __lhs,
const multimap<_Key,_Tp,_Compare,_Allocator>& __rhs) const multimap<_Key,_Tp,_Compare,_Allocator>& __rhs)
{ return __lhs._M_base() >= __rhs._M_base(); } { return __lhs._M_base() >= __rhs._M_base(); }
template<typename _Key,typename _Tp,typename _Compare,typename _Allocator> template<typename _Key,typename _Tp,typename _Compare,typename _Allocator>
inline bool inline bool
operator>(const multimap<_Key,_Tp,_Compare,_Allocator>& __lhs, operator>(const multimap<_Key,_Tp,_Compare,_Allocator>& __lhs,
const multimap<_Key,_Tp,_Compare,_Allocator>& __rhs) const multimap<_Key,_Tp,_Compare,_Allocator>& __rhs)
{ return __lhs._M_base() > __rhs._M_base(); } { return __lhs._M_base() > __rhs._M_base(); }
template<typename _Key,typename _Tp,typename _Compare,typename _Allocator> template<typename _Key,typename _Tp,typename _Compare,typename _Allocator>
inline void inline void
swap(multimap<_Key,_Tp,_Compare,_Allocator>& __lhs, swap(multimap<_Key,_Tp,_Compare,_Allocator>& __lhs,
multimap<_Key,_Tp,_Compare,_Allocator>& __rhs) multimap<_Key,_Tp,_Compare,_Allocator>& __rhs)
{ __lhs.swap(__rhs); } { __lhs.swap(__rhs); }
} // namespace __gnu_debug_def } // namespace __gnu_debug_def
#endif #endif
...@@ -39,7 +39,7 @@ namespace __gnu_debug_def ...@@ -39,7 +39,7 @@ namespace __gnu_debug_def
{ {
template<typename _Key, typename _Compare = std::less<_Key>, template<typename _Key, typename _Compare = std::less<_Key>,
typename _Allocator = std::allocator<_Key> > typename _Allocator = std::allocator<_Key> >
class multiset class multiset
: public __gnu_norm::multiset<_Key, _Compare, _Allocator>, : public __gnu_norm::multiset<_Key, _Compare, _Allocator>,
public __gnu_debug::_Safe_sequence<multiset<_Key, _Compare, _Allocator> > public __gnu_debug::_Safe_sequence<multiset<_Key, _Compare, _Allocator> >
{ {
...@@ -48,15 +48,15 @@ namespace __gnu_debug_def ...@@ -48,15 +48,15 @@ namespace __gnu_debug_def
public: public:
// types: // types:
typedef _Key key_type; typedef _Key key_type;
typedef _Key value_type; typedef _Key value_type;
typedef _Compare key_compare; typedef _Compare key_compare;
typedef _Compare value_compare; typedef _Compare value_compare;
typedef _Allocator allocator_type; typedef _Allocator allocator_type;
typedef typename _Allocator::reference reference; typedef typename _Allocator::reference reference;
typedef typename _Allocator::const_reference const_reference; typedef typename _Allocator::const_reference const_reference;
typedef __gnu_debug::_Safe_iterator<typename _Base::iterator, multiset> typedef __gnu_debug::_Safe_iterator<typename _Base::iterator, multiset>
iterator; iterator;
typedef __gnu_debug::_Safe_iterator<typename _Base::const_iterator, typedef __gnu_debug::_Safe_iterator<typename _Base::const_iterator,
multiset> const_iterator; multiset> const_iterator;
...@@ -80,14 +80,14 @@ namespace __gnu_debug_def ...@@ -80,14 +80,14 @@ namespace __gnu_debug_def
: _Base(__gnu_debug::__check_valid_range(__first, __last), __last, : _Base(__gnu_debug::__check_valid_range(__first, __last), __last,
__comp, __a) { } __comp, __a) { }
multiset(const multiset<_Key,_Compare,_Allocator>& __x) multiset(const multiset<_Key,_Compare,_Allocator>& __x)
: _Base(__x), _Safe_base() { } : _Base(__x), _Safe_base() { }
multiset(const _Base& __x) : _Base(__x), _Safe_base() { } multiset(const _Base& __x) : _Base(__x), _Safe_base() { }
~multiset() { } ~multiset() { }
multiset<_Key,_Compare,_Allocator>& multiset<_Key,_Compare,_Allocator>&
operator=(const multiset<_Key,_Compare,_Allocator>& __x) operator=(const multiset<_Key,_Compare,_Allocator>& __x)
{ {
*static_cast<_Base*>(this) = __x; *static_cast<_Base*>(this) = __x;
...@@ -102,32 +102,32 @@ namespace __gnu_debug_def ...@@ -102,32 +102,32 @@ namespace __gnu_debug_def
begin() begin()
{ return iterator(_Base::begin(), this); } { return iterator(_Base::begin(), this); }
const_iterator const_iterator
begin() const begin() const
{ return const_iterator(_Base::begin(), this); } { return const_iterator(_Base::begin(), this); }
iterator iterator
end() end()
{ return iterator(_Base::end(), this); } { return iterator(_Base::end(), this); }
const_iterator const_iterator
end() const end() const
{ return const_iterator(_Base::end(), this); } { return const_iterator(_Base::end(), this); }
reverse_iterator reverse_iterator
rbegin() rbegin()
{ return reverse_iterator(end()); } { return reverse_iterator(end()); }
const_reverse_iterator const_reverse_iterator
rbegin() const rbegin() const
{ return const_reverse_iterator(end()); } { return const_reverse_iterator(end()); }
reverse_iterator reverse_iterator
rend() rend()
{ return reverse_iterator(begin()); } { return reverse_iterator(begin()); }
const_reverse_iterator const_reverse_iterator
rend() const rend() const
{ return const_reverse_iterator(begin()); } { return const_reverse_iterator(begin()); }
// capacity: // capacity:
...@@ -136,11 +136,11 @@ namespace __gnu_debug_def ...@@ -136,11 +136,11 @@ namespace __gnu_debug_def
using _Base::max_size; using _Base::max_size;
// modifiers: // modifiers:
iterator iterator
insert(const value_type& __x) insert(const value_type& __x)
{ return iterator(_Base::insert(__x), this); } { return iterator(_Base::insert(__x), this); }
iterator iterator
insert(iterator __position, const value_type& __x) insert(iterator __position, const value_type& __x)
{ {
__glibcxx_check_insert(__position); __glibcxx_check_insert(__position);
...@@ -148,14 +148,14 @@ namespace __gnu_debug_def ...@@ -148,14 +148,14 @@ namespace __gnu_debug_def
} }
template<typename _InputIterator> template<typename _InputIterator>
void void
insert(_InputIterator __first, _InputIterator __last) insert(_InputIterator __first, _InputIterator __last)
{ {
__glibcxx_check_valid_range(__first, __last); __glibcxx_check_valid_range(__first, __last);
_Base::insert(__first, __last); _Base::insert(__first, __last);
} }
void void
erase(iterator __position) erase(iterator __position)
{ {
__glibcxx_check_erase(__position); __glibcxx_check_erase(__position);
...@@ -178,7 +178,7 @@ namespace __gnu_debug_def ...@@ -178,7 +178,7 @@ namespace __gnu_debug_def
return __count; return __count;
} }
void void
erase(iterator __first, iterator __last) erase(iterator __first, iterator __last)
{ {
// _GLIBCXX_RESOLVE_LIB_DEFECTS // _GLIBCXX_RESOLVE_LIB_DEFECTS
...@@ -188,14 +188,14 @@ namespace __gnu_debug_def ...@@ -188,14 +188,14 @@ namespace __gnu_debug_def
this->erase(__first++); this->erase(__first++);
} }
void void
swap(multiset<_Key,_Compare,_Allocator>& __x) swap(multiset<_Key,_Compare,_Allocator>& __x)
{ {
_Base::swap(__x); _Base::swap(__x);
this->_M_swap(__x); this->_M_swap(__x);
} }
void void
clear() clear()
{ this->erase(begin(), end()); } { this->erase(begin(), end()); }
...@@ -204,35 +204,35 @@ namespace __gnu_debug_def ...@@ -204,35 +204,35 @@ namespace __gnu_debug_def
using _Base::value_comp; using _Base::value_comp;
// multiset operations: // multiset operations:
iterator iterator
find(const key_type& __x) find(const key_type& __x)
{ return iterator(_Base::find(__x), this); } { return iterator(_Base::find(__x), this); }
// _GLIBCXX_RESOLVE_LIB_DEFECTS // _GLIBCXX_RESOLVE_LIB_DEFECTS
// 214. set::find() missing const overload // 214. set::find() missing const overload
const_iterator const_iterator
find(const key_type& __x) const find(const key_type& __x) const
{ return const_iterator(_Base::find(__x), this); } { return const_iterator(_Base::find(__x), this); }
using _Base::count; using _Base::count;
iterator iterator
lower_bound(const key_type& __x) lower_bound(const key_type& __x)
{ return iterator(_Base::lower_bound(__x), this); } { return iterator(_Base::lower_bound(__x), this); }
// _GLIBCXX_RESOLVE_LIB_DEFECTS // _GLIBCXX_RESOLVE_LIB_DEFECTS
// 214. set::find() missing const overload // 214. set::find() missing const overload
const_iterator const_iterator
lower_bound(const key_type& __x) const lower_bound(const key_type& __x) const
{ return const_iterator(_Base::lower_bound(__x), this); } { return const_iterator(_Base::lower_bound(__x), this); }
iterator iterator
upper_bound(const key_type& __x) upper_bound(const key_type& __x)
{ return iterator(_Base::upper_bound(__x), this); } { return iterator(_Base::upper_bound(__x), this); }
// _GLIBCXX_RESOLVE_LIB_DEFECTS // _GLIBCXX_RESOLVE_LIB_DEFECTS
// 214. set::find() missing const overload // 214. set::find() missing const overload
const_iterator const_iterator
upper_bound(const key_type& __x) const upper_bound(const key_type& __x) const
{ return const_iterator(_Base::upper_bound(__x), this); } { return const_iterator(_Base::upper_bound(__x), this); }
...@@ -258,14 +258,14 @@ namespace __gnu_debug_def ...@@ -258,14 +258,14 @@ namespace __gnu_debug_def
const_iterator(__res.second, this)); const_iterator(__res.second, this));
} }
_Base& _Base&
_M_base() { return *this; } _M_base() { return *this; }
const _Base& const _Base&
_M_base() const { return *this; } _M_base() const { return *this; }
private: private:
void void
_M_invalidate_all() _M_invalidate_all()
{ {
typedef typename _Base::const_iterator _Base_const_iterator; typedef typename _Base::const_iterator _Base_const_iterator;
...@@ -275,37 +275,37 @@ namespace __gnu_debug_def ...@@ -275,37 +275,37 @@ namespace __gnu_debug_def
}; };
template<typename _Key, typename _Compare, typename _Allocator> template<typename _Key, typename _Compare, typename _Allocator>
inline bool inline bool
operator==(const multiset<_Key,_Compare,_Allocator>& __lhs, operator==(const multiset<_Key,_Compare,_Allocator>& __lhs,
const multiset<_Key,_Compare,_Allocator>& __rhs) const multiset<_Key,_Compare,_Allocator>& __rhs)
{ return __lhs._M_base() == __rhs._M_base(); } { return __lhs._M_base() == __rhs._M_base(); }
template<typename _Key, typename _Compare, typename _Allocator> template<typename _Key, typename _Compare, typename _Allocator>
inline bool inline bool
operator!=(const multiset<_Key,_Compare,_Allocator>& __lhs, operator!=(const multiset<_Key,_Compare,_Allocator>& __lhs,
const multiset<_Key,_Compare,_Allocator>& __rhs) const multiset<_Key,_Compare,_Allocator>& __rhs)
{ return __lhs._M_base() != __rhs._M_base(); } { return __lhs._M_base() != __rhs._M_base(); }
template<typename _Key, typename _Compare, typename _Allocator> template<typename _Key, typename _Compare, typename _Allocator>
inline bool inline bool
operator<(const multiset<_Key,_Compare,_Allocator>& __lhs, operator<(const multiset<_Key,_Compare,_Allocator>& __lhs,
const multiset<_Key,_Compare,_Allocator>& __rhs) const multiset<_Key,_Compare,_Allocator>& __rhs)
{ return __lhs._M_base() < __rhs._M_base(); } { return __lhs._M_base() < __rhs._M_base(); }
template<typename _Key, typename _Compare, typename _Allocator> template<typename _Key, typename _Compare, typename _Allocator>
inline bool inline bool
operator<=(const multiset<_Key,_Compare,_Allocator>& __lhs, operator<=(const multiset<_Key,_Compare,_Allocator>& __lhs,
const multiset<_Key,_Compare,_Allocator>& __rhs) const multiset<_Key,_Compare,_Allocator>& __rhs)
{ return __lhs._M_base() <= __rhs._M_base(); } { return __lhs._M_base() <= __rhs._M_base(); }
template<typename _Key, typename _Compare, typename _Allocator> template<typename _Key, typename _Compare, typename _Allocator>
inline bool inline bool
operator>=(const multiset<_Key,_Compare,_Allocator>& __lhs, operator>=(const multiset<_Key,_Compare,_Allocator>& __lhs,
const multiset<_Key,_Compare,_Allocator>& __rhs) const multiset<_Key,_Compare,_Allocator>& __rhs)
{ return __lhs._M_base() >= __rhs._M_base(); } { return __lhs._M_base() >= __rhs._M_base(); }
template<typename _Key, typename _Compare, typename _Allocator> template<typename _Key, typename _Compare, typename _Allocator>
inline bool inline bool
operator>(const multiset<_Key,_Compare,_Allocator>& __lhs, operator>(const multiset<_Key,_Compare,_Allocator>& __lhs,
const multiset<_Key,_Compare,_Allocator>& __rhs) const multiset<_Key,_Compare,_Allocator>& __rhs)
{ return __lhs._M_base() > __rhs._M_base(); } { return __lhs._M_base() > __rhs._M_base(); }
......
...@@ -59,7 +59,7 @@ namespace __gnu_debug ...@@ -59,7 +59,7 @@ namespace __gnu_debug
* singular because of an operation on the container). This * singular because of an operation on the container). This
* version number must equal the version number in the sequence * version number must equal the version number in the sequence
* referenced by _M_sequence for the iterator to be * referenced by _M_sequence for the iterator to be
* non-singular. * non-singular.
*/ */
unsigned int _M_version; unsigned int _M_version;
...@@ -73,7 +73,7 @@ namespace __gnu_debug ...@@ -73,7 +73,7 @@ namespace __gnu_debug
protected: protected:
/** Initializes the iterator and makes it singular. */ /** Initializes the iterator and makes it singular. */
_Safe_iterator_base() _Safe_iterator_base()
: _M_sequence(0), _M_version(0), _M_prior(0), _M_next(0) : _M_sequence(0), _M_version(0), _M_prior(0), _M_next(0)
{ } { }
...@@ -82,7 +82,7 @@ namespace __gnu_debug ...@@ -82,7 +82,7 @@ namespace __gnu_debug
* constant iterator, and false if it is a mutable iterator. Note * constant iterator, and false if it is a mutable iterator. Note
* that @p __seq may be NULL, in which case the iterator will be * that @p __seq may be NULL, in which case the iterator will be
* singular. Otherwise, the iterator will reference @p __seq and * singular. Otherwise, the iterator will reference @p __seq and
* be nonsingular. * be nonsingular.
*/ */
_Safe_iterator_base(const _Safe_sequence_base* __seq, bool __constant) _Safe_iterator_base(const _Safe_sequence_base* __seq, bool __constant)
: _M_sequence(0), _M_version(0), _M_prior(0), _M_next(0) : _M_sequence(0), _M_version(0), _M_prior(0), _M_next(0)
...@@ -102,11 +102,11 @@ namespace __gnu_debug ...@@ -102,11 +102,11 @@ namespace __gnu_debug
* from whatever sequence it was attached to originally. If the * from whatever sequence it was attached to originally. If the
* new sequence is the NULL pointer, the iterator is left * new sequence is the NULL pointer, the iterator is left
* unattached. * unattached.
*/ */
void _M_attach(_Safe_sequence_base* __seq, bool __constant); void _M_attach(_Safe_sequence_base* __seq, bool __constant);
/** Detach the iterator for whatever sequence it is attached to, /** Detach the iterator for whatever sequence it is attached to,
* if any. * if any.
*/ */
void _M_detach(); void _M_detach();
...@@ -145,35 +145,35 @@ namespace __gnu_debug ...@@ -145,35 +145,35 @@ namespace __gnu_debug
public: public:
/// The list of mutable iterators that reference this container /// The list of mutable iterators that reference this container
_Safe_iterator_base* _M_iterators; _Safe_iterator_base* _M_iterators;
/// The list of constant iterators that reference this container /// The list of constant iterators that reference this container
_Safe_iterator_base* _M_const_iterators; _Safe_iterator_base* _M_const_iterators;
/// The container version number. This number may never be 0. /// The container version number. This number may never be 0.
mutable unsigned int _M_version; mutable unsigned int _M_version;
protected: protected:
// Initialize with a version number of 1 and no iterators // Initialize with a version number of 1 and no iterators
_Safe_sequence_base() _Safe_sequence_base()
: _M_iterators(0), _M_const_iterators(0), _M_version(1) : _M_iterators(0), _M_const_iterators(0), _M_version(1)
{ } { }
/** Notify all iterators that reference this sequence that the /** Notify all iterators that reference this sequence that the
sequence is being destroyed. */ sequence is being destroyed. */
~_Safe_sequence_base() ~_Safe_sequence_base()
{ this->_M_detach_all(); } { this->_M_detach_all(); }
/** Detach all iterators, leaving them singular. */ /** Detach all iterators, leaving them singular. */
void void
_M_detach_all(); _M_detach_all();
/** Detach all singular iterators. /** Detach all singular iterators.
* @post for all iterators i attached to this sequence, * @post for all iterators i attached to this sequence,
* i->_M_version == _M_version. * i->_M_version == _M_version.
*/ */
void void
_M_detach_singular(); _M_detach_singular();
/** Revalidates all attached singular iterators. This method may /** Revalidates all attached singular iterators. This method may
* be used to validate iterators that were invalidated before * be used to validate iterators that were invalidated before
* (but for some reasion, such as an exception, need to become * (but for some reasion, such as an exception, need to become
...@@ -181,21 +181,21 @@ namespace __gnu_debug ...@@ -181,21 +181,21 @@ namespace __gnu_debug
*/ */
void void
_M_revalidate_singular(); _M_revalidate_singular();
/** Swap this sequence with the given sequence. This operation /** Swap this sequence with the given sequence. This operation
* also swaps ownership of the iterators, so that when the * also swaps ownership of the iterators, so that when the
* operation is complete all iterators that originally referenced * operation is complete all iterators that originally referenced
* one container now reference the other container. * one container now reference the other container.
*/ */
void void
_M_swap(_Safe_sequence_base& __x); _M_swap(_Safe_sequence_base& __x);
public: public:
/** Invalidates all iterators. */ /** Invalidates all iterators. */
void void
_M_invalidate_all() const _M_invalidate_all() const
{ if (++_M_version == 0) _M_version = 1; } { if (++_M_version == 0) _M_version = 1; }
}; };
} // namespace __gnu_debug } // namespace __gnu_debug
#endif #endif
...@@ -39,19 +39,19 @@ ...@@ -39,19 +39,19 @@
namespace __gnu_debug namespace __gnu_debug
{ {
template<typename _Iterator, typename _Sequence> template<typename _Iterator, typename _Sequence>
bool bool
_Safe_iterator<_Iterator, _Sequence>:: _Safe_iterator<_Iterator, _Sequence>::
_M_can_advance(const difference_type& __n) const _M_can_advance(const difference_type& __n) const
{ {
typedef typename _Sequence::const_iterator const_iterator; typedef typename _Sequence::const_iterator const_iterator;
if (this->_M_singular()) if (this->_M_singular())
return false; return false;
if (__n == 0) if (__n == 0)
return true; return true;
if (__n < 0) if (__n < 0)
{ {
const_iterator __begin = const_iterator __begin =
static_cast<const _Sequence*>(_M_sequence)->begin(); static_cast<const _Sequence*>(_M_sequence)->begin();
pair<difference_type, _Distance_precision> __dist = pair<difference_type, _Distance_precision> __dist =
this->_M_get_distance(__begin, *this); this->_M_get_distance(__begin, *this);
...@@ -61,47 +61,47 @@ namespace __gnu_debug ...@@ -61,47 +61,47 @@ namespace __gnu_debug
} }
else else
{ {
const_iterator __end = const_iterator __end =
static_cast<const _Sequence*>(_M_sequence)->end(); static_cast<const _Sequence*>(_M_sequence)->end();
pair<difference_type, _Distance_precision> __dist = pair<difference_type, _Distance_precision> __dist =
this->_M_get_distance(*this, __end); this->_M_get_distance(*this, __end);
bool __ok = (__dist.second == __dp_exact && __dist.first >= __n bool __ok = (__dist.second == __dp_exact && __dist.first >= __n
|| __dist.second != __dp_exact && __dist.first > 0); || __dist.second != __dp_exact && __dist.first > 0);
return __ok; return __ok;
} }
} }
template<typename _Iterator, typename _Sequence> template<typename _Iterator, typename _Sequence>
template<typename _Other> template<typename _Other>
bool bool
_Safe_iterator<_Iterator, _Sequence>:: _Safe_iterator<_Iterator, _Sequence>::
_M_valid_range(const _Safe_iterator<_Other, _Sequence>& __rhs) const _M_valid_range(const _Safe_iterator<_Other, _Sequence>& __rhs) const
{ {
if (!_M_can_compare(__rhs)) if (!_M_can_compare(__rhs))
return false; return false;
/* Determine if we can order the iterators without the help of /* Determine if we can order the iterators without the help of
the container */ the container */
pair<difference_type, _Distance_precision> __dist = pair<difference_type, _Distance_precision> __dist =
this->_M_get_distance(*this, __rhs); this->_M_get_distance(*this, __rhs);
switch (__dist.second) { switch (__dist.second) {
case __dp_equality: case __dp_equality:
if (__dist.first == 0) if (__dist.first == 0)
return true; return true;
break; break;
case __dp_sign: case __dp_sign:
case __dp_exact: case __dp_exact:
return __dist.first >= 0; return __dist.first >= 0;
} }
/* We can only test for equality, but check if one of the /* We can only test for equality, but check if one of the
iterators is at an extreme. */ iterators is at an extreme. */
if (_M_is_begin() || __rhs._M_is_end()) if (_M_is_begin() || __rhs._M_is_end())
return true; return true;
else if (_M_is_end() || __rhs._M_is_begin()) else if (_M_is_end() || __rhs._M_is_begin())
return false; return false;
// Assume that this is a valid range; we can't check anything else // Assume that this is a valid range; we can't check anything else
return true; return true;
} }
...@@ -113,7 +113,7 @@ namespace __gnu_debug ...@@ -113,7 +113,7 @@ namespace __gnu_debug
{ {
typedef typename _Sequence::iterator iterator; typedef typename _Sequence::iterator iterator;
typedef typename _Sequence::const_iterator const_iterator; typedef typename _Sequence::const_iterator const_iterator;
if (!this->_M_singular()) if (!this->_M_singular())
{ {
for (_Safe_iterator_base* iter = _M_sequence->_M_iterators; iter; ) for (_Safe_iterator_base* iter = _M_sequence->_M_iterators; iter; )
...@@ -136,5 +136,5 @@ namespace __gnu_debug ...@@ -136,5 +136,5 @@ namespace __gnu_debug
} }
} // namespace __gnu_debug } // namespace __gnu_debug
#endif #endif
...@@ -36,26 +36,26 @@ ...@@ -36,26 +36,26 @@
namespace __gnu_debug namespace __gnu_debug
{ {
template<typename _Iterator, typename _Sequence> template<typename _Iterator, typename _Sequence>
class _Safe_iterator; class _Safe_iterator;
/** A simple function object that returns true if the passed-in /** A simple function object that returns true if the passed-in
* value is not equal to the stored value. It saves typing over * value is not equal to the stored value. It saves typing over
* using both bind1st and not_equal. * using both bind1st and not_equal.
*/ */
template<typename _Type> template<typename _Type>
class _Not_equal_to class _Not_equal_to
{ {
_Type __value; _Type __value;
public: public:
explicit _Not_equal_to(const _Type& __v) : __value(__v) { } explicit _Not_equal_to(const _Type& __v) : __value(__v) { }
bool bool
operator()(const _Type& __x) const operator()(const _Type& __x) const
{ return __value != __x; } { return __value != __x; }
}; };
/** A function object that returns true when the given random access /** A function object that returns true when the given random access
iterator is at least @c n steps away from the given iterator. */ iterator is at least @c n steps away from the given iterator. */
template<typename _Iterator> template<typename _Iterator>
...@@ -63,19 +63,19 @@ namespace __gnu_debug ...@@ -63,19 +63,19 @@ namespace __gnu_debug
{ {
typedef typename std::iterator_traits<_Iterator>::difference_type typedef typename std::iterator_traits<_Iterator>::difference_type
difference_type; difference_type;
_Iterator _M_base; _Iterator _M_base;
difference_type _M_n; difference_type _M_n;
public: public:
_After_nth_from(const difference_type& __n, const _Iterator& __base) _After_nth_from(const difference_type& __n, const _Iterator& __base)
: _M_base(__base), _M_n(__n) { } : _M_base(__base), _M_n(__n) { }
bool bool
operator()(const _Iterator& __x) const operator()(const _Iterator& __x) const
{ return __x - _M_base >= _M_n; } { return __x - _M_base >= _M_n; }
}; };
/** /**
* @brief Base class for constructing a "safe" sequence type that * @brief Base class for constructing a "safe" sequence type that
* tracks iterators that reference it. * tracks iterators that reference it.
...@@ -101,8 +101,8 @@ namespace __gnu_debug ...@@ -101,8 +101,8 @@ namespace __gnu_debug
true. The user of this routine should be careful not to make true. The user of this routine should be careful not to make
copies of the iterators passed to @p pred, as the copies may copies of the iterators passed to @p pred, as the copies may
interfere with the invalidation. */ interfere with the invalidation. */
template<typename _Predicate> template<typename _Predicate>
void void
_M_invalidate_if(_Predicate __pred); _M_invalidate_if(_Predicate __pred);
/** Transfers all iterators that reference this memory location /** Transfers all iterators that reference this memory location
...@@ -114,19 +114,19 @@ namespace __gnu_debug ...@@ -114,19 +114,19 @@ namespace __gnu_debug
}; };
template<typename _Sequence> template<typename _Sequence>
template<typename _Predicate> template<typename _Predicate>
void void
_Safe_sequence<_Sequence>:: _Safe_sequence<_Sequence>::
_M_invalidate_if(_Predicate __pred) _M_invalidate_if(_Predicate __pred)
{ {
typedef typename _Sequence::iterator iterator; typedef typename _Sequence::iterator iterator;
typedef typename _Sequence::const_iterator const_iterator; typedef typename _Sequence::const_iterator const_iterator;
for (_Safe_iterator_base* __iter = _M_iterators; __iter; ) for (_Safe_iterator_base* __iter = _M_iterators; __iter; )
{ {
iterator* __victim = static_cast<iterator*>(__iter); iterator* __victim = static_cast<iterator*>(__iter);
__iter = __iter->_M_next; __iter = __iter->_M_next;
if (!__victim->_M_singular()) if (!__victim->_M_singular())
{ {
if (__pred(__victim->base())) if (__pred(__victim->base()))
__victim->_M_invalidate(); __victim->_M_invalidate();
...@@ -137,12 +137,12 @@ namespace __gnu_debug ...@@ -137,12 +137,12 @@ namespace __gnu_debug
{ {
const_iterator* __victim = static_cast<const_iterator*>(__iter); const_iterator* __victim = static_cast<const_iterator*>(__iter);
__iter = __iter->_M_next; __iter = __iter->_M_next;
if (!__victim->_M_singular()) if (!__victim->_M_singular())
{ {
if (__pred(__victim->base())) if (__pred(__victim->base()))
__victim->_M_invalidate(); __victim->_M_invalidate();
} }
} }
} }
template<typename _Sequence> template<typename _Sequence>
...@@ -157,7 +157,7 @@ namespace __gnu_debug ...@@ -157,7 +157,7 @@ namespace __gnu_debug
typedef typename _Sequence::iterator iterator; typedef typename _Sequence::iterator iterator;
typedef typename _Sequence::const_iterator const_iterator; typedef typename _Sequence::const_iterator const_iterator;
for (_Safe_iterator_base* __iter = __from->_M_iterators; __iter; ) for (_Safe_iterator_base* __iter = __from->_M_iterators; __iter; )
{ {
iterator* __victim = static_cast<iterator*>(__iter); iterator* __victim = static_cast<iterator*>(__iter);
...@@ -176,4 +176,4 @@ namespace __gnu_debug ...@@ -176,4 +176,4 @@ namespace __gnu_debug
} }
} // namespace __gnu_debug } // namespace __gnu_debug
#endif #endif
...@@ -45,18 +45,18 @@ namespace __gnu_debug_def ...@@ -45,18 +45,18 @@ namespace __gnu_debug_def
{ {
typedef __gnu_norm::set<_Key,_Compare,_Allocator> _Base; typedef __gnu_norm::set<_Key,_Compare,_Allocator> _Base;
typedef __gnu_debug::_Safe_sequence<set> _Safe_base; typedef __gnu_debug::_Safe_sequence<set> _Safe_base;
public: public:
// types: // types:
typedef _Key key_type; typedef _Key key_type;
typedef _Key value_type; typedef _Key value_type;
typedef _Compare key_compare; typedef _Compare key_compare;
typedef _Compare value_compare; typedef _Compare value_compare;
typedef _Allocator allocator_type; typedef _Allocator allocator_type;
typedef typename _Allocator::reference reference; typedef typename _Allocator::reference reference;
typedef typename _Allocator::const_reference const_reference; typedef typename _Allocator::const_reference const_reference;
typedef __gnu_debug::_Safe_iterator<typename _Base::iterator, set> typedef __gnu_debug::_Safe_iterator<typename _Base::iterator, set>
iterator; iterator;
typedef __gnu_debug::_Safe_iterator<typename _Base::const_iterator, set> typedef __gnu_debug::_Safe_iterator<typename _Base::const_iterator, set>
const_iterator; const_iterator;
...@@ -67,12 +67,12 @@ namespace __gnu_debug_def ...@@ -67,12 +67,12 @@ namespace __gnu_debug_def
typedef typename _Allocator::const_pointer const_pointer; typedef typename _Allocator::const_pointer const_pointer;
typedef std::reverse_iterator<iterator> reverse_iterator; typedef std::reverse_iterator<iterator> reverse_iterator;
typedef std::reverse_iterator<const_iterator> const_reverse_iterator; typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
// 23.3.3.1 construct/copy/destroy: // 23.3.3.1 construct/copy/destroy:
explicit set(const _Compare& __comp = _Compare(), explicit set(const _Compare& __comp = _Compare(),
const _Allocator& __a = _Allocator()) const _Allocator& __a = _Allocator())
: _Base(__comp, __a) { } : _Base(__comp, __a) { }
template<typename _InputIterator> template<typename _InputIterator>
set(_InputIterator __first, _InputIterator __last, set(_InputIterator __first, _InputIterator __last,
const _Compare& __comp = _Compare(), const _Compare& __comp = _Compare(),
...@@ -80,63 +80,63 @@ namespace __gnu_debug_def ...@@ -80,63 +80,63 @@ namespace __gnu_debug_def
: _Base(__gnu_debug::__check_valid_range(__first, __last), __last, : _Base(__gnu_debug::__check_valid_range(__first, __last), __last,
__comp, __a) { } __comp, __a) { }
set(const set<_Key,_Compare,_Allocator>& __x) set(const set<_Key,_Compare,_Allocator>& __x)
: _Base(__x), _Safe_base() { } : _Base(__x), _Safe_base() { }
set(const _Base& __x) : _Base(__x), _Safe_base() { } set(const _Base& __x) : _Base(__x), _Safe_base() { }
~set() { } ~set() { }
set<_Key,_Compare,_Allocator>& set<_Key,_Compare,_Allocator>&
operator=(const set<_Key,_Compare,_Allocator>& __x) operator=(const set<_Key,_Compare,_Allocator>& __x)
{ {
*static_cast<_Base*>(this) = __x; *static_cast<_Base*>(this) = __x;
this->_M_invalidate_all(); this->_M_invalidate_all();
return *this; return *this;
} }
using _Base::get_allocator; using _Base::get_allocator;
// iterators: // iterators:
iterator iterator
begin() begin()
{ return iterator(_Base::begin(), this); } { return iterator(_Base::begin(), this); }
const_iterator const_iterator
begin() const begin() const
{ return const_iterator(_Base::begin(), this); } { return const_iterator(_Base::begin(), this); }
iterator iterator
end() end()
{ return iterator(_Base::end(), this); } { return iterator(_Base::end(), this); }
const_iterator const_iterator
end() const end() const
{ return const_iterator(_Base::end(), this); } { return const_iterator(_Base::end(), this); }
reverse_iterator reverse_iterator
rbegin() rbegin()
{ return reverse_iterator(end()); } { return reverse_iterator(end()); }
const_reverse_iterator const_reverse_iterator
rbegin() const rbegin() const
{ return const_reverse_iterator(end()); } { return const_reverse_iterator(end()); }
reverse_iterator reverse_iterator
rend() rend()
{ return reverse_iterator(begin()); } { return reverse_iterator(begin()); }
const_reverse_iterator const_reverse_iterator
rend() const rend() const
{ return const_reverse_iterator(begin()); } { return const_reverse_iterator(begin()); }
// capacity: // capacity:
using _Base::empty; using _Base::empty;
using _Base::size; using _Base::size;
using _Base::max_size; using _Base::max_size;
// modifiers: // modifiers:
std::pair<iterator, bool> std::pair<iterator, bool>
insert(const value_type& __x) insert(const value_type& __x)
{ {
typedef typename _Base::iterator _Base_iterator; typedef typename _Base::iterator _Base_iterator;
...@@ -144,31 +144,31 @@ namespace __gnu_debug_def ...@@ -144,31 +144,31 @@ namespace __gnu_debug_def
return std::pair<iterator, bool>(iterator(__res.first, this), return std::pair<iterator, bool>(iterator(__res.first, this),
__res.second); __res.second);
} }
iterator iterator
insert(iterator __position, const value_type& __x) insert(iterator __position, const value_type& __x)
{ {
__glibcxx_check_insert(__position); __glibcxx_check_insert(__position);
return iterator(_Base::insert(__position.base(), __x), this); return iterator(_Base::insert(__position.base(), __x), this);
} }
template <typename _InputIterator> template <typename _InputIterator>
void void
insert(_InputIterator __first, _InputIterator __last) insert(_InputIterator __first, _InputIterator __last)
{ {
__glibcxx_check_valid_range(__first, __last); __glibcxx_check_valid_range(__first, __last);
_Base::insert(__first, __last); _Base::insert(__first, __last);
} }
void void
erase(iterator __position) erase(iterator __position)
{ {
__glibcxx_check_erase(__position); __glibcxx_check_erase(__position);
__position._M_invalidate(); __position._M_invalidate();
_Base::erase(__position.base()); _Base::erase(__position.base());
} }
size_type size_type
erase(const key_type& __x) erase(const key_type& __x)
{ {
iterator __victim = find(__x); iterator __victim = find(__x);
...@@ -181,66 +181,66 @@ namespace __gnu_debug_def ...@@ -181,66 +181,66 @@ namespace __gnu_debug_def
return 1; return 1;
} }
} }
void void
erase(iterator __first, iterator __last) erase(iterator __first, iterator __last)
{ {
// _GLIBCXX_RESOLVE_LIB_DEFECTS // _GLIBCXX_RESOLVE_LIB_DEFECTS
// 151. can't currently clear() empty container // 151. can't currently clear() empty container
__glibcxx_check_erase_range(__first, __last); __glibcxx_check_erase_range(__first, __last);
while (__first != __last) while (__first != __last)
this->erase(__first++); this->erase(__first++);
} }
void void
swap(set<_Key,_Compare,_Allocator>& __x) swap(set<_Key,_Compare,_Allocator>& __x)
{ {
_Base::swap(__x); _Base::swap(__x);
this->_M_swap(__x); this->_M_swap(__x);
} }
void void
clear() clear()
{ this->erase(begin(), end()); } { this->erase(begin(), end()); }
// observers: // observers:
using _Base::key_comp; using _Base::key_comp;
using _Base::value_comp; using _Base::value_comp;
// set operations: // set operations:
iterator iterator
find(const key_type& __x) find(const key_type& __x)
{ return iterator(_Base::find(__x), this); } { return iterator(_Base::find(__x), this); }
// _GLIBCXX_RESOLVE_LIB_DEFECTS // _GLIBCXX_RESOLVE_LIB_DEFECTS
// 214. set::find() missing const overload // 214. set::find() missing const overload
const_iterator const_iterator
find(const key_type& __x) const find(const key_type& __x) const
{ return const_iterator(_Base::find(__x), this); } { return const_iterator(_Base::find(__x), this); }
using _Base::count; using _Base::count;
iterator iterator
lower_bound(const key_type& __x) lower_bound(const key_type& __x)
{ return iterator(_Base::lower_bound(__x), this); } { return iterator(_Base::lower_bound(__x), this); }
// _GLIBCXX_RESOLVE_LIB_DEFECTS // _GLIBCXX_RESOLVE_LIB_DEFECTS
// 214. set::find() missing const overload // 214. set::find() missing const overload
const_iterator const_iterator
lower_bound(const key_type& __x) const lower_bound(const key_type& __x) const
{ return const_iterator(_Base::lower_bound(__x), this); } { return const_iterator(_Base::lower_bound(__x), this); }
iterator iterator
upper_bound(const key_type& __x) upper_bound(const key_type& __x)
{ return iterator(_Base::upper_bound(__x), this); } { return iterator(_Base::upper_bound(__x), this); }
// _GLIBCXX_RESOLVE_LIB_DEFECTS // _GLIBCXX_RESOLVE_LIB_DEFECTS
// 214. set::find() missing const overload // 214. set::find() missing const overload
const_iterator const_iterator
upper_bound(const key_type& __x) const upper_bound(const key_type& __x) const
{ return const_iterator(_Base::upper_bound(__x), this); } { return const_iterator(_Base::upper_bound(__x), this); }
std::pair<iterator,iterator> std::pair<iterator,iterator>
equal_range(const key_type& __x) equal_range(const key_type& __x)
{ {
...@@ -250,7 +250,7 @@ namespace __gnu_debug_def ...@@ -250,7 +250,7 @@ namespace __gnu_debug_def
return std::make_pair(iterator(__res.first, this), return std::make_pair(iterator(__res.first, this),
iterator(__res.second, this)); iterator(__res.second, this));
} }
// _GLIBCXX_RESOLVE_LIB_DEFECTS // _GLIBCXX_RESOLVE_LIB_DEFECTS
// 214. set::find() missing const overload // 214. set::find() missing const overload
std::pair<const_iterator,const_iterator> std::pair<const_iterator,const_iterator>
...@@ -262,15 +262,15 @@ namespace __gnu_debug_def ...@@ -262,15 +262,15 @@ namespace __gnu_debug_def
return std::make_pair(const_iterator(__res.first, this), return std::make_pair(const_iterator(__res.first, this),
const_iterator(__res.second, this)); const_iterator(__res.second, this));
} }
_Base& _Base&
_M_base() { return *this; } _M_base() { return *this; }
const _Base& const _Base&
_M_base() const { return *this; } _M_base() const { return *this; }
private: private:
void void
_M_invalidate_all() _M_invalidate_all()
{ {
typedef typename _Base::const_iterator _Base_const_iterator; typedef typename _Base::const_iterator _Base_const_iterator;
...@@ -278,46 +278,46 @@ namespace __gnu_debug_def ...@@ -278,46 +278,46 @@ namespace __gnu_debug_def
this->_M_invalidate_if(_Not_equal(_M_base().end())); this->_M_invalidate_if(_Not_equal(_M_base().end()));
} }
}; };
template<typename _Key, typename _Compare, typename _Allocator> template<typename _Key, typename _Compare, typename _Allocator>
inline bool inline bool
operator==(const set<_Key,_Compare,_Allocator>& __lhs, operator==(const set<_Key,_Compare,_Allocator>& __lhs,
const set<_Key,_Compare,_Allocator>& __rhs) const set<_Key,_Compare,_Allocator>& __rhs)
{ return __lhs._M_base() == __rhs._M_base(); } { return __lhs._M_base() == __rhs._M_base(); }
template<typename _Key, typename _Compare, typename _Allocator> template<typename _Key, typename _Compare, typename _Allocator>
inline bool inline bool
operator!=(const set<_Key,_Compare,_Allocator>& __lhs, operator!=(const set<_Key,_Compare,_Allocator>& __lhs,
const set<_Key,_Compare,_Allocator>& __rhs) const set<_Key,_Compare,_Allocator>& __rhs)
{ return __lhs._M_base() != __rhs._M_base(); } { return __lhs._M_base() != __rhs._M_base(); }
template<typename _Key, typename _Compare, typename _Allocator> template<typename _Key, typename _Compare, typename _Allocator>
inline bool inline bool
operator<(const set<_Key,_Compare,_Allocator>& __lhs, operator<(const set<_Key,_Compare,_Allocator>& __lhs,
const set<_Key,_Compare,_Allocator>& __rhs) const set<_Key,_Compare,_Allocator>& __rhs)
{ return __lhs._M_base() < __rhs._M_base(); } { return __lhs._M_base() < __rhs._M_base(); }
template<typename _Key, typename _Compare, typename _Allocator> template<typename _Key, typename _Compare, typename _Allocator>
inline bool inline bool
operator<=(const set<_Key,_Compare,_Allocator>& __lhs, operator<=(const set<_Key,_Compare,_Allocator>& __lhs,
const set<_Key,_Compare,_Allocator>& __rhs) const set<_Key,_Compare,_Allocator>& __rhs)
{ return __lhs._M_base() <= __rhs._M_base(); } { return __lhs._M_base() <= __rhs._M_base(); }
template<typename _Key, typename _Compare, typename _Allocator> template<typename _Key, typename _Compare, typename _Allocator>
inline bool inline bool
operator>=(const set<_Key,_Compare,_Allocator>& __lhs, operator>=(const set<_Key,_Compare,_Allocator>& __lhs,
const set<_Key,_Compare,_Allocator>& __rhs) const set<_Key,_Compare,_Allocator>& __rhs)
{ return __lhs._M_base() >= __rhs._M_base(); } { return __lhs._M_base() >= __rhs._M_base(); }
template<typename _Key, typename _Compare, typename _Allocator> template<typename _Key, typename _Compare, typename _Allocator>
inline bool inline bool
operator>(const set<_Key,_Compare,_Allocator>& __lhs, operator>(const set<_Key,_Compare,_Allocator>& __lhs,
const set<_Key,_Compare,_Allocator>& __rhs) const set<_Key,_Compare,_Allocator>& __rhs)
{ return __lhs._M_base() > __rhs._M_base(); } { return __lhs._M_base() > __rhs._M_base(); }
template<typename _Key, typename _Compare, typename _Allocator> template<typename _Key, typename _Compare, typename _Allocator>
void void
swap(set<_Key,_Compare,_Allocator>& __x, swap(set<_Key,_Compare,_Allocator>& __x,
set<_Key,_Compare,_Allocator>& __y) set<_Key,_Compare,_Allocator>& __y)
{ return __x.swap(__y); } { return __x.swap(__y); }
} // namespace __gnu_debug_def } // namespace __gnu_debug_def
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
namespace __gnu_debug_def namespace __gnu_debug_def
{ {
template<typename _Tp, template<typename _Tp,
typename _Allocator = std::allocator<_Tp> > typename _Allocator = std::allocator<_Tp> >
class vector class vector
: public __gnu_norm::vector<_Tp, _Allocator>, : public __gnu_norm::vector<_Tp, _Allocator>,
...@@ -54,7 +54,7 @@ namespace __gnu_debug_def ...@@ -54,7 +54,7 @@ namespace __gnu_debug_def
typedef typename _Base::reference reference; typedef typename _Base::reference reference;
typedef typename _Base::const_reference const_reference; typedef typename _Base::const_reference const_reference;
typedef __gnu_debug::_Safe_iterator<typename _Base::iterator,vector> typedef __gnu_debug::_Safe_iterator<typename _Base::iterator,vector>
iterator; iterator;
typedef __gnu_debug::_Safe_iterator<typename _Base::const_iterator,vector> typedef __gnu_debug::_Safe_iterator<typename _Base::const_iterator,vector>
const_iterator; const_iterator;
...@@ -62,8 +62,8 @@ namespace __gnu_debug_def ...@@ -62,8 +62,8 @@ namespace __gnu_debug_def
typedef typename _Base::size_type size_type; typedef typename _Base::size_type size_type;
typedef typename _Base::difference_type difference_type; typedef typename _Base::difference_type difference_type;
typedef _Tp value_type; typedef _Tp value_type;
typedef _Allocator allocator_type; typedef _Allocator allocator_type;
typedef typename _Allocator::pointer pointer; typedef typename _Allocator::pointer pointer;
typedef typename _Allocator::const_pointer const_pointer; typedef typename _Allocator::const_pointer const_pointer;
typedef std::reverse_iterator<iterator> reverse_iterator; typedef std::reverse_iterator<iterator> reverse_iterator;
...@@ -80,21 +80,21 @@ namespace __gnu_debug_def ...@@ -80,21 +80,21 @@ namespace __gnu_debug_def
template<class _InputIterator> template<class _InputIterator>
vector(_InputIterator __first, _InputIterator __last, vector(_InputIterator __first, _InputIterator __last,
const _Allocator& __a = _Allocator()) const _Allocator& __a = _Allocator())
: _Base(__gnu_debug::__check_valid_range(__first, __last), : _Base(__gnu_debug::__check_valid_range(__first, __last),
__last, __a), __last, __a),
_M_guaranteed_capacity(0) _M_guaranteed_capacity(0)
{ _M_update_guaranteed_capacity(); } { _M_update_guaranteed_capacity(); }
vector(const vector<_Tp,_Allocator>& __x) vector(const vector<_Tp,_Allocator>& __x)
: _Base(__x), _Safe_base(), _M_guaranteed_capacity(__x.size()) { } : _Base(__x), _Safe_base(), _M_guaranteed_capacity(__x.size()) { }
/// Construction from a release-mode vector /// Construction from a release-mode vector
vector(const _Base& __x) vector(const _Base& __x)
: _Base(__x), _Safe_base(), _M_guaranteed_capacity(__x.size()) { } : _Base(__x), _Safe_base(), _M_guaranteed_capacity(__x.size()) { }
~vector() { } ~vector() { }
vector<_Tp,_Allocator>& vector<_Tp,_Allocator>&
operator=(const vector<_Tp,_Allocator>& __x) operator=(const vector<_Tp,_Allocator>& __x)
{ {
static_cast<_Base&>(*this) = __x; static_cast<_Base&>(*this) = __x;
...@@ -104,7 +104,7 @@ namespace __gnu_debug_def ...@@ -104,7 +104,7 @@ namespace __gnu_debug_def
} }
template<typename _InputIterator> template<typename _InputIterator>
void void
assign(_InputIterator __first, _InputIterator __last) assign(_InputIterator __first, _InputIterator __last)
{ {
__glibcxx_check_valid_range(__first, __last); __glibcxx_check_valid_range(__first, __last);
...@@ -113,7 +113,7 @@ namespace __gnu_debug_def ...@@ -113,7 +113,7 @@ namespace __gnu_debug_def
_M_update_guaranteed_capacity(); _M_update_guaranteed_capacity();
} }
void void
assign(size_type __n, const _Tp& __u) assign(size_type __n, const _Tp& __u)
{ {
_Base::assign(__n, __u); _Base::assign(__n, __u);
...@@ -124,43 +124,43 @@ namespace __gnu_debug_def ...@@ -124,43 +124,43 @@ namespace __gnu_debug_def
using _Base::get_allocator; using _Base::get_allocator;
// iterators: // iterators:
iterator iterator
begin() begin()
{ return iterator(_Base::begin(), this); } { return iterator(_Base::begin(), this); }
const_iterator const_iterator
begin() const begin() const
{ return const_iterator(_Base::begin(), this); } { return const_iterator(_Base::begin(), this); }
iterator iterator
end() end()
{ return iterator(_Base::end(), this); } { return iterator(_Base::end(), this); }
const_iterator const_iterator
end() const end() const
{ return const_iterator(_Base::end(), this); } { return const_iterator(_Base::end(), this); }
reverse_iterator reverse_iterator
rbegin() rbegin()
{ return reverse_iterator(end()); } { return reverse_iterator(end()); }
const_reverse_iterator const_reverse_iterator
rbegin() const rbegin() const
{ return const_reverse_iterator(end()); } { return const_reverse_iterator(end()); }
reverse_iterator reverse_iterator
rend() rend()
{ return reverse_iterator(begin()); } { return reverse_iterator(begin()); }
const_reverse_iterator const_reverse_iterator
rend() const rend() const
{ return const_reverse_iterator(begin()); } { return const_reverse_iterator(begin()); }
// 23.2.4.2 capacity: // 23.2.4.2 capacity:
using _Base::size; using _Base::size;
using _Base::max_size; using _Base::max_size;
void void
resize(size_type __sz, _Tp __c = _Tp()) resize(size_type __sz, _Tp __c = _Tp())
{ {
bool __realloc = _M_requires_reallocation(__sz); bool __realloc = _M_requires_reallocation(__sz);
...@@ -174,7 +174,7 @@ namespace __gnu_debug_def ...@@ -174,7 +174,7 @@ namespace __gnu_debug_def
using _Base::capacity; using _Base::capacity;
using _Base::empty; using _Base::empty;
void void
reserve(size_type __n) reserve(size_type __n)
{ {
bool __realloc = _M_requires_reallocation(__n); bool __realloc = _M_requires_reallocation(__n);
...@@ -186,14 +186,14 @@ namespace __gnu_debug_def ...@@ -186,14 +186,14 @@ namespace __gnu_debug_def
} }
// element access: // element access:
reference reference
operator[](size_type __n) operator[](size_type __n)
{ {
__glibcxx_check_subscript(__n); __glibcxx_check_subscript(__n);
return _M_base()[__n]; return _M_base()[__n];
} }
const_reference const_reference
operator[](size_type __n) const operator[](size_type __n) const
{ {
__glibcxx_check_subscript(__n); __glibcxx_check_subscript(__n);
...@@ -202,28 +202,28 @@ namespace __gnu_debug_def ...@@ -202,28 +202,28 @@ namespace __gnu_debug_def
using _Base::at; using _Base::at;
reference reference
front() front()
{ {
__glibcxx_check_nonempty(); __glibcxx_check_nonempty();
return _Base::front(); return _Base::front();
} }
const_reference const_reference
front() const front() const
{ {
__glibcxx_check_nonempty(); __glibcxx_check_nonempty();
return _Base::front(); return _Base::front();
} }
reference reference
back() back()
{ {
__glibcxx_check_nonempty(); __glibcxx_check_nonempty();
return _Base::back(); return _Base::back();
} }
const_reference const_reference
back() const back() const
{ {
__glibcxx_check_nonempty(); __glibcxx_check_nonempty();
...@@ -231,7 +231,7 @@ namespace __gnu_debug_def ...@@ -231,7 +231,7 @@ namespace __gnu_debug_def
} }
// 23.2.4.3 modifiers: // 23.2.4.3 modifiers:
void void
push_back(const _Tp& __x) push_back(const _Tp& __x)
{ {
bool __realloc = _M_requires_reallocation(this->size() + 1); bool __realloc = _M_requires_reallocation(this->size() + 1);
...@@ -241,7 +241,7 @@ namespace __gnu_debug_def ...@@ -241,7 +241,7 @@ namespace __gnu_debug_def
_M_update_guaranteed_capacity(); _M_update_guaranteed_capacity();
} }
void void
pop_back() pop_back()
{ {
__glibcxx_check_nonempty(); __glibcxx_check_nonempty();
...@@ -250,7 +250,7 @@ namespace __gnu_debug_def ...@@ -250,7 +250,7 @@ namespace __gnu_debug_def
_Base::pop_back(); _Base::pop_back();
} }
iterator iterator
insert(iterator __position, const _Tp& __x) insert(iterator __position, const _Tp& __x)
{ {
__glibcxx_check_insert(__position); __glibcxx_check_insert(__position);
...@@ -265,7 +265,7 @@ namespace __gnu_debug_def ...@@ -265,7 +265,7 @@ namespace __gnu_debug_def
return iterator(__res, this); return iterator(__res, this);
} }
void void
insert(iterator __position, size_type __n, const _Tp& __x) insert(iterator __position, size_type __n, const _Tp& __x)
{ {
__glibcxx_check_insert(__position); __glibcxx_check_insert(__position);
...@@ -280,27 +280,27 @@ namespace __gnu_debug_def ...@@ -280,27 +280,27 @@ namespace __gnu_debug_def
} }
template<class _InputIterator> template<class _InputIterator>
void void
insert(iterator __position, insert(iterator __position,
_InputIterator __first, _InputIterator __last) _InputIterator __first, _InputIterator __last)
{ {
__glibcxx_check_insert_range(__position, __first, __last); __glibcxx_check_insert_range(__position, __first, __last);
/* Hard to guess if invalidation will occur, because __last /* Hard to guess if invalidation will occur, because __last
- __first can't be calculated in all cases, so we just - __first can't be calculated in all cases, so we just
punt here by checking if it did occur. */ punt here by checking if it did occur. */
typename _Base::iterator __old_begin = _M_base().begin(); typename _Base::iterator __old_begin = _M_base().begin();
difference_type __offset = __position - begin(); difference_type __offset = __position - begin();
_Base::insert(__position.base(), __first, __last); _Base::insert(__position.base(), __first, __last);
if (_M_base().begin() != __old_begin) if (_M_base().begin() != __old_begin)
this->_M_invalidate_all(); this->_M_invalidate_all();
else else
this->_M_invalidate_if(_After_nth(__offset, _M_base().begin())); this->_M_invalidate_if(_After_nth(__offset, _M_base().begin()));
_M_update_guaranteed_capacity(); _M_update_guaranteed_capacity();
} }
iterator iterator
erase(iterator __position) erase(iterator __position)
{ {
__glibcxx_check_erase(__position); __glibcxx_check_erase(__position);
...@@ -310,21 +310,21 @@ namespace __gnu_debug_def ...@@ -310,21 +310,21 @@ namespace __gnu_debug_def
return iterator(__res, this); return iterator(__res, this);
} }
iterator iterator
erase(iterator __first, iterator __last) erase(iterator __first, iterator __last)
{ {
// _GLIBCXX_RESOLVE_LIB_DEFECTS // _GLIBCXX_RESOLVE_LIB_DEFECTS
// 151. can't currently clear() empty container // 151. can't currently clear() empty container
__glibcxx_check_erase_range(__first, __last); __glibcxx_check_erase_range(__first, __last);
difference_type __offset = __first - begin(); difference_type __offset = __first - begin();
typename _Base::iterator __res = _Base::erase(__first.base(), typename _Base::iterator __res = _Base::erase(__first.base(),
__last.base()); __last.base());
this->_M_invalidate_if(_After_nth(__offset, _M_base().begin())); this->_M_invalidate_if(_After_nth(__offset, _M_base().begin()));
return iterator(__res, this); return iterator(__res, this);
} }
void void
swap(vector<_Tp,_Allocator>& __x) swap(vector<_Tp,_Allocator>& __x)
{ {
_Base::swap(__x); _Base::swap(__x);
...@@ -332,7 +332,7 @@ namespace __gnu_debug_def ...@@ -332,7 +332,7 @@ namespace __gnu_debug_def
std::swap(_M_guaranteed_capacity, __x._M_guaranteed_capacity); std::swap(_M_guaranteed_capacity, __x._M_guaranteed_capacity);
} }
void void
clear() clear()
{ {
_Base::clear(); _Base::clear();
...@@ -340,16 +340,16 @@ namespace __gnu_debug_def ...@@ -340,16 +340,16 @@ namespace __gnu_debug_def
_M_guaranteed_capacity = 0; _M_guaranteed_capacity = 0;
} }
_Base& _Base&
_M_base() { return *this; } _M_base() { return *this; }
const _Base& const _Base&
_M_base() const { return *this; } _M_base() const { return *this; }
private: private:
size_type _M_guaranteed_capacity; size_type _M_guaranteed_capacity;
bool bool
_M_requires_reallocation(size_type __elements) _M_requires_reallocation(size_type __elements)
{ {
#ifdef _GLIBCXX_DEBUG_PEDANTIC #ifdef _GLIBCXX_DEBUG_PEDANTIC
...@@ -358,8 +358,8 @@ namespace __gnu_debug_def ...@@ -358,8 +358,8 @@ namespace __gnu_debug_def
return __elements > _M_guaranteed_capacity; return __elements > _M_guaranteed_capacity;
#endif #endif
} }
void void
_M_update_guaranteed_capacity() _M_update_guaranteed_capacity()
{ {
if (this->size() > _M_guaranteed_capacity) if (this->size() > _M_guaranteed_capacity)
...@@ -375,31 +375,31 @@ namespace __gnu_debug_def ...@@ -375,31 +375,31 @@ namespace __gnu_debug_def
template<typename _Tp, typename _Alloc> template<typename _Tp, typename _Alloc>
inline bool inline bool
operator!=(const vector<_Tp, _Alloc>& __lhs, operator!=(const vector<_Tp, _Alloc>& __lhs,
const vector<_Tp, _Alloc>& __rhs) const vector<_Tp, _Alloc>& __rhs)
{ return __lhs._M_base() != __rhs._M_base(); } { return __lhs._M_base() != __rhs._M_base(); }
template<typename _Tp, typename _Alloc> template<typename _Tp, typename _Alloc>
inline bool inline bool
operator<(const vector<_Tp, _Alloc>& __lhs, operator<(const vector<_Tp, _Alloc>& __lhs,
const vector<_Tp, _Alloc>& __rhs) const vector<_Tp, _Alloc>& __rhs)
{ return __lhs._M_base() < __rhs._M_base(); } { return __lhs._M_base() < __rhs._M_base(); }
template<typename _Tp, typename _Alloc> template<typename _Tp, typename _Alloc>
inline bool inline bool
operator<=(const vector<_Tp, _Alloc>& __lhs, operator<=(const vector<_Tp, _Alloc>& __lhs,
const vector<_Tp, _Alloc>& __rhs) const vector<_Tp, _Alloc>& __rhs)
{ return __lhs._M_base() <= __rhs._M_base(); } { return __lhs._M_base() <= __rhs._M_base(); }
template<typename _Tp, typename _Alloc> template<typename _Tp, typename _Alloc>
inline bool inline bool
operator>=(const vector<_Tp, _Alloc>& __lhs, operator>=(const vector<_Tp, _Alloc>& __lhs,
const vector<_Tp, _Alloc>& __rhs) const vector<_Tp, _Alloc>& __rhs)
{ return __lhs._M_base() >= __rhs._M_base(); } { return __lhs._M_base() >= __rhs._M_base(); }
template<typename _Tp, typename _Alloc> template<typename _Tp, typename _Alloc>
inline bool inline bool
operator>(const vector<_Tp, _Alloc>& __lhs, operator>(const vector<_Tp, _Alloc>& __lhs,
const vector<_Tp, _Alloc>& __rhs) const vector<_Tp, _Alloc>& __rhs)
{ return __lhs._M_base() > __rhs._M_base(); } { return __lhs._M_base() > __rhs._M_base(); }
...@@ -409,4 +409,4 @@ namespace __gnu_debug_def ...@@ -409,4 +409,4 @@ namespace __gnu_debug_def
{ __lhs.swap(__rhs); } { __lhs.swap(__rhs); }
} // namespace __gnu_debug_def } // namespace __gnu_debug_def
#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