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