2003-11-11 20:09:16 +00:00
|
|
|
// Safe iterator implementation -*- C++ -*-
|
|
|
|
|
2009-04-09 17:00:19 +02:00
|
|
|
// Copyright (C) 2003, 2004, 2005, 2006, 2009
|
2003-11-11 20:09:16 +00:00
|
|
|
// Free Software Foundation, Inc.
|
|
|
|
//
|
|
|
|
// This file is part of the GNU ISO C++ Library. This library is free
|
|
|
|
// software; you can redistribute it and/or modify it under the
|
|
|
|
// terms of the GNU General Public License as published by the
|
2009-04-09 17:00:19 +02:00
|
|
|
// Free Software Foundation; either version 3, or (at your option)
|
2003-11-11 20:09:16 +00:00
|
|
|
// any later version.
|
|
|
|
|
|
|
|
// This library is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
|
2009-04-09 17:00:19 +02:00
|
|
|
// Under Section 7 of GPL version 3, you are granted additional
|
|
|
|
// permissions described in the GCC Runtime Library Exception, version
|
|
|
|
// 3.1, as published by the Free Software Foundation.
|
2003-11-11 20:09:16 +00:00
|
|
|
|
2009-04-09 17:00:19 +02:00
|
|
|
// You should have received a copy of the GNU General Public License and
|
|
|
|
// a copy of the GCC Runtime Library Exception along with this program;
|
|
|
|
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
|
|
|
// <http://www.gnu.org/licenses/>.
|
2003-11-11 20:09:16 +00:00
|
|
|
|
2006-11-29 20:59:22 +00:00
|
|
|
/** @file debug/safe_iterator.h
|
|
|
|
* This file is a GNU debug extension to the Standard C++ Library.
|
|
|
|
*/
|
|
|
|
|
2003-11-11 20:09:16 +00:00
|
|
|
#ifndef _GLIBCXX_DEBUG_SAFE_ITERATOR_H
|
|
|
|
#define _GLIBCXX_DEBUG_SAFE_ITERATOR_H 1
|
|
|
|
|
|
|
|
#include <debug/debug.h>
|
2005-05-27 15:01:45 +00:00
|
|
|
#include <debug/macros.h>
|
|
|
|
#include <debug/functions.h>
|
2003-11-11 20:09:16 +00:00
|
|
|
#include <debug/formatter.h>
|
|
|
|
#include <debug/safe_base.h>
|
2005-05-27 15:01:45 +00:00
|
|
|
#include <bits/stl_pair.h>
|
2006-09-18 13:30:56 +00:00
|
|
|
#include <ext/type_traits.h>
|
2003-11-11 20:09:16 +00:00
|
|
|
|
|
|
|
namespace __gnu_debug
|
|
|
|
{
|
|
|
|
/** Iterators that derive from _Safe_iterator_base but that aren't
|
|
|
|
* _Safe_iterators can be determined singular or non-singular via
|
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
2003-12-09 05:26:28 +01:00
|
|
|
* _Safe_iterator_base.
|
2003-11-11 20:09:16 +00:00
|
|
|
*/
|
2005-05-27 15:01:45 +00:00
|
|
|
inline bool
|
|
|
|
__check_singular_aux(const _Safe_iterator_base* __x)
|
2003-11-11 20:09:16 +00:00
|
|
|
{ return __x->_M_singular(); }
|
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
2003-12-09 05:26:28 +01:00
|
|
|
|
2003-11-11 20:09:16 +00:00
|
|
|
/** \brief Safe iterator wrapper.
|
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
2003-12-09 05:26:28 +01:00
|
|
|
*
|
2003-11-11 20:09:16 +00:00
|
|
|
* 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
|
|
|
|
* legal. In additional to the basic iterator operations (which are
|
|
|
|
* validated, and then passed to the underlying iterator),
|
|
|
|
* %_Safe_iterator has member functions for iterator invalidation,
|
|
|
|
* attaching/detaching the iterator from sequences, and querying
|
|
|
|
* the iterator's state.
|
|
|
|
*/
|
|
|
|
template<typename _Iterator, typename _Sequence>
|
|
|
|
class _Safe_iterator : public _Safe_iterator_base
|
|
|
|
{
|
|
|
|
typedef _Safe_iterator _Self;
|
|
|
|
|
|
|
|
/** The precision to which we can calculate the distance between
|
|
|
|
* two iterators.
|
|
|
|
*/
|
|
|
|
enum _Distance_precision
|
|
|
|
{
|
|
|
|
__dp_equality, //< Can compare iterator equality, only
|
|
|
|
__dp_sign, //< Can determine equality and ordering
|
|
|
|
__dp_exact //< Can determine distance precisely
|
|
|
|
};
|
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
2003-12-09 05:26:28 +01:00
|
|
|
|
2003-11-11 20:09:16 +00:00
|
|
|
/// The underlying iterator
|
|
|
|
_Iterator _M_current;
|
|
|
|
|
|
|
|
/// Determine if this is a constant iterator.
|
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
2003-12-09 05:26:28 +01:00
|
|
|
bool
|
2003-11-11 20:09:16 +00:00
|
|
|
_M_constant() const
|
|
|
|
{
|
|
|
|
typedef typename _Sequence::const_iterator const_iterator;
|
|
|
|
return __is_same<const_iterator, _Safe_iterator>::value;
|
|
|
|
}
|
|
|
|
|
2006-02-22 00:57:24 +00:00
|
|
|
typedef std::iterator_traits<_Iterator> _Traits;
|
2003-11-11 20:09:16 +00:00
|
|
|
|
|
|
|
public:
|
2004-05-18 03:27:57 +00:00
|
|
|
typedef _Iterator _Base_iterator;
|
2003-11-11 20:09:16 +00:00
|
|
|
typedef typename _Traits::iterator_category iterator_category;
|
|
|
|
typedef typename _Traits::value_type value_type;
|
|
|
|
typedef typename _Traits::difference_type difference_type;
|
|
|
|
typedef typename _Traits::reference reference;
|
|
|
|
typedef typename _Traits::pointer pointer;
|
|
|
|
|
|
|
|
/// @post the iterator is singular and unattached
|
|
|
|
_Safe_iterator() : _M_current() { }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Safe iterator construction from an unsafe iterator and
|
|
|
|
* its sequence.
|
|
|
|
*
|
|
|
|
* @pre @p seq is not NULL
|
|
|
|
* @post this is not singular
|
|
|
|
*/
|
|
|
|
_Safe_iterator(const _Iterator& __i, const _Sequence* __seq)
|
|
|
|
: _Safe_iterator_base(__seq, _M_constant()), _M_current(__i)
|
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
2003-12-09 05:26:28 +01:00
|
|
|
{
|
2003-11-11 20:09:16 +00:00
|
|
|
_GLIBCXX_DEBUG_VERIFY(! this->_M_singular(),
|
|
|
|
_M_message(__msg_init_singular)
|
|
|
|
._M_iterator(*this, "this"));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Copy construction.
|
|
|
|
* @pre @p x is not singular
|
|
|
|
*/
|
|
|
|
_Safe_iterator(const _Safe_iterator& __x)
|
|
|
|
: _Safe_iterator_base(__x, _M_constant()), _M_current(__x._M_current)
|
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
2003-12-09 05:26:28 +01:00
|
|
|
{
|
2003-11-11 20:09:16 +00:00
|
|
|
_GLIBCXX_DEBUG_VERIFY(!__x._M_singular(),
|
|
|
|
_M_message(__msg_init_copy_singular)
|
|
|
|
._M_iterator(*this, "this")
|
|
|
|
._M_iterator(__x, "other"));
|
|
|
|
}
|
|
|
|
|
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
2003-12-09 05:26:28 +01:00
|
|
|
/**
|
2003-11-11 20:09:16 +00:00
|
|
|
* @brief Converting constructor from a mutable iterator to a
|
|
|
|
* constant iterator.
|
|
|
|
*
|
|
|
|
* @pre @p x is not singular
|
|
|
|
*/
|
|
|
|
template<typename _MutableIterator>
|
2004-05-18 03:27:57 +00:00
|
|
|
_Safe_iterator(
|
|
|
|
const _Safe_iterator<_MutableIterator,
|
2006-09-18 13:30:56 +00:00
|
|
|
typename __gnu_cxx::__enable_if<(std::__are_same<_MutableIterator,
|
|
|
|
typename _Sequence::iterator::_Base_iterator>::__value),
|
|
|
|
_Sequence>::__type>& __x)
|
2003-11-11 20:09:16 +00:00
|
|
|
: _Safe_iterator_base(__x, _M_constant()), _M_current(__x.base())
|
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
2003-12-09 05:26:28 +01:00
|
|
|
{
|
2003-11-11 20:09:16 +00:00
|
|
|
_GLIBCXX_DEBUG_VERIFY(!__x._M_singular(),
|
|
|
|
_M_message(__msg_init_const_singular)
|
|
|
|
._M_iterator(*this, "this")
|
|
|
|
._M_iterator(__x, "other"));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Copy assignment.
|
|
|
|
* @pre @p x is not singular
|
|
|
|
*/
|
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
2003-12-09 05:26:28 +01:00
|
|
|
_Safe_iterator&
|
2003-11-11 20:09:16 +00:00
|
|
|
operator=(const _Safe_iterator& __x)
|
|
|
|
{
|
|
|
|
_GLIBCXX_DEBUG_VERIFY(!__x._M_singular(),
|
|
|
|
_M_message(__msg_copy_singular)
|
|
|
|
._M_iterator(*this, "this")
|
|
|
|
._M_iterator(__x, "other"));
|
|
|
|
_M_current = __x._M_current;
|
|
|
|
this->_M_attach(static_cast<_Sequence*>(__x._M_sequence));
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Iterator dereference.
|
|
|
|
* @pre iterator is dereferenceable
|
|
|
|
*/
|
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
2003-12-09 05:26:28 +01:00
|
|
|
reference
|
|
|
|
operator*() const
|
2003-11-11 20:09:16 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
_GLIBCXX_DEBUG_VERIFY(this->_M_dereferenceable(),
|
|
|
|
_M_message(__msg_bad_deref)
|
|
|
|
._M_iterator(*this, "this"));
|
|
|
|
return *_M_current;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Iterator dereference.
|
|
|
|
* @pre iterator is dereferenceable
|
|
|
|
* @todo Make this correct w.r.t. iterators that return proxies
|
|
|
|
* @todo Use addressof() instead of & operator
|
|
|
|
*/
|
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
2003-12-09 05:26:28 +01:00
|
|
|
pointer
|
2003-11-11 20:09:16 +00:00
|
|
|
operator->() const
|
|
|
|
{
|
|
|
|
_GLIBCXX_DEBUG_VERIFY(this->_M_dereferenceable(),
|
|
|
|
_M_message(__msg_bad_deref)
|
|
|
|
._M_iterator(*this, "this"));
|
|
|
|
return &*_M_current;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------ Input iterator requirements ------
|
|
|
|
/**
|
|
|
|
* @brief Iterator preincrement
|
|
|
|
* @pre iterator is incrementable
|
|
|
|
*/
|
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
2003-12-09 05:26:28 +01:00
|
|
|
_Safe_iterator&
|
2003-11-11 20:09:16 +00:00
|
|
|
operator++()
|
|
|
|
{
|
|
|
|
_GLIBCXX_DEBUG_VERIFY(this->_M_incrementable(),
|
|
|
|
_M_message(__msg_bad_inc)
|
|
|
|
._M_iterator(*this, "this"));
|
|
|
|
++_M_current;
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Iterator postincrement
|
|
|
|
* @pre iterator is incrementable
|
|
|
|
*/
|
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
2003-12-09 05:26:28 +01:00
|
|
|
_Safe_iterator
|
2003-11-11 20:09:16 +00:00
|
|
|
operator++(int)
|
|
|
|
{
|
|
|
|
_GLIBCXX_DEBUG_VERIFY(this->_M_incrementable(),
|
|
|
|
_M_message(__msg_bad_inc)
|
|
|
|
._M_iterator(*this, "this"));
|
|
|
|
_Safe_iterator __tmp(*this);
|
|
|
|
++_M_current;
|
|
|
|
return __tmp;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------ Bidirectional iterator requirements ------
|
|
|
|
/**
|
|
|
|
* @brief Iterator predecrement
|
|
|
|
* @pre iterator is decrementable
|
|
|
|
*/
|
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
2003-12-09 05:26:28 +01:00
|
|
|
_Safe_iterator&
|
2003-11-11 20:09:16 +00:00
|
|
|
operator--()
|
|
|
|
{
|
|
|
|
_GLIBCXX_DEBUG_VERIFY(this->_M_decrementable(),
|
|
|
|
_M_message(__msg_bad_dec)
|
|
|
|
._M_iterator(*this, "this"));
|
|
|
|
--_M_current;
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Iterator postdecrement
|
|
|
|
* @pre iterator is decrementable
|
|
|
|
*/
|
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
2003-12-09 05:26:28 +01:00
|
|
|
_Safe_iterator
|
2003-11-11 20:09:16 +00:00
|
|
|
operator--(int)
|
|
|
|
{
|
|
|
|
_GLIBCXX_DEBUG_VERIFY(this->_M_decrementable(),
|
|
|
|
_M_message(__msg_bad_dec)
|
|
|
|
._M_iterator(*this, "this"));
|
|
|
|
_Safe_iterator __tmp(*this);
|
|
|
|
--_M_current;
|
|
|
|
return __tmp;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------ Random access iterator requirements ------
|
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
2003-12-09 05:26:28 +01:00
|
|
|
reference
|
2003-11-11 20:09:16 +00:00
|
|
|
operator[](const difference_type& __n) const
|
|
|
|
{
|
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
2003-12-09 05:26:28 +01:00
|
|
|
_GLIBCXX_DEBUG_VERIFY(this->_M_can_advance(__n)
|
2003-11-11 20:09:16 +00:00
|
|
|
&& this->_M_can_advance(__n+1),
|
|
|
|
_M_message(__msg_iter_subscript_oob)
|
|
|
|
._M_iterator(*this)._M_integer(__n));
|
|
|
|
|
|
|
|
return _M_current[__n];
|
|
|
|
}
|
|
|
|
|
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
2003-12-09 05:26:28 +01:00
|
|
|
_Safe_iterator&
|
2003-11-11 20:09:16 +00:00
|
|
|
operator+=(const difference_type& __n)
|
|
|
|
{
|
|
|
|
_GLIBCXX_DEBUG_VERIFY(this->_M_can_advance(__n),
|
|
|
|
_M_message(__msg_advance_oob)
|
|
|
|
._M_iterator(*this)._M_integer(__n));
|
|
|
|
_M_current += __n;
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
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
2003-12-09 05:26:28 +01:00
|
|
|
_Safe_iterator
|
2003-11-11 20:09:16 +00:00
|
|
|
operator+(const difference_type& __n) const
|
|
|
|
{
|
|
|
|
_Safe_iterator __tmp(*this);
|
|
|
|
__tmp += __n;
|
|
|
|
return __tmp;
|
|
|
|
}
|
|
|
|
|
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
2003-12-09 05:26:28 +01:00
|
|
|
_Safe_iterator&
|
2003-11-11 20:09:16 +00:00
|
|
|
operator-=(const difference_type& __n)
|
|
|
|
{
|
|
|
|
_GLIBCXX_DEBUG_VERIFY(this->_M_can_advance(-__n),
|
|
|
|
_M_message(__msg_retreat_oob)
|
|
|
|
._M_iterator(*this)._M_integer(__n));
|
|
|
|
_M_current += -__n;
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
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
2003-12-09 05:26:28 +01:00
|
|
|
_Safe_iterator
|
2003-11-11 20:09:16 +00:00
|
|
|
operator-(const difference_type& __n) const
|
|
|
|
{
|
|
|
|
_Safe_iterator __tmp(*this);
|
|
|
|
__tmp -= __n;
|
|
|
|
return __tmp;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------ Utilities ------
|
|
|
|
/**
|
|
|
|
* @brief Return the underlying iterator
|
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
2003-12-09 05:26:28 +01:00
|
|
|
*/
|
|
|
|
_Iterator
|
2003-11-11 20:09:16 +00:00
|
|
|
base() const { return _M_current; }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Conversion to underlying non-debug iterator to allow
|
|
|
|
* better interaction with non-debug containers.
|
|
|
|
*/
|
|
|
|
operator _Iterator() const { return _M_current; }
|
|
|
|
|
|
|
|
/** Attach iterator to the given sequence. */
|
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
2003-12-09 05:26:28 +01:00
|
|
|
void
|
2003-11-11 20:09:16 +00:00
|
|
|
_M_attach(const _Sequence* __seq)
|
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
2003-12-09 05:26:28 +01:00
|
|
|
{
|
2003-11-11 20:09:16 +00:00
|
|
|
_Safe_iterator_base::_M_attach(const_cast<_Sequence*>(__seq),
|
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
2003-12-09 05:26:28 +01:00
|
|
|
_M_constant());
|
2003-11-11 20:09:16 +00:00
|
|
|
}
|
|
|
|
|
re PR libstdc++/29496 (_M_invalidate function is not thread-safe in GLIBCXX_DEBUG mode)
2006-11-11 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29496
* include/debug/safe_base.h (_Safe_sequence_base::_M_get_mutex,
_Safe_iterator_base::_M_get_mutex, _M_attach_single, _M_detach_single):
New.
* src/debug.cc: Define the latter.
(_Safe_sequence_base::_M_detach_all, _M_detach_singular,
_M_revalidate_singular, _M_swap): Use the mutex.
(_Safe_iterator_base::_M_attach, _M_detach): Adjust, forward to the
*_single version.
* include/debug/safe_iterator.h (_Safe_iterator<>::_M_attach_single,
_M_invalidate_single): New.
* include/debug/safe_iterator.tcc: Define.
(_Safe_iterator<>::_M_invalidate): Adjust, forward to
_M_invalidate_single.
* include/debug/safe_sequence.h (_Safe_sequence<>::_M_invalidate_if,
_M_transfer_iter): Use the mutex, adjust, forward to the *_single
versions of _M_invalidate and _M_attach.
* config/abi/pre/gnu.ver (_Safe_sequence_base::_M_get_mutex,
_Safe_iterator_base::_M_get_mutex, _M_attach_single, _M_detach_single):
Add @GLIBCXX_3.4.10; adjust.
* configure.ac (libtool_VERSION): To 6:10:0.
* testsuite/util/testsuite_abi.cc (check_version): Add GLIBCXX_3.4.10.
* configure: Regenerate.
From-SVN: r118701
2006-11-11 17:32:12 +00:00
|
|
|
/** Likewise, but not thread-safe. */
|
|
|
|
void
|
|
|
|
_M_attach_single(const _Sequence* __seq)
|
|
|
|
{
|
|
|
|
_Safe_iterator_base::_M_attach_single(const_cast<_Sequence*>(__seq),
|
|
|
|
_M_constant());
|
|
|
|
}
|
|
|
|
|
2003-11-11 20:09:16 +00:00
|
|
|
/** Invalidate the iterator, making it singular. */
|
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
2003-12-09 05:26:28 +01:00
|
|
|
void
|
2003-11-11 20:09:16 +00:00
|
|
|
_M_invalidate();
|
|
|
|
|
re PR libstdc++/29496 (_M_invalidate function is not thread-safe in GLIBCXX_DEBUG mode)
2006-11-11 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/29496
* include/debug/safe_base.h (_Safe_sequence_base::_M_get_mutex,
_Safe_iterator_base::_M_get_mutex, _M_attach_single, _M_detach_single):
New.
* src/debug.cc: Define the latter.
(_Safe_sequence_base::_M_detach_all, _M_detach_singular,
_M_revalidate_singular, _M_swap): Use the mutex.
(_Safe_iterator_base::_M_attach, _M_detach): Adjust, forward to the
*_single version.
* include/debug/safe_iterator.h (_Safe_iterator<>::_M_attach_single,
_M_invalidate_single): New.
* include/debug/safe_iterator.tcc: Define.
(_Safe_iterator<>::_M_invalidate): Adjust, forward to
_M_invalidate_single.
* include/debug/safe_sequence.h (_Safe_sequence<>::_M_invalidate_if,
_M_transfer_iter): Use the mutex, adjust, forward to the *_single
versions of _M_invalidate and _M_attach.
* config/abi/pre/gnu.ver (_Safe_sequence_base::_M_get_mutex,
_Safe_iterator_base::_M_get_mutex, _M_attach_single, _M_detach_single):
Add @GLIBCXX_3.4.10; adjust.
* configure.ac (libtool_VERSION): To 6:10:0.
* testsuite/util/testsuite_abi.cc (check_version): Add GLIBCXX_3.4.10.
* configure: Regenerate.
From-SVN: r118701
2006-11-11 17:32:12 +00:00
|
|
|
/** Likewise, but not thread-safe. */
|
|
|
|
void
|
|
|
|
_M_invalidate_single();
|
|
|
|
|
2003-11-11 20:09:16 +00:00
|
|
|
/// Is the iterator dereferenceable?
|
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
2003-12-09 05:26:28 +01:00
|
|
|
bool
|
2003-11-11 20:09:16 +00:00
|
|
|
_M_dereferenceable() const
|
|
|
|
{ return !this->_M_singular() && !_M_is_end(); }
|
|
|
|
|
|
|
|
/// Is the iterator incrementable?
|
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
2003-12-09 05:26:28 +01:00
|
|
|
bool
|
2003-11-11 20:09:16 +00:00
|
|
|
_M_incrementable() const { return this->_M_dereferenceable(); }
|
|
|
|
|
|
|
|
// Is the iterator decrementable?
|
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
2003-12-09 05:26:28 +01:00
|
|
|
bool
|
2003-11-11 20:09:16 +00:00
|
|
|
_M_decrementable() const { return !_M_singular() && !_M_is_begin(); }
|
|
|
|
|
|
|
|
// Can we advance the iterator @p __n steps (@p __n may be negative)
|
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
2003-12-09 05:26:28 +01:00
|
|
|
bool
|
2003-11-11 20:09:16 +00:00
|
|
|
_M_can_advance(const difference_type& __n) const;
|
|
|
|
|
|
|
|
// Is the iterator range [*this, __rhs) valid?
|
|
|
|
template<typename _Other>
|
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
2003-12-09 05:26:28 +01:00
|
|
|
bool
|
2003-11-11 20:09:16 +00:00
|
|
|
_M_valid_range(const _Safe_iterator<_Other, _Sequence>& __rhs) const;
|
|
|
|
|
|
|
|
// The sequence this iterator references.
|
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
2003-12-09 05:26:28 +01:00
|
|
|
const _Sequence*
|
2003-11-11 20:09:16 +00:00
|
|
|
_M_get_sequence() const
|
|
|
|
{ return static_cast<const _Sequence*>(_M_sequence); }
|
|
|
|
|
|
|
|
/** Determine the distance between two iterators with some known
|
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
2003-12-09 05:26:28 +01:00
|
|
|
* precision.
|
2003-11-11 20:09:16 +00:00
|
|
|
*/
|
|
|
|
template<typename _Iterator1, typename _Iterator2>
|
2006-02-22 00:57:24 +00:00
|
|
|
static std::pair<difference_type, _Distance_precision>
|
2003-11-11 20:09:16 +00:00
|
|
|
_M_get_distance(const _Iterator1& __lhs, const _Iterator2& __rhs)
|
|
|
|
{
|
2006-02-22 00:57:24 +00:00
|
|
|
typedef typename std::iterator_traits<_Iterator1>::iterator_category
|
2003-11-11 20:09:16 +00:00
|
|
|
_Category;
|
|
|
|
return _M_get_distance(__lhs, __rhs, _Category());
|
|
|
|
}
|
|
|
|
|
|
|
|
template<typename _Iterator1, typename _Iterator2>
|
2006-02-22 00:57:24 +00:00
|
|
|
static std::pair<difference_type, _Distance_precision>
|
2003-11-11 20:09:16 +00:00
|
|
|
_M_get_distance(const _Iterator1& __lhs, const _Iterator2& __rhs,
|
|
|
|
std::random_access_iterator_tag)
|
|
|
|
{
|
|
|
|
return std::make_pair(__rhs.base() - __lhs.base(), __dp_exact);
|
|
|
|
}
|
|
|
|
|
|
|
|
template<typename _Iterator1, typename _Iterator2>
|
2006-02-22 00:57:24 +00:00
|
|
|
static std::pair<difference_type, _Distance_precision>
|
2003-11-11 20:09:16 +00:00
|
|
|
_M_get_distance(const _Iterator1& __lhs, const _Iterator2& __rhs,
|
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
2003-12-09 05:26:28 +01:00
|
|
|
std::forward_iterator_tag)
|
2003-11-11 20:09:16 +00:00
|
|
|
{
|
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
2003-12-09 05:26:28 +01:00
|
|
|
return std::make_pair(__lhs.base() == __rhs.base()? 0 : 1,
|
2003-11-11 20:09:16 +00:00
|
|
|
__dp_equality);
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Is this iterator equal to the sequence's begin() iterator?
|
|
|
|
bool _M_is_begin() const
|
|
|
|
{ return *this == static_cast<const _Sequence*>(_M_sequence)->begin(); }
|
|
|
|
|
|
|
|
/// Is this iterator equal to the sequence's end() iterator?
|
|
|
|
bool _M_is_end() const
|
|
|
|
{ return *this == static_cast<const _Sequence*>(_M_sequence)->end(); }
|
|
|
|
};
|
|
|
|
|
|
|
|
template<typename _IteratorL, typename _IteratorR, typename _Sequence>
|
|
|
|
inline bool
|
|
|
|
operator==(const _Safe_iterator<_IteratorL, _Sequence>& __lhs,
|
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
2003-12-09 05:26:28 +01:00
|
|
|
const _Safe_iterator<_IteratorR, _Sequence>& __rhs)
|
|
|
|
{
|
2003-11-11 20:09:16 +00:00
|
|
|
_GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(),
|
|
|
|
_M_message(__msg_iter_compare_bad)
|
|
|
|
._M_iterator(__lhs, "lhs")
|
|
|
|
._M_iterator(__rhs, "rhs"));
|
|
|
|
_GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs),
|
|
|
|
_M_message(__msg_compare_different)
|
|
|
|
._M_iterator(__lhs, "lhs")
|
|
|
|
._M_iterator(__rhs, "rhs"));
|
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
2003-12-09 05:26:28 +01:00
|
|
|
return __lhs.base() == __rhs.base();
|
2003-11-11 20:09:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
template<typename _Iterator, typename _Sequence>
|
|
|
|
inline bool
|
|
|
|
operator==(const _Safe_iterator<_Iterator, _Sequence>& __lhs,
|
|
|
|
const _Safe_iterator<_Iterator, _Sequence>& __rhs)
|
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
2003-12-09 05:26:28 +01:00
|
|
|
{
|
2003-11-11 20:09:16 +00:00
|
|
|
_GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(),
|
|
|
|
_M_message(__msg_iter_compare_bad)
|
|
|
|
._M_iterator(__lhs, "lhs")
|
|
|
|
._M_iterator(__rhs, "rhs"));
|
|
|
|
_GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs),
|
|
|
|
_M_message(__msg_compare_different)
|
|
|
|
._M_iterator(__lhs, "lhs")
|
|
|
|
._M_iterator(__rhs, "rhs"));
|
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
2003-12-09 05:26:28 +01:00
|
|
|
return __lhs.base() == __rhs.base();
|
2003-11-11 20:09:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
template<typename _IteratorL, typename _IteratorR, typename _Sequence>
|
|
|
|
inline bool
|
|
|
|
operator!=(const _Safe_iterator<_IteratorL, _Sequence>& __lhs,
|
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
2003-12-09 05:26:28 +01:00
|
|
|
const _Safe_iterator<_IteratorR, _Sequence>& __rhs)
|
|
|
|
{
|
2003-11-11 20:09:16 +00:00
|
|
|
_GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(),
|
|
|
|
_M_message(__msg_iter_compare_bad)
|
|
|
|
._M_iterator(__lhs, "lhs")
|
|
|
|
._M_iterator(__rhs, "rhs"));
|
|
|
|
_GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs),
|
|
|
|
_M_message(__msg_compare_different)
|
|
|
|
._M_iterator(__lhs, "lhs")
|
|
|
|
._M_iterator(__rhs, "rhs"));
|
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
2003-12-09 05:26:28 +01:00
|
|
|
return __lhs.base() != __rhs.base();
|
2003-11-11 20:09:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
template<typename _Iterator, typename _Sequence>
|
|
|
|
inline bool
|
|
|
|
operator!=(const _Safe_iterator<_Iterator, _Sequence>& __lhs,
|
|
|
|
const _Safe_iterator<_Iterator, _Sequence>& __rhs)
|
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
2003-12-09 05:26:28 +01:00
|
|
|
{
|
2003-11-11 20:09:16 +00:00
|
|
|
_GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(),
|
|
|
|
_M_message(__msg_iter_compare_bad)
|
|
|
|
._M_iterator(__lhs, "lhs")
|
|
|
|
._M_iterator(__rhs, "rhs"));
|
|
|
|
_GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs),
|
|
|
|
_M_message(__msg_compare_different)
|
|
|
|
._M_iterator(__lhs, "lhs")
|
|
|
|
._M_iterator(__rhs, "rhs"));
|
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
2003-12-09 05:26:28 +01:00
|
|
|
return __lhs.base() != __rhs.base();
|
2003-11-11 20:09:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
template<typename _IteratorL, typename _IteratorR, typename _Sequence>
|
|
|
|
inline bool
|
|
|
|
operator<(const _Safe_iterator<_IteratorL, _Sequence>& __lhs,
|
|
|
|
const _Safe_iterator<_IteratorR, _Sequence>& __rhs)
|
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
2003-12-09 05:26:28 +01:00
|
|
|
{
|
2003-11-11 20:09:16 +00:00
|
|
|
_GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(),
|
|
|
|
_M_message(__msg_iter_order_bad)
|
|
|
|
._M_iterator(__lhs, "lhs")
|
|
|
|
._M_iterator(__rhs, "rhs"));
|
|
|
|
_GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs),
|
|
|
|
_M_message(__msg_order_different)
|
|
|
|
._M_iterator(__lhs, "lhs")
|
|
|
|
._M_iterator(__rhs, "rhs"));
|
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
2003-12-09 05:26:28 +01:00
|
|
|
return __lhs.base() < __rhs.base();
|
2003-11-11 20:09:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
template<typename _Iterator, typename _Sequence>
|
|
|
|
inline bool
|
|
|
|
operator<(const _Safe_iterator<_Iterator, _Sequence>& __lhs,
|
|
|
|
const _Safe_iterator<_Iterator, _Sequence>& __rhs)
|
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
2003-12-09 05:26:28 +01:00
|
|
|
{
|
2003-11-11 20:09:16 +00:00
|
|
|
_GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(),
|
|
|
|
_M_message(__msg_iter_order_bad)
|
|
|
|
._M_iterator(__lhs, "lhs")
|
|
|
|
._M_iterator(__rhs, "rhs"));
|
|
|
|
_GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs),
|
|
|
|
_M_message(__msg_order_different)
|
|
|
|
._M_iterator(__lhs, "lhs")
|
|
|
|
._M_iterator(__rhs, "rhs"));
|
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
2003-12-09 05:26:28 +01:00
|
|
|
return __lhs.base() < __rhs.base();
|
2003-11-11 20:09:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
template<typename _IteratorL, typename _IteratorR, typename _Sequence>
|
|
|
|
inline bool
|
|
|
|
operator<=(const _Safe_iterator<_IteratorL, _Sequence>& __lhs,
|
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
2003-12-09 05:26:28 +01:00
|
|
|
const _Safe_iterator<_IteratorR, _Sequence>& __rhs)
|
|
|
|
{
|
2003-11-11 20:09:16 +00:00
|
|
|
_GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(),
|
|
|
|
_M_message(__msg_iter_order_bad)
|
|
|
|
._M_iterator(__lhs, "lhs")
|
|
|
|
._M_iterator(__rhs, "rhs"));
|
|
|
|
_GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs),
|
|
|
|
_M_message(__msg_order_different)
|
|
|
|
._M_iterator(__lhs, "lhs")
|
|
|
|
._M_iterator(__rhs, "rhs"));
|
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
2003-12-09 05:26:28 +01:00
|
|
|
return __lhs.base() <= __rhs.base();
|
2003-11-11 20:09:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
template<typename _Iterator, typename _Sequence>
|
|
|
|
inline bool
|
|
|
|
operator<=(const _Safe_iterator<_Iterator, _Sequence>& __lhs,
|
|
|
|
const _Safe_iterator<_Iterator, _Sequence>& __rhs)
|
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
2003-12-09 05:26:28 +01:00
|
|
|
{
|
2003-11-11 20:09:16 +00:00
|
|
|
_GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(),
|
|
|
|
_M_message(__msg_iter_order_bad)
|
|
|
|
._M_iterator(__lhs, "lhs")
|
|
|
|
._M_iterator(__rhs, "rhs"));
|
|
|
|
_GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs),
|
|
|
|
_M_message(__msg_order_different)
|
|
|
|
._M_iterator(__lhs, "lhs")
|
|
|
|
._M_iterator(__rhs, "rhs"));
|
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
2003-12-09 05:26:28 +01:00
|
|
|
return __lhs.base() <= __rhs.base();
|
2003-11-11 20:09:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
template<typename _IteratorL, typename _IteratorR, typename _Sequence>
|
|
|
|
inline bool
|
|
|
|
operator>(const _Safe_iterator<_IteratorL, _Sequence>& __lhs,
|
|
|
|
const _Safe_iterator<_IteratorR, _Sequence>& __rhs)
|
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
2003-12-09 05:26:28 +01:00
|
|
|
{
|
2003-11-11 20:09:16 +00:00
|
|
|
_GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(),
|
|
|
|
_M_message(__msg_iter_order_bad)
|
|
|
|
._M_iterator(__lhs, "lhs")
|
|
|
|
._M_iterator(__rhs, "rhs"));
|
|
|
|
_GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs),
|
|
|
|
_M_message(__msg_order_different)
|
|
|
|
._M_iterator(__lhs, "lhs")
|
|
|
|
._M_iterator(__rhs, "rhs"));
|
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
2003-12-09 05:26:28 +01:00
|
|
|
return __lhs.base() > __rhs.base();
|
2003-11-11 20:09:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
template<typename _Iterator, typename _Sequence>
|
|
|
|
inline bool
|
|
|
|
operator>(const _Safe_iterator<_Iterator, _Sequence>& __lhs,
|
|
|
|
const _Safe_iterator<_Iterator, _Sequence>& __rhs)
|
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
2003-12-09 05:26:28 +01:00
|
|
|
{
|
2003-11-11 20:09:16 +00:00
|
|
|
_GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(),
|
|
|
|
_M_message(__msg_iter_order_bad)
|
|
|
|
._M_iterator(__lhs, "lhs")
|
|
|
|
._M_iterator(__rhs, "rhs"));
|
|
|
|
_GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs),
|
|
|
|
_M_message(__msg_order_different)
|
|
|
|
._M_iterator(__lhs, "lhs")
|
|
|
|
._M_iterator(__rhs, "rhs"));
|
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
2003-12-09 05:26:28 +01:00
|
|
|
return __lhs.base() > __rhs.base();
|
2003-11-11 20:09:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
template<typename _IteratorL, typename _IteratorR, typename _Sequence>
|
|
|
|
inline bool
|
|
|
|
operator>=(const _Safe_iterator<_IteratorL, _Sequence>& __lhs,
|
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
2003-12-09 05:26:28 +01:00
|
|
|
const _Safe_iterator<_IteratorR, _Sequence>& __rhs)
|
|
|
|
{
|
2003-11-11 20:09:16 +00:00
|
|
|
_GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(),
|
|
|
|
_M_message(__msg_iter_order_bad)
|
|
|
|
._M_iterator(__lhs, "lhs")
|
|
|
|
._M_iterator(__rhs, "rhs"));
|
|
|
|
_GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs),
|
|
|
|
_M_message(__msg_order_different)
|
|
|
|
._M_iterator(__lhs, "lhs")
|
|
|
|
._M_iterator(__rhs, "rhs"));
|
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
2003-12-09 05:26:28 +01:00
|
|
|
return __lhs.base() >= __rhs.base();
|
2003-11-11 20:09:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
template<typename _Iterator, typename _Sequence>
|
|
|
|
inline bool
|
|
|
|
operator>=(const _Safe_iterator<_Iterator, _Sequence>& __lhs,
|
|
|
|
const _Safe_iterator<_Iterator, _Sequence>& __rhs)
|
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
2003-12-09 05:26:28 +01:00
|
|
|
{
|
2003-11-11 20:09:16 +00:00
|
|
|
_GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(),
|
|
|
|
_M_message(__msg_iter_order_bad)
|
|
|
|
._M_iterator(__lhs, "lhs")
|
|
|
|
._M_iterator(__rhs, "rhs"));
|
|
|
|
_GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs),
|
|
|
|
_M_message(__msg_order_different)
|
|
|
|
._M_iterator(__lhs, "lhs")
|
|
|
|
._M_iterator(__rhs, "rhs"));
|
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
2003-12-09 05:26:28 +01:00
|
|
|
return __lhs.base() >= __rhs.base();
|
2003-11-11 20:09:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// _GLIBCXX_RESOLVE_LIB_DEFECTS
|
|
|
|
// According to the resolution of DR179 not only the various comparison
|
|
|
|
// operators but also operator- must accept mixed iterator/const_iterator
|
|
|
|
// parameters.
|
|
|
|
template<typename _IteratorL, typename _IteratorR, typename _Sequence>
|
|
|
|
inline typename _Safe_iterator<_IteratorL, _Sequence>::difference_type
|
|
|
|
operator-(const _Safe_iterator<_IteratorL, _Sequence>& __lhs,
|
|
|
|
const _Safe_iterator<_IteratorR, _Sequence>& __rhs)
|
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
2003-12-09 05:26:28 +01:00
|
|
|
{
|
2003-11-11 20:09:16 +00:00
|
|
|
_GLIBCXX_DEBUG_VERIFY(! __lhs._M_singular() && ! __rhs._M_singular(),
|
|
|
|
_M_message(__msg_distance_bad)
|
|
|
|
._M_iterator(__lhs, "lhs")
|
|
|
|
._M_iterator(__rhs, "rhs"));
|
|
|
|
_GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs),
|
|
|
|
_M_message(__msg_distance_different)
|
|
|
|
._M_iterator(__lhs, "lhs")
|
|
|
|
._M_iterator(__rhs, "rhs"));
|
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
2003-12-09 05:26:28 +01:00
|
|
|
return __lhs.base() - __rhs.base();
|
2003-11-11 20:09:16 +00:00
|
|
|
}
|
|
|
|
|
basic_string.h (insert(iterator, _CharT), [...]): Avoid troubles with ADL, user defined operators and __normal_iterator.
2005-12-06 Paolo Carlini <pcarlini@suse.de>
* include/bits/basic_string.h (insert(iterator, _CharT),
erase(iterator), erase(iterator, iterator)): Avoid troubles
with ADL, user defined operators and __normal_iterator.
* include/bits/stl_iterator.h (operator-(const __normal_iterator
<_Iterator, _Container>&, const __normal_iterator<_Iterator,
_Container>&)): Add overload for left and right iterators of
the same type.
* include/debug/safe_iterator.h (operator-(const _Safe_iterator
<_Iterator, _Sequence>&, const _Safe_iterator<_Iterator,
_Sequence>&)): Likewise.
* testsuite/21_strings/basic_string/types/1.cc: New.
From-SVN: r108123
2005-12-06 17:19:30 +00:00
|
|
|
template<typename _Iterator, typename _Sequence>
|
|
|
|
inline typename _Safe_iterator<_Iterator, _Sequence>::difference_type
|
|
|
|
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_distance_bad)
|
|
|
|
._M_iterator(__lhs, "lhs")
|
|
|
|
._M_iterator(__rhs, "rhs"));
|
|
|
|
_GLIBCXX_DEBUG_VERIFY(__lhs._M_can_compare(__rhs),
|
|
|
|
_M_message(__msg_distance_different)
|
|
|
|
._M_iterator(__lhs, "lhs")
|
|
|
|
._M_iterator(__rhs, "rhs"));
|
|
|
|
return __lhs.base() - __rhs.base();
|
|
|
|
}
|
|
|
|
|
2003-11-11 20:09:16 +00:00
|
|
|
template<typename _Iterator, typename _Sequence>
|
|
|
|
inline _Safe_iterator<_Iterator, _Sequence>
|
|
|
|
operator+(typename _Safe_iterator<_Iterator,_Sequence>::difference_type __n,
|
|
|
|
const _Safe_iterator<_Iterator, _Sequence>& __i)
|
|
|
|
{ return __i + __n; }
|
|
|
|
} // namespace __gnu_debug
|
|
|
|
|
|
|
|
#ifndef _GLIBCXX_EXPORT_TEMPLATE
|
|
|
|
# include <debug/safe_iterator.tcc>
|
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
2003-12-09 05:26:28 +01:00
|
|
|
#endif
|
2003-11-11 20:09:16 +00:00
|
|
|
|
|
|
|
#endif
|