typename _Sequence::_Base::iterator,
typename _Sequence::_Base::const_iterator>::__type _OtherIterator;
- struct _Attach_single
- { };
-
- _Safe_iterator(_Iterator __i, _Safe_sequence_base* __seq, _Attach_single)
- _GLIBCXX_NOEXCEPT
- : _Iter_base(__i)
- { _M_attach_single(__seq); }
-
public:
typedef _Iterator iterator_type;
typedef typename _Traits::iterator_category iterator_category;
_GLIBCXX_DEBUG_VERIFY(this->_M_incrementable(),
_M_message(__msg_bad_inc)
._M_iterator(*this, "this"));
- __gnu_cxx::__scoped_lock __l(this->_M_get_mutex());
- return _Safe_iterator(base()++, this->_M_sequence, _Attach_single());
+ _Safe_iterator __ret = *this;
+ ++*this;
+ return __ret;
}
// ------ Utilities ------
protected:
typedef typename _Safe_base::_OtherIterator _OtherIterator;
- typedef typename _Safe_base::_Attach_single _Attach_single;
-
- _Safe_iterator(_Iterator __i, _Safe_sequence_base* __seq, _Attach_single)
- _GLIBCXX_NOEXCEPT
- : _Safe_base(__i, __seq, _Attach_single())
- { }
public:
/// @post the iterator is singular and unattached
_GLIBCXX_DEBUG_VERIFY(this->_M_incrementable(),
_M_message(__msg_bad_inc)
._M_iterator(*this, "this"));
- __gnu_cxx::__scoped_lock __l(this->_M_get_mutex());
- return _Safe_iterator(this->base()++, this->_M_sequence,
- _Attach_single());
+ _Safe_iterator __ret = *this;
+ ++*this;
+ return __ret;
}
// ------ Bidirectional iterator requirements ------
_GLIBCXX_DEBUG_VERIFY(this->_M_decrementable(),
_M_message(__msg_bad_dec)
._M_iterator(*this, "this"));
- __gnu_cxx::__scoped_lock __l(this->_M_get_mutex());
- return _Safe_iterator(this->base()--, this->_M_sequence,
- _Attach_single());
+ _Safe_iterator __ret = *this;
+ --*this;
+ return __ret;
}
// ------ Utilities ------
typedef _Safe_iterator<_OtherIterator, _Sequence,
std::random_access_iterator_tag> _OtherSelf;
- typedef typename _Safe_base::_Attach_single _Attach_single;
-
- _Safe_iterator(_Iterator __i, _Safe_sequence_base* __seq, _Attach_single)
- _GLIBCXX_NOEXCEPT
- : _Safe_base(__i, __seq, _Attach_single())
- { }
-
public:
typedef typename _Safe_base::difference_type difference_type;
typedef typename _Safe_base::reference reference;
_Safe_iterator
operator++(int) _GLIBCXX_NOEXCEPT
{
+ _GLIBCXX_DEBUG_VERIFY(this->_M_incrementable(),
+ _M_message(__msg_bad_inc)
+ ._M_iterator(*this, "this"));
_Safe_iterator __ret = *this;
++*this;
return __ret;
_Safe_iterator
operator--(int) _GLIBCXX_NOEXCEPT
{
+ _GLIBCXX_DEBUG_VERIFY(this->_M_decrementable(),
+ _M_message(__msg_bad_dec)
+ ._M_iterator(*this, "this"));
_Safe_iterator __ret = *this;
--*this;
return __ret;
typedef _Safe_local_iterator _Self;
typedef _Safe_local_iterator<_OtherIterator, _Sequence> _OtherSelf;
- struct _Attach_single
- { };
-
- _Safe_local_iterator(_Iterator __i, _Safe_sequence_base* __cont,
- _Attach_single) noexcept
- : _Iter_base(__i)
- { _M_attach_single(__cont); }
-
public:
typedef _Iterator iterator_type;
typedef typename _Traits::iterator_category iterator_category;
_GLIBCXX_DEBUG_VERIFY(this->_M_incrementable(),
_M_message(__msg_bad_inc)
._M_iterator(*this, "this"));
- __gnu_cxx::__scoped_lock __l(this->_M_get_mutex());
- return _Safe_local_iterator(base()++, this->_M_sequence,
- _Attach_single());
+ _Safe_local_iterator __ret = *this;
+ ++*this;
+ return __ret;
}
// ------ Utilities ------
VERIFY( *it == val );
}
+ template<typename _Tp>
+ void invalid_local_iterator_pre_increment()
+ {
+ typedef _Tp cont_type;
+ typedef typename cont_type::value_type cont_val_type;
+ typedef typename CopyableValueType<cont_val_type>::value_type val_type;
+ generate_unique<val_type> gu;
+
+ cont_type c;
+ for (size_t i = 0; i != 5; ++i)
+ c.insert(gu.build());
+
+ auto lit = c.begin(0);
+ for (size_t i = 0; i != 6; ++i)
+ ++lit;
+ }
+
+ template<typename _Tp>
+ void invalid_local_iterator_post_increment()
+ {
+ typedef _Tp cont_type;
+ typedef typename cont_type::value_type cont_val_type;
+ typedef typename CopyableValueType<cont_val_type>::value_type val_type;
+ generate_unique<val_type> gu;
+
+ cont_type c;
+ for (size_t i = 0; i != 5; ++i)
+ c.insert(gu.build());
+
+ auto lit = c.begin(0);
+ for (size_t i = 0; i != 6; ++i)
+ lit++;
+ }
+
template<typename _Tp>
void invalid_local_iterator_compare()
{