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
This commit is contained in:
Bernardo Innocenti 2003-12-09 05:26:28 +01:00 committed by Bernardo Innocenti
parent a6f86b5167
commit 526da49cc7
21 changed files with 1157 additions and 1145 deletions

View File

@ -1,3 +1,15 @@
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,

View File

@ -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

View File

@ -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

View File

@ -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(); }

View File

@ -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

View File

@ -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

View File

@ -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 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 __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,

View File

@ -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 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 __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;

View File

@ -35,4 +35,4 @@
#include <debug/dbg_hash_set.h>
#include <debug/dbg_hash_multiset.h>
#endif
#endif

View File

@ -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,

View File

@ -49,17 +49,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, list>
iterator;
typedef __gnu_debug::_Safe_iterator<typename _Base::iterator, list>
iterator;
typedef __gnu_debug::_Safe_iterator<typename _Base::const_iterator, list>
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;
@ -78,96 +78,96 @@ namespace __gnu_debug_def
const _Allocator& __a = _Allocator())
: _Base(__gnu_debug::__check_valid_range(__first, __last), __last, __a)
{ }
list(const list& __x) : _Base(__x), _Safe_base() { }
list(const _Base& __x) : _Base(__x), _Safe_base() { }
~list() { }
list&
list&
operator=(const list& __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);
_Base::assign(__first, __last);
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
rend() const
const_reverse_iterator
rend() const
{ return const_reverse_iterator(begin()); }
// 23.2.2.2 capacity:
using _Base::empty;
using _Base::size;
using _Base::max_size;
void
void
resize(size_type __sz, _Tp __c = _Tp())
{
this->_M_detach_singular();
// if __sz < size(), invalidate all iterators in [begin+__sz, end())
iterator __victim = begin();
iterator __end = end();
for (size_type __i = __sz; __victim != __end && __i > 0; --__i)
++__victim;
while (__victim != __end)
{
iterator __real_victim = __victim++;
__real_victim._M_invalidate();
}
try
try
{
_Base::resize(__sz, __c);
}
@ -177,40 +177,40 @@ namespace __gnu_debug_def
__throw_exception_again;
}
}
// element access:
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.2.3 modifiers:
using _Base::push_front;
void
void
pop_front()
{
__glibcxx_check_nonempty();
@ -218,10 +218,10 @@ namespace __gnu_debug_def
__victim._M_invalidate();
_Base::pop_front();
}
using _Base::push_back;
void
void
pop_back()
{
__glibcxx_check_nonempty();
@ -230,39 +230,39 @@ namespace __gnu_debug_def
__victim._M_invalidate();
_Base::pop_back();
}
iterator
iterator
insert(iterator __position, const _Tp& __x)
{
__glibcxx_check_insert(__position);
return iterator(_Base::insert(__position.base(), __x), this);
}
void
void
insert(iterator __position, size_type __n, const _Tp& __x)
{
__glibcxx_check_insert(__position);
_Base::insert(__position.base(), __n, __x);
}
template<class _InputIterator>
void
void
insert(iterator __position, _InputIterator __first,
_InputIterator __last)
{
__glibcxx_check_insert_range(__position, __first, __last);
_Base::insert(__position.base(), __first, __last);
}
iterator
iterator
erase(iterator __position)
{
__glibcxx_check_erase(__position);
__position._M_invalidate();
return iterator(_Base::erase(__position.base()), this);
}
iterator
iterator
erase(iterator __position, iterator __last)
{
// _GLIBCXX_RESOLVE_LIB_DEFECTS
@ -276,23 +276,23 @@ namespace __gnu_debug_def
}
return iterator(_Base::erase(__position.base(), __last.base()), this);
}
void
void
swap(list& __x)
{
_Base::swap(__x);
this->_M_swap(__x);
}
void
void
clear()
{
_Base::clear();
this->_M_invalidate_all();
}
// 23.2.2.4 list operations:
void
void
splice(iterator __position, list& __x)
{
_GLIBCXX_DEBUG_VERIFY(&__x != this,
@ -300,8 +300,8 @@ namespace __gnu_debug_def
._M_sequence(*this, "this"));
this->splice(__position, __x, __x.begin(), __x.end());
}
void
void
splice(iterator __position, list& __x, iterator __i)
{
__glibcxx_check_insert(__position);
@ -314,14 +314,14 @@ namespace __gnu_debug_def
_GLIBCXX_DEBUG_VERIFY(__i._M_attached_to(&__x),
_M_message(::__gnu_debug::__msg_splice_other)
._M_iterator(__i, "__i")._M_sequence(__x, "__x"));
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 250. splicing invalidates iterators
this->_M_transfer_iter(__i);
_Base::splice(__position.base(), __x._M_base(), __i.base());
}
void
void
splice(iterator __position, list& __x, iterator __first, iterator __last)
{
__glibcxx_check_insert(__position);
@ -333,7 +333,7 @@ namespace __gnu_debug_def
_GLIBCXX_DEBUG_VERIFY(__x.get_allocator() == this->get_allocator(),
_M_message(::__gnu_debug::__msg_splice_alloc)
._M_sequence(*this)._M_sequence(__x));
for (iterator __tmp = __first; __tmp != __last; )
{
_GLIBCXX_DEBUG_VERIFY(&__x != this || __tmp != __position,
@ -346,12 +346,12 @@ namespace __gnu_debug_def
// 250. splicing invalidates iterators
this->_M_transfer_iter(__victim);
}
_Base::splice(__position.base(), __x._M_base(), __first.base(),
__last.base());
}
void
void
remove(const _Tp& __value)
{
for (iterator __x = begin(); __x.base() != _Base::end(); )
@ -362,9 +362,9 @@ namespace __gnu_debug_def
++__x;
}
}
template<class _Predicate>
void
template<class _Predicate>
void
remove_if(_Predicate __pred)
{
for (iterator __x = begin(); __x.base() != _Base::end(); )
@ -375,13 +375,13 @@ namespace __gnu_debug_def
++__x;
}
}
void
void
unique()
{
iterator __first = begin();
iterator __last = end();
if (__first == __last)
if (__first == __last)
return;
iterator __next = __first;
while (++__next != __last)
@ -393,14 +393,14 @@ namespace __gnu_debug_def
__next = __first;
}
}
template<class _BinaryPredicate>
void
void
unique(_BinaryPredicate __binary_pred)
{
iterator __first = begin();
iterator __last = end();
if (__first == __last)
if (__first == __last)
return;
iterator __next = __first;
while (++__next != __last)
@ -412,8 +412,8 @@ namespace __gnu_debug_def
__next = __first;
}
}
void
void
merge(list& __x)
{
__glibcxx_check_sorted(_Base::begin(), _Base::end());
@ -425,13 +425,13 @@ namespace __gnu_debug_def
}
_Base::merge(__x._M_base());
}
template<class _Compare>
void
template<class _Compare>
void
merge(list& __x, _Compare __comp)
{
__glibcxx_check_sorted_pred(_Base::begin(), _Base::end(), __comp);
__glibcxx_check_sorted_pred(__x.begin().base(), __x.end().base(),
__glibcxx_check_sorted_pred(__x.begin().base(), __x.end().base(),
__comp);
for (iterator __tmp = __x.begin(); __tmp != __x.end(); )
{
@ -440,24 +440,24 @@ namespace __gnu_debug_def
}
_Base::merge(__x._M_base(), __comp);
}
void
void
sort() { _Base::sort(); }
template<typename _StrictWeakOrdering>
void
void
sort(_StrictWeakOrdering __pred) { _Base::sort(__pred); }
using _Base::reverse;
_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;
@ -465,7 +465,7 @@ namespace __gnu_debug_def
this->_M_invalidate_if(_Not_equal(_M_base().end()));
}
};
template<typename _Tp, typename _Alloc>
inline bool
operator==(const list<_Tp, _Alloc>& __lhs, const list<_Tp, _Alloc>& __rhs)
@ -475,12 +475,12 @@ namespace __gnu_debug_def
inline bool
operator!=(const list<_Tp, _Alloc>& __lhs, const list<_Tp, _Alloc>& __rhs)
{ return __lhs._M_base() != __rhs._M_base(); }
template<typename _Tp, typename _Alloc>
inline bool
operator<(const list<_Tp, _Alloc>& __lhs, const list<_Tp, _Alloc>& __rhs)
{ return __lhs._M_base() < __rhs._M_base(); }
template<typename _Tp, typename _Alloc>
inline bool
operator<=(const list<_Tp, _Alloc>& __lhs, const list<_Tp, _Alloc>& __rhs)
@ -490,12 +490,12 @@ namespace __gnu_debug_def
inline bool
operator>=(const list<_Tp, _Alloc>& __lhs, const list<_Tp, _Alloc>& __rhs)
{ return __lhs._M_base() >= __rhs._M_base(); }
template<typename _Tp, typename _Alloc>
inline bool
operator>(const list<_Tp, _Alloc>& __lhs, const list<_Tp, _Alloc>& __rhs)
{ return __lhs._M_base() > __rhs._M_base(); }
template<typename _Tp, typename _Alloc>
inline void
swap(list<_Tp, _Alloc>& __lhs, list<_Tp, _Alloc>& __rhs)

View File

@ -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

View File

@ -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

View File

@ -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(); }

View File

@ -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

View File

@ -40,13 +40,13 @@ namespace __gnu_debug
{
/** Iterators that derive from _Safe_iterator_base but that aren't
* _Safe_iterators can be determined singular or non-singular via
* _Safe_iterator_base.
* _Safe_iterator_base.
*/
inline bool __check_singular_aux(const _Safe_iterator_base* __x)
{ return __x->_M_singular(); }
/** \brief Safe iterator wrapper.
*
*
* The class template %_Safe_iterator is a wrapper around an
* iterator that tracks the iterator's movement among sequences and
* checks that operations performed on the "safe" iterator are
@ -70,12 +70,12 @@ namespace __gnu_debug
__dp_sign, //< Can determine equality and ordering
__dp_exact //< Can determine distance precisely
};
/// The underlying iterator
_Iterator _M_current;
/// Determine if this is a constant iterator.
bool
bool
_M_constant() const
{
typedef typename _Sequence::const_iterator const_iterator;
@ -103,7 +103,7 @@ namespace __gnu_debug
*/
_Safe_iterator(const _Iterator& __i, const _Sequence* __seq)
: _Safe_iterator_base(__seq, _M_constant()), _M_current(__i)
{
{
_GLIBCXX_DEBUG_VERIFY(! this->_M_singular(),
_M_message(__msg_init_singular)
._M_iterator(*this, "this"));
@ -115,14 +115,14 @@ namespace __gnu_debug
*/
_Safe_iterator(const _Safe_iterator& __x)
: _Safe_iterator_base(__x, _M_constant()), _M_current(__x._M_current)
{
{
_GLIBCXX_DEBUG_VERIFY(!__x._M_singular(),
_M_message(__msg_init_copy_singular)
._M_iterator(*this, "this")
._M_iterator(__x, "other"));
}
/**
/**
* @brief Converting constructor from a mutable iterator to a
* constant iterator.
*
@ -131,7 +131,7 @@ namespace __gnu_debug
template<typename _MutableIterator>
_Safe_iterator(const _Safe_iterator<_MutableIterator, _Sequence>& __x)
: _Safe_iterator_base(__x, _M_constant()), _M_current(__x.base())
{
{
_GLIBCXX_DEBUG_VERIFY(!__x._M_singular(),
_M_message(__msg_init_const_singular)
._M_iterator(*this, "this")
@ -142,7 +142,7 @@ namespace __gnu_debug
* @brief Copy assignment.
* @pre @p x is not singular
*/
_Safe_iterator&
_Safe_iterator&
operator=(const _Safe_iterator& __x)
{
_GLIBCXX_DEBUG_VERIFY(!__x._M_singular(),
@ -158,8 +158,8 @@ namespace __gnu_debug
* @brief Iterator dereference.
* @pre iterator is dereferenceable
*/
reference
operator*() const
reference
operator*() const
{
_GLIBCXX_DEBUG_VERIFY(this->_M_dereferenceable(),
@ -174,7 +174,7 @@ namespace __gnu_debug
* @todo Make this correct w.r.t. iterators that return proxies
* @todo Use addressof() instead of & operator
*/
pointer
pointer
operator->() const
{
_GLIBCXX_DEBUG_VERIFY(this->_M_dereferenceable(),
@ -188,7 +188,7 @@ namespace __gnu_debug
* @brief Iterator preincrement
* @pre iterator is incrementable
*/
_Safe_iterator&
_Safe_iterator&
operator++()
{
_GLIBCXX_DEBUG_VERIFY(this->_M_incrementable(),
@ -202,7 +202,7 @@ namespace __gnu_debug
* @brief Iterator postincrement
* @pre iterator is incrementable
*/
_Safe_iterator
_Safe_iterator
operator++(int)
{
_GLIBCXX_DEBUG_VERIFY(this->_M_incrementable(),
@ -218,7 +218,7 @@ namespace __gnu_debug
* @brief Iterator predecrement
* @pre iterator is decrementable
*/
_Safe_iterator&
_Safe_iterator&
operator--()
{
_GLIBCXX_DEBUG_VERIFY(this->_M_decrementable(),
@ -232,7 +232,7 @@ namespace __gnu_debug
* @brief Iterator postdecrement
* @pre iterator is decrementable
*/
_Safe_iterator
_Safe_iterator
operator--(int)
{
_GLIBCXX_DEBUG_VERIFY(this->_M_decrementable(),
@ -244,10 +244,10 @@ namespace __gnu_debug
}
// ------ Random access iterator requirements ------
reference
reference
operator[](const difference_type& __n) const
{
_GLIBCXX_DEBUG_VERIFY(this->_M_can_advance(__n)
_GLIBCXX_DEBUG_VERIFY(this->_M_can_advance(__n)
&& this->_M_can_advance(__n+1),
_M_message(__msg_iter_subscript_oob)
._M_iterator(*this)._M_integer(__n));
@ -255,7 +255,7 @@ namespace __gnu_debug
return _M_current[__n];
}
_Safe_iterator&
_Safe_iterator&
operator+=(const difference_type& __n)
{
_GLIBCXX_DEBUG_VERIFY(this->_M_can_advance(__n),
@ -265,7 +265,7 @@ namespace __gnu_debug
return *this;
}
_Safe_iterator
_Safe_iterator
operator+(const difference_type& __n) const
{
_Safe_iterator __tmp(*this);
@ -273,7 +273,7 @@ namespace __gnu_debug
return __tmp;
}
_Safe_iterator&
_Safe_iterator&
operator-=(const difference_type& __n)
{
_GLIBCXX_DEBUG_VERIFY(this->_M_can_advance(-__n),
@ -283,7 +283,7 @@ namespace __gnu_debug
return *this;
}
_Safe_iterator
_Safe_iterator
operator-(const difference_type& __n) const
{
_Safe_iterator __tmp(*this);
@ -294,8 +294,8 @@ namespace __gnu_debug
// ------ Utilities ------
/**
* @brief Return the underlying iterator
*/
_Iterator
*/
_Iterator
base() const { return _M_current; }
/**
@ -305,46 +305,46 @@ namespace __gnu_debug
operator _Iterator() const { return _M_current; }
/** Attach iterator to the given sequence. */
void
void
_M_attach(const _Sequence* __seq)
{
{
_Safe_iterator_base::_M_attach(const_cast<_Sequence*>(__seq),
_M_constant());
_M_constant());
}
/** Invalidate the iterator, making it singular. */
void
void
_M_invalidate();
/// Is the iterator dereferenceable?
bool
bool
_M_dereferenceable() const
{ return !this->_M_singular() && !_M_is_end(); }
/// Is the iterator incrementable?
bool
bool
_M_incrementable() const { return this->_M_dereferenceable(); }
// Is the iterator decrementable?
bool
bool
_M_decrementable() const { return !_M_singular() && !_M_is_begin(); }
// Can we advance the iterator @p __n steps (@p __n may be negative)
bool
bool
_M_can_advance(const difference_type& __n) const;
// Is the iterator range [*this, __rhs) valid?
template<typename _Other>
bool
bool
_M_valid_range(const _Safe_iterator<_Other, _Sequence>& __rhs) const;
// The sequence this iterator references.
const _Sequence*
const _Sequence*
_M_get_sequence() const
{ return static_cast<const _Sequence*>(_M_sequence); }
/** Determine the distance between two iterators with some known
* precision.
* precision.
*/
template<typename _Iterator1, typename _Iterator2>
static pair<difference_type, _Distance_precision>
@ -366,9 +366,9 @@ namespace __gnu_debug
template<typename _Iterator1, typename _Iterator2>
static pair<difference_type, _Distance_precision>
_M_get_distance(const _Iterator1& __lhs, const _Iterator2& __rhs,
std::forward_iterator_tag)
std::forward_iterator_tag)
{
return std::make_pair(__lhs.base() == __rhs.base()? 0 : 1,
return std::make_pair(__lhs.base() == __rhs.base()? 0 : 1,
__dp_equality);
}
@ -384,8 +384,8 @@ namespace __gnu_debug
template<typename _IteratorL, typename _IteratorR, typename _Sequence>
inline bool
operator==(const _Safe_iterator<_IteratorL, _Sequence>& __lhs,
const _Safe_iterator<_IteratorR, _Sequence>& __rhs)
{
const _Safe_iterator<_IteratorR, _Sequence>& __rhs)
{
_GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(),
_M_message(__msg_iter_compare_bad)
._M_iterator(__lhs, "lhs")
@ -394,14 +394,14 @@ namespace __gnu_debug
_M_message(__msg_compare_different)
._M_iterator(__lhs, "lhs")
._M_iterator(__rhs, "rhs"));
return __lhs.base() == __rhs.base();
return __lhs.base() == __rhs.base();
}
template<typename _Iterator, typename _Sequence>
inline bool
operator==(const _Safe_iterator<_Iterator, _Sequence>& __lhs,
const _Safe_iterator<_Iterator, _Sequence>& __rhs)
{
{
_GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(),
_M_message(__msg_iter_compare_bad)
._M_iterator(__lhs, "lhs")
@ -410,14 +410,14 @@ namespace __gnu_debug
_M_message(__msg_compare_different)
._M_iterator(__lhs, "lhs")
._M_iterator(__rhs, "rhs"));
return __lhs.base() == __rhs.base();
return __lhs.base() == __rhs.base();
}
template<typename _IteratorL, typename _IteratorR, typename _Sequence>
inline bool
operator!=(const _Safe_iterator<_IteratorL, _Sequence>& __lhs,
const _Safe_iterator<_IteratorR, _Sequence>& __rhs)
{
const _Safe_iterator<_IteratorR, _Sequence>& __rhs)
{
_GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(),
_M_message(__msg_iter_compare_bad)
._M_iterator(__lhs, "lhs")
@ -426,14 +426,14 @@ namespace __gnu_debug
_M_message(__msg_compare_different)
._M_iterator(__lhs, "lhs")
._M_iterator(__rhs, "rhs"));
return __lhs.base() != __rhs.base();
return __lhs.base() != __rhs.base();
}
template<typename _Iterator, typename _Sequence>
inline bool
operator!=(const _Safe_iterator<_Iterator, _Sequence>& __lhs,
const _Safe_iterator<_Iterator, _Sequence>& __rhs)
{
{
_GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(),
_M_message(__msg_iter_compare_bad)
._M_iterator(__lhs, "lhs")
@ -442,14 +442,14 @@ namespace __gnu_debug
_M_message(__msg_compare_different)
._M_iterator(__lhs, "lhs")
._M_iterator(__rhs, "rhs"));
return __lhs.base() != __rhs.base();
return __lhs.base() != __rhs.base();
}
template<typename _IteratorL, typename _IteratorR, typename _Sequence>
inline bool
operator<(const _Safe_iterator<_IteratorL, _Sequence>& __lhs,
const _Safe_iterator<_IteratorR, _Sequence>& __rhs)
{
{
_GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(),
_M_message(__msg_iter_order_bad)
._M_iterator(__lhs, "lhs")
@ -458,14 +458,14 @@ namespace __gnu_debug
_M_message(__msg_order_different)
._M_iterator(__lhs, "lhs")
._M_iterator(__rhs, "rhs"));
return __lhs.base() < __rhs.base();
return __lhs.base() < __rhs.base();
}
template<typename _Iterator, typename _Sequence>
inline bool
operator<(const _Safe_iterator<_Iterator, _Sequence>& __lhs,
const _Safe_iterator<_Iterator, _Sequence>& __rhs)
{
{
_GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(),
_M_message(__msg_iter_order_bad)
._M_iterator(__lhs, "lhs")
@ -474,14 +474,14 @@ namespace __gnu_debug
_M_message(__msg_order_different)
._M_iterator(__lhs, "lhs")
._M_iterator(__rhs, "rhs"));
return __lhs.base() < __rhs.base();
return __lhs.base() < __rhs.base();
}
template<typename _IteratorL, typename _IteratorR, typename _Sequence>
inline bool
operator<=(const _Safe_iterator<_IteratorL, _Sequence>& __lhs,
const _Safe_iterator<_IteratorR, _Sequence>& __rhs)
{
const _Safe_iterator<_IteratorR, _Sequence>& __rhs)
{
_GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(),
_M_message(__msg_iter_order_bad)
._M_iterator(__lhs, "lhs")
@ -490,14 +490,14 @@ namespace __gnu_debug
_M_message(__msg_order_different)
._M_iterator(__lhs, "lhs")
._M_iterator(__rhs, "rhs"));
return __lhs.base() <= __rhs.base();
return __lhs.base() <= __rhs.base();
}
template<typename _Iterator, typename _Sequence>
inline bool
operator<=(const _Safe_iterator<_Iterator, _Sequence>& __lhs,
const _Safe_iterator<_Iterator, _Sequence>& __rhs)
{
{
_GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(),
_M_message(__msg_iter_order_bad)
._M_iterator(__lhs, "lhs")
@ -506,14 +506,14 @@ namespace __gnu_debug
_M_message(__msg_order_different)
._M_iterator(__lhs, "lhs")
._M_iterator(__rhs, "rhs"));
return __lhs.base() <= __rhs.base();
return __lhs.base() <= __rhs.base();
}
template<typename _IteratorL, typename _IteratorR, typename _Sequence>
inline bool
operator>(const _Safe_iterator<_IteratorL, _Sequence>& __lhs,
const _Safe_iterator<_IteratorR, _Sequence>& __rhs)
{
{
_GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(),
_M_message(__msg_iter_order_bad)
._M_iterator(__lhs, "lhs")
@ -522,14 +522,14 @@ namespace __gnu_debug
_M_message(__msg_order_different)
._M_iterator(__lhs, "lhs")
._M_iterator(__rhs, "rhs"));
return __lhs.base() > __rhs.base();
return __lhs.base() > __rhs.base();
}
template<typename _Iterator, typename _Sequence>
inline bool
operator>(const _Safe_iterator<_Iterator, _Sequence>& __lhs,
const _Safe_iterator<_Iterator, _Sequence>& __rhs)
{
{
_GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(),
_M_message(__msg_iter_order_bad)
._M_iterator(__lhs, "lhs")
@ -538,14 +538,14 @@ namespace __gnu_debug
_M_message(__msg_order_different)
._M_iterator(__lhs, "lhs")
._M_iterator(__rhs, "rhs"));
return __lhs.base() > __rhs.base();
return __lhs.base() > __rhs.base();
}
template<typename _IteratorL, typename _IteratorR, typename _Sequence>
inline bool
operator>=(const _Safe_iterator<_IteratorL, _Sequence>& __lhs,
const _Safe_iterator<_IteratorR, _Sequence>& __rhs)
{
const _Safe_iterator<_IteratorR, _Sequence>& __rhs)
{
_GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(),
_M_message(__msg_iter_order_bad)
._M_iterator(__lhs, "lhs")
@ -554,14 +554,14 @@ namespace __gnu_debug
_M_message(__msg_order_different)
._M_iterator(__lhs, "lhs")
._M_iterator(__rhs, "rhs"));
return __lhs.base() >= __rhs.base();
return __lhs.base() >= __rhs.base();
}
template<typename _Iterator, typename _Sequence>
inline bool
operator>=(const _Safe_iterator<_Iterator, _Sequence>& __lhs,
const _Safe_iterator<_Iterator, _Sequence>& __rhs)
{
{
_GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(),
_M_message(__msg_iter_order_bad)
._M_iterator(__lhs, "lhs")
@ -570,7 +570,7 @@ namespace __gnu_debug
_M_message(__msg_order_different)
._M_iterator(__lhs, "lhs")
._M_iterator(__rhs, "rhs"));
return __lhs.base() >= __rhs.base();
return __lhs.base() >= __rhs.base();
}
// _GLIBCXX_RESOLVE_LIB_DEFECTS
@ -581,7 +581,7 @@ namespace __gnu_debug
inline typename _Safe_iterator<_IteratorL, _Sequence>::difference_type
operator-(const _Safe_iterator<_IteratorL, _Sequence>& __lhs,
const _Safe_iterator<_IteratorR, _Sequence>& __rhs)
{
{
_GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(),
_M_message(__msg_distance_bad)
._M_iterator(__lhs, "lhs")
@ -590,7 +590,7 @@ namespace __gnu_debug
_M_message(__msg_distance_different)
._M_iterator(__lhs, "lhs")
._M_iterator(__rhs, "rhs"));
return __lhs.base() - __rhs.base();
return __lhs.base() - __rhs.base();
}
template<typename _Iterator, typename _Sequence>
@ -602,6 +602,6 @@ namespace __gnu_debug
#ifndef _GLIBCXX_EXPORT_TEMPLATE
# include <debug/safe_iterator.tcc>
#endif
#endif
#endif

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -38,7 +38,7 @@
namespace __gnu_debug
{
template<typename _CharT, typename _Traits, typename _Allocator>
class basic_string
class basic_string
: public std::basic_string<_CharT, _Traits, _Allocator>,
public __gnu_debug::_Safe_sequence<basic_string<_CharT, _Traits,
_Allocator> >
@ -48,9 +48,9 @@ namespace __gnu_debug
public:
// types:
typedef _Traits traits_type;
typedef typename _Traits::char_type value_type;
typedef _Allocator allocator_type;
typedef _Traits traits_type;
typedef typename _Traits::char_type value_type;
typedef _Allocator allocator_type;
typedef typename _Allocator::size_type size_type;
typedef typename _Allocator::difference_type difference_type;
typedef typename _Allocator::reference reference;
@ -60,7 +60,7 @@ namespace __gnu_debug
typedef __gnu_debug::_Safe_iterator<typename _Base::iterator, basic_string>
iterator;
typedef __gnu_debug::_Safe_iterator<typename _Base::const_iterator,
typedef __gnu_debug::_Safe_iterator<typename _Base::const_iterator,
basic_string> const_iterator;
typedef std::reverse_iterator<iterator> reverse_iterator;
@ -77,13 +77,13 @@ namespace __gnu_debug
basic_string(const _Base& __base) : _Base(__base), _Safe_base() { }
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 42. string ctors specify wrong default allocator
// 42. string ctors specify wrong default allocator
basic_string(const basic_string& __str)
: _Base(__str, 0, _Base::npos, __str.get_allocator()), _Safe_base()
{ }
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 42. string ctors specify wrong default allocator
// 42. string ctors specify wrong default allocator
basic_string(const basic_string& __str, size_type __pos,
size_type __n = _Base::npos,
const _Allocator& __a = _Allocator())
@ -112,7 +112,7 @@ namespace __gnu_debug
~basic_string() { }
basic_string&
basic_string&
operator=(const basic_string& __str)
{
*static_cast<_Base*>(this) = __str;
@ -120,7 +120,7 @@ namespace __gnu_debug
return *this;
}
basic_string&
basic_string&
operator=(const _CharT* __s)
{
__glibcxx_check_string(__s);
@ -129,7 +129,7 @@ namespace __gnu_debug
return *this;
}
basic_string&
basic_string&
operator=(_CharT __c)
{
*static_cast<_Base*>(this) = __c;
@ -138,27 +138,27 @@ namespace __gnu_debug
}
// 21.3.2 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
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()); }
@ -166,8 +166,8 @@ namespace __gnu_debug
rend()
{ return reverse_iterator(begin()); }
const_reverse_iterator
rend() const
const_reverse_iterator
rend() const
{ return const_reverse_iterator(begin()); }
// 21.3.3 capacity:
@ -175,21 +175,21 @@ namespace __gnu_debug
using _Base::length;
using _Base::max_size;
void
void
resize(size_type __n, _CharT __c)
{
_Base::resize(__n, __c);
this->_M_invalidate_all();
}
void
void
resize(size_type __n)
{ this->resize(__n, _CharT()); }
using _Base::capacity;
using _Base::reserve;
void
void
clear()
{
_Base::clear();
@ -199,7 +199,7 @@ namespace __gnu_debug
using _Base::empty;
// 21.3.4 element access:
const_reference
const_reference
operator[](size_type __pos) const
{
_GLIBCXX_DEBUG_VERIFY(__pos <= this->size(),
@ -210,7 +210,7 @@ namespace __gnu_debug
return _M_base()[__pos];
}
reference
reference
operator[](size_type __pos)
{
__glibcxx_check_subscript(__pos);
@ -220,7 +220,7 @@ namespace __gnu_debug
using _Base::at;
// 21.3.5 modifiers:
basic_string&
basic_string&
operator+=(const basic_string& __str)
{
_M_base() += __str;
@ -228,7 +228,7 @@ namespace __gnu_debug
return *this;
}
basic_string&
basic_string&
operator+=(const _CharT* __s)
{
__glibcxx_check_string(__s);
@ -237,7 +237,7 @@ namespace __gnu_debug
return *this;
}
basic_string&
basic_string&
operator+=(_CharT __c)
{
_M_base() += __c;
@ -245,7 +245,7 @@ namespace __gnu_debug
return *this;
}
basic_string&
basic_string&
append(const basic_string& __str)
{
_Base::append(__str);
@ -253,7 +253,7 @@ namespace __gnu_debug
return *this;
}
basic_string&
basic_string&
append(const basic_string& __str, size_type __pos, size_type __n)
{
_Base::append(__str, __pos, __n);
@ -261,7 +261,7 @@ namespace __gnu_debug
return *this;
}
basic_string&
basic_string&
append(const _CharT* __s, size_type __n)
{
__glibcxx_check_string_len(__s, __n);
@ -270,7 +270,7 @@ namespace __gnu_debug
return *this;
}
basic_string&
basic_string&
append(const _CharT* __s)
{
__glibcxx_check_string(__s);
@ -279,7 +279,7 @@ namespace __gnu_debug
return *this;
}
basic_string&
basic_string&
append(size_type __n, _CharT __c)
{
_Base::append(__n, __c);
@ -288,7 +288,7 @@ namespace __gnu_debug
}
template<typename _InputIterator>
basic_string&
basic_string&
append(_InputIterator __first, _InputIterator __last)
{
__glibcxx_check_valid_range(__first, __last);
@ -298,15 +298,15 @@ namespace __gnu_debug
}
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 7. string clause minor problems
void
// 7. string clause minor problems
void
push_back(_CharT __c)
{
_Base::push_back(__c);
this->_M_invalidate_all();
}
basic_string&
basic_string&
assign(const basic_string& __x)
{
_Base::assign(__x);
@ -314,7 +314,7 @@ namespace __gnu_debug
return *this;
}
basic_string&
basic_string&
assign(const basic_string& __str, size_type __pos, size_type __n)
{
_Base::assign(__str, __pos, __n);
@ -322,7 +322,7 @@ namespace __gnu_debug
return *this;
}
basic_string&
basic_string&
assign(const _CharT* __s, size_type __n)
{
__glibcxx_check_string_len(__s, __n);
@ -331,7 +331,7 @@ namespace __gnu_debug
return *this;
}
basic_string&
basic_string&
assign(const _CharT* __s)
{
__glibcxx_check_string(__s);
@ -340,25 +340,25 @@ namespace __gnu_debug
return *this;
}
basic_string&
basic_string&
assign(size_type __n, _CharT __c)
{
_Base::assign(__n, __c);
this->_M_invalidate_all();
return *this;
return *this;
}
template<typename _InputIterator>
basic_string&
basic_string&
assign(_InputIterator __first, _InputIterator __last)
{
__glibcxx_check_valid_range(__first, __last);
_Base::assign(__first, __last);
this->_M_invalidate_all();
return *this;
return *this;
}
basic_string&
basic_string&
insert(size_type __pos1, const basic_string& __str)
{
_Base::insert(__pos1, __str);
@ -366,7 +366,7 @@ namespace __gnu_debug
return *this;
}
basic_string&
basic_string&
insert(size_type __pos1, const basic_string& __str,
size_type __pos2, size_type __n)
{
@ -375,7 +375,7 @@ namespace __gnu_debug
return *this;
}
basic_string&
basic_string&
insert(size_type __pos, const _CharT* __s, size_type __n)
{
__glibcxx_check_string(__s);
@ -384,16 +384,16 @@ namespace __gnu_debug
return *this;
}
basic_string&
basic_string&
insert(size_type __pos, const _CharT* __s)
{
__glibcxx_check_string(__s);
_Base::insert(__pos, __s);
this->_M_invalidate_all();
return *this;
return *this;
}
basic_string&
basic_string&
insert(size_type __pos, size_type __n, _CharT __c)
{
_Base::insert(__pos, __n, __c);
@ -401,7 +401,7 @@ namespace __gnu_debug
return *this;
}
iterator
iterator
insert(iterator __p, _CharT __c)
{
__glibcxx_check_insert(__p);
@ -410,7 +410,7 @@ namespace __gnu_debug
return iterator(__res, this);
}
void
void
insert(iterator __p, size_type __n, _CharT __c)
{
__glibcxx_check_insert(__p);
@ -419,7 +419,7 @@ namespace __gnu_debug
}
template<typename _InputIterator>
void
void
insert(iterator __p, _InputIterator __first, _InputIterator __last)
{
__glibcxx_check_insert_range(__p, __first, __last);
@ -427,7 +427,7 @@ namespace __gnu_debug
this->_M_invalidate_all();
}
basic_string&
basic_string&
erase(size_type __pos = 0, size_type __n = _Base::npos)
{
_Base::erase(__pos, __n);
@ -435,7 +435,7 @@ namespace __gnu_debug
return *this;
}
iterator
iterator
erase(iterator __position)
{
__glibcxx_check_erase(__position);
@ -444,7 +444,7 @@ namespace __gnu_debug
return iterator(__res, this);
}
iterator
iterator
erase(iterator __first, iterator __last)
{
// _GLIBCXX_RESOLVE_LIB_DEFECTS
@ -456,7 +456,7 @@ namespace __gnu_debug
return iterator(__res, this);
}
basic_string&
basic_string&
replace(size_type __pos1, size_type __n1, const basic_string& __str)
{
_Base::replace(__pos1, __n1, __str);
@ -464,7 +464,7 @@ namespace __gnu_debug
return *this;
}
basic_string&
basic_string&
replace(size_type __pos1, size_type __n1, const basic_string& __str,
size_type __pos2, size_type __n2)
{
@ -473,8 +473,8 @@ namespace __gnu_debug
return *this;
}
basic_string&
replace(size_type __pos, size_type __n1, const _CharT* __s,
basic_string&
replace(size_type __pos, size_type __n1, const _CharT* __s,
size_type __n2)
{
__glibcxx_check_string_len(__s, __n2);
@ -483,7 +483,7 @@ namespace __gnu_debug
return *this;
}
basic_string&
basic_string&
replace(size_type __pos, size_type __n1, const _CharT* __s)
{
__glibcxx_check_string(__s);
@ -492,7 +492,7 @@ namespace __gnu_debug
return *this;
}
basic_string&
basic_string&
replace(size_type __pos, size_type __n1, size_type __n2, _CharT __c)
{
_Base::replace(__pos, __n1, __n2, __c);
@ -500,7 +500,7 @@ namespace __gnu_debug
return *this;
}
basic_string&
basic_string&
replace(iterator __i1, iterator __i2, const basic_string& __str)
{
__glibcxx_check_erase_range(__i1, __i2);
@ -508,8 +508,8 @@ namespace __gnu_debug
this->_M_invalidate_all();
return *this;
}
basic_string&
basic_string&
replace(iterator __i1, iterator __i2, const _CharT* __s, size_type __n)
{
__glibcxx_check_erase_range(__i1, __i2);
@ -519,7 +519,7 @@ namespace __gnu_debug
return *this;
}
basic_string&
basic_string&
replace(iterator __i1, iterator __i2, const _CharT* __s)
{
__glibcxx_check_erase_range(__i1, __i2);
@ -529,7 +529,7 @@ namespace __gnu_debug
return *this;
}
basic_string&
basic_string&
replace(iterator __i1, iterator __i2, size_type __n, _CharT __c)
{
__glibcxx_check_erase_range(__i1, __i2);
@ -539,7 +539,7 @@ namespace __gnu_debug
}
template<typename _InputIterator>
basic_string&
basic_string&
replace(iterator __i1, iterator __i2,
_InputIterator __j1, _InputIterator __j2)
{
@ -550,14 +550,14 @@ namespace __gnu_debug
return *this;
}
size_type
size_type
copy(_CharT* __s, size_type __n, size_type __pos = 0) const
{
__glibcxx_check_string_len(__s, __n);
return _Base::copy(__s, __n, __pos);
}
void
void
swap(basic_string<_CharT,_Traits,_Allocator>& __x)
{
_Base::swap(__x);
@ -567,7 +567,7 @@ namespace __gnu_debug
}
// 21.3.6 string operations:
const _CharT*
const _CharT*
c_str() const
{
const _CharT* __res = _Base::c_str();
@ -575,7 +575,7 @@ namespace __gnu_debug
return __res;
}
const _CharT*
const _CharT*
data() const
{
const _CharT* __res = _Base::data();
@ -585,158 +585,158 @@ namespace __gnu_debug
using _Base::get_allocator;
size_type
size_type
find(const basic_string& __str, size_type __pos = 0) const
{ return _Base::find(__str, __pos); }
size_type
size_type
find(const _CharT* __s, size_type __pos, size_type __n) const
{
__glibcxx_check_string(__s);
return _Base::find(__s, __pos, __n);
}
size_type
size_type
find(const _CharT* __s, size_type __pos = 0) const
{
__glibcxx_check_string(__s);
return _Base::find(__s, __pos);
}
size_type
size_type
find(_CharT __c, size_type __pos = 0) const
{ return _Base::find(__c, __pos); }
size_type
size_type
rfind(const basic_string& __str, size_type __pos = _Base::npos) const
{ return _Base::rfind(__str, __pos); }
size_type
size_type
rfind(const _CharT* __s, size_type __pos, size_type __n) const
{
{
__glibcxx_check_string_len(__s, __n);
return _Base::rfind(__s, __pos, __n);
}
size_type
size_type
rfind(const _CharT* __s, size_type __pos = _Base::npos) const
{
__glibcxx_check_string(__s);
return _Base::rfind(__s, __pos);
}
size_type
size_type
rfind(_CharT __c, size_type __pos = _Base::npos) const
{ return _Base::rfind(__c, __pos); }
size_type
size_type
find_first_of(const basic_string& __str, size_type __pos = 0) const
{ return _Base::find_first_of(__str, __pos); }
size_type
size_type
find_first_of(const _CharT* __s, size_type __pos, size_type __n) const
{
{
__glibcxx_check_string(__s);
return _Base::find_first_of(__s, __pos, __n);
return _Base::find_first_of(__s, __pos, __n);
}
size_type
size_type
find_first_of(const _CharT* __s, size_type __pos = 0) const
{
{
__glibcxx_check_string(__s);
return _Base::find_first_of(__s, __pos);
return _Base::find_first_of(__s, __pos);
}
size_type
size_type
find_first_of(_CharT __c, size_type __pos = 0) const
{ return _Base::find_first_of(__c, __pos); }
size_type
size_type
find_last_of(const basic_string& __str, size_type __pos = _Base::npos) const
{ return _Base::find_last_of(__str, __pos); }
size_type
size_type
find_last_of(const _CharT* __s, size_type __pos, size_type __n) const
{
{
__glibcxx_check_string(__s);
return _Base::find_last_of(__s, __pos, __n);
}
size_type
size_type
find_last_of(const _CharT* __s, size_type __pos = _Base::npos) const
{
{
__glibcxx_check_string(__s);
return _Base::find_last_of(__s, __pos);
}
size_type
size_type
find_last_of(_CharT __c, size_type __pos = _Base::npos) const
{ return _Base::find_last_of(__c, __pos); }
size_type
size_type
find_first_not_of(const basic_string& __str, size_type __pos = 0) const
{ return _Base::find_first_not_of(__str, __pos); }
size_type
size_type
find_first_not_of(const _CharT* __s, size_type __pos, size_type __n) const
{
__glibcxx_check_string_len(__s, __n);
return _Base::find_first_not_of(__s, __pos, __n);
}
size_type
size_type
find_first_not_of(const _CharT* __s, size_type __pos = 0) const
{
__glibcxx_check_string(__s);
return _Base::find_first_not_of(__s, __pos);
}
size_type
size_type
find_first_not_of(_CharT __c, size_type __pos = 0) const
{ return _Base::find_first_not_of(__c, __pos); }
size_type
size_type
find_last_not_of(const basic_string& __str,
size_type __pos = _Base::npos) const
{ return _Base::find_last_not_of(__str, __pos); }
size_type
size_type
find_last_not_of(const _CharT* __s, size_type __pos, size_type __n) const
{
__glibcxx_check_string(__s);
return _Base::find_last_not_of(__s, __pos, __n);
}
size_type
size_type
find_last_not_of(const _CharT* __s, size_type __pos = _Base::npos) const
{
__glibcxx_check_string(__s);
return _Base::find_last_not_of(__s, __pos);
}
size_type
size_type
find_last_not_of(_CharT __c, size_type __pos = _Base::npos) const
{ return _Base::find_last_not_of(__c, __pos); }
basic_string
basic_string
substr(size_type __pos = 0, size_type __n = _Base::npos) const
{ return basic_string(_Base::substr(__pos, __n)); }
int
int
compare(const basic_string& __str) const
{ return _Base::compare(__str); }
int
int
compare(size_type __pos1, size_type __n1,
const basic_string& __str) const
{ return _Base::compare(__pos1, __n1, __str); }
int
int
compare(size_type __pos1, size_type __n1, const basic_string& __str,
size_type __pos2, size_type __n2) const
{ return _Base::compare(__pos1, __n1, __str, __pos2, __n2); }
int
int
compare(const _CharT* __s) const
{
__glibcxx_check_string(__s);
@ -745,7 +745,7 @@ namespace __gnu_debug
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 5. string::compare specification questionable
int
int
compare(size_type __pos1, size_type __n1, const _CharT* __s) const
{
__glibcxx_check_string(__s);
@ -754,7 +754,7 @@ namespace __gnu_debug
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 5. string::compare specification questionable
int
int
compare(size_type __pos1, size_type __n1,const _CharT* __s,
size_type __n2) const
{
@ -762,10 +762,10 @@ namespace __gnu_debug
return _Base::compare(__pos1, __n1, __s, __n2);
}
_Base&
_Base&
_M_base() { return *this; }
const _Base&
const _Base&
_M_base() const { return *this; }
using _Safe_base::_M_invalidate_all;
@ -781,14 +781,14 @@ namespace __gnu_debug
inline basic_string<_CharT,_Traits,_Allocator>
operator+(const _CharT* __lhs,
const basic_string<_CharT,_Traits,_Allocator>& __rhs)
{
{
__glibcxx_check_string(__lhs);
return basic_string<_CharT,_Traits,_Allocator>(__lhs) += __rhs;
}
template<typename _CharT, typename _Traits, typename _Allocator>
inline basic_string<_CharT,_Traits,_Allocator>
operator+(_CharT __lhs,
operator+(_CharT __lhs,
const basic_string<_CharT,_Traits,_Allocator>& __rhs)
{ return basic_string<_CharT,_Traits,_Allocator>(1, __lhs) += __rhs; }
@ -796,9 +796,9 @@ namespace __gnu_debug
inline basic_string<_CharT,_Traits,_Allocator>
operator+(const basic_string<_CharT,_Traits,_Allocator>& __lhs,
const _CharT* __rhs)
{
{
__glibcxx_check_string(__rhs);
return basic_string<_CharT,_Traits,_Allocator>(__lhs) += __rhs;
return basic_string<_CharT,_Traits,_Allocator>(__lhs) += __rhs;
}
template<typename _CharT, typename _Traits, typename _Allocator>
@ -808,11 +808,11 @@ namespace __gnu_debug
{ return basic_string<_CharT,_Traits,_Allocator>(__lhs) += __rhs; }
template<typename _CharT, typename _Traits, typename _Allocator>
inline bool
inline bool
operator==(const basic_string<_CharT,_Traits,_Allocator>& __lhs,
const basic_string<_CharT,_Traits,_Allocator>& __rhs)
{ return __lhs._M_base() == __rhs._M_base(); }
template<typename _CharT, typename _Traits, typename _Allocator>
inline bool
operator==(const _CharT* __lhs,
@ -832,11 +832,11 @@ namespace __gnu_debug
}
template<typename _CharT, typename _Traits, typename _Allocator>
inline bool
inline bool
operator!=(const basic_string<_CharT,_Traits,_Allocator>& __lhs,
const basic_string<_CharT,_Traits,_Allocator>& __rhs)
{ return __lhs._M_base() != __rhs._M_base(); }
template<typename _CharT, typename _Traits, typename _Allocator>
inline bool
operator!=(const _CharT* __lhs,
@ -856,11 +856,11 @@ namespace __gnu_debug
}
template<typename _CharT, typename _Traits, typename _Allocator>
inline bool
inline bool
operator<(const basic_string<_CharT,_Traits,_Allocator>& __lhs,
const basic_string<_CharT,_Traits,_Allocator>& __rhs)
{ return __lhs._M_base() < __rhs._M_base(); }
template<typename _CharT, typename _Traits, typename _Allocator>
inline bool
operator<(const _CharT* __lhs,
@ -880,11 +880,11 @@ namespace __gnu_debug
}
template<typename _CharT, typename _Traits, typename _Allocator>
inline bool
inline bool
operator<=(const basic_string<_CharT,_Traits,_Allocator>& __lhs,
const basic_string<_CharT,_Traits,_Allocator>& __rhs)
{ return __lhs._M_base() <= __rhs._M_base(); }
template<typename _CharT, typename _Traits, typename _Allocator>
inline bool
operator<=(const _CharT* __lhs,
@ -902,13 +902,13 @@ namespace __gnu_debug
__glibcxx_check_string(__rhs);
return __lhs._M_base() <= __rhs;
}
template<typename _CharT, typename _Traits, typename _Allocator>
inline bool
inline bool
operator>=(const basic_string<_CharT,_Traits,_Allocator>& __lhs,
const basic_string<_CharT,_Traits,_Allocator>& __rhs)
{ return __lhs._M_base() >= __rhs._M_base(); }
template<typename _CharT, typename _Traits, typename _Allocator>
inline bool
operator>=(const _CharT* __lhs,
@ -917,7 +917,7 @@ namespace __gnu_debug
__glibcxx_check_string(__lhs);
return __lhs >= __rhs._M_base();
}
template<typename _CharT, typename _Traits, typename _Allocator>
inline bool
operator>=(const basic_string<_CharT,_Traits,_Allocator>& __lhs,
@ -926,13 +926,13 @@ namespace __gnu_debug
__glibcxx_check_string(__rhs);
return __lhs._M_base() >= __rhs;
}
template<typename _CharT, typename _Traits, typename _Allocator>
inline bool
inline bool
operator>(const basic_string<_CharT,_Traits,_Allocator>& __lhs,
const basic_string<_CharT,_Traits,_Allocator>& __rhs)
{ return __lhs._M_base() > __rhs._M_base(); }
template<typename _CharT, typename _Traits, typename _Allocator>
inline bool
operator>(const _CharT* __lhs,
@ -953,7 +953,7 @@ namespace __gnu_debug
// 21.3.7.8:
template<typename _CharT, typename _Traits, typename _Allocator>
inline void
inline void
swap(basic_string<_CharT,_Traits,_Allocator>& __lhs,
basic_string<_CharT,_Traits,_Allocator>& __rhs)
{ __lhs.swap(__rhs); }
@ -979,23 +979,23 @@ namespace __gnu_debug
getline(std::basic_istream<_CharT,_Traits>& __is,
basic_string<_CharT,_Traits,_Allocator>& __str, _CharT __delim)
{
std::basic_istream<_CharT,_Traits>& __res = getline(__is,
std::basic_istream<_CharT,_Traits>& __res = getline(__is,
__str._M_base(),
__delim);
__str._M_invalidate_all();
return __res;
}
template<typename _CharT, typename _Traits, typename _Allocator>
std::basic_istream<_CharT,_Traits>&
getline(std::basic_istream<_CharT,_Traits>& __is,
basic_string<_CharT,_Traits,_Allocator>& __str)
{
std::basic_istream<_CharT,_Traits>& __res = getline(__is,
std::basic_istream<_CharT,_Traits>& __res = getline(__is,
__str._M_base());
__str._M_invalidate_all();
return __res;
}
} // namespace __gnu_debug
#endif
#endif

View File

@ -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