2003-11-11 21:09:16 +01:00
|
|
|
// Safe sequence implementation -*- C++ -*-
|
|
|
|
|
2018-01-03 11:03:58 +01:00
|
|
|
// Copyright (C) 2003-2018 Free Software Foundation, Inc.
|
2003-11-11 21:09:16 +01:00
|
|
|
//
|
|
|
|
// 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 21:09:16 +01: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 21:09:16 +01: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 21:09:16 +01:00
|
|
|
|
2006-11-29 21:59:22 +01:00
|
|
|
/** @file debug/safe_sequence.h
|
|
|
|
* This file is a GNU debug extension to the Standard C++ Library.
|
|
|
|
*/
|
|
|
|
|
2003-11-11 21:09:16 +01:00
|
|
|
#ifndef _GLIBCXX_DEBUG_SAFE_SEQUENCE_H
|
|
|
|
#define _GLIBCXX_DEBUG_SAFE_SEQUENCE_H 1
|
|
|
|
|
2015-05-29 François Dumont fdumont@gcc.gnu.org>
* include/debug/debug.h (_GLIBCXX_DEBUG_ASSERT,
_GLIBCXX_DEBUG_PEDASSERT, _GLIBCXX_DEBUG_ONLY): Move definition...
* include/debug/assertions.h: ...here, new.
* include/debug/formatter.h
(_Error_formatter::_Is_iterator_value_type): New.
(_Error_formatter::_Is_instance): New.
(_Error_formatter::_Parameter): Make public and not friend anymore.
(_Error_formatter::_Parameter::__instance): New _M_kind enum entry.
(_Error_formatter::_Parameter::__iterator_value_type): New _M_kind enum
entry.
(_Error_formatter::_Parameter::_Type): New.
(_Error_formatter::_Parameter::_Instance): New, inherit from
latter.
(union _Error_formatter::_Parameter::_M_variant): Reorganize.
(_Parameter(_Iterator const&, const char*, _Is_iterator)): Make all
overloads take iterator through a const reference.
(_Parameter(const _Iterator&, const char*, _Is_iterator_value_type)):
New.
(_Parameter(const _Type&, const char*, _Is_instance)): New.
(_Error_formatter::_M_print_type): Delete.
(_Error_formatter::_M_iterator_value_type): New.
(_Error_formatter::_M_instance): New.
* include/Makefile.am: Add new above debug file.
* include/Makefile.in: Regenerate.
* include/debug/functions.h
(__check_dereferenceable(const _Safe_iterator<>&),
__valid_range(const _Safe_iterator<>&),
__is_safe_random_iterator<_Safe_iterator<>>): Move...
* include/debug/safe_iterator.h: ... here.
Replace debug.h include with assertions.h.
(__check_singular_aux): Move...
* include/debug/safe_base.h: ... here.
* include/debug/functions.h
(__check_dereferenceable(const _Safe_local_iterator<>&),
__valid_range(const _Safe_local_iterator<>&): Move...
* include/debug/safe_local_iterator.h: ...here.
* include/debug/safe_sequence.h: Replace debug.h with assertions.h.
Remove _Safe_iterator declaration.
* include/debug/safe_unordered_container.h: Replace debug.h with
assertions.h.
* include/debug/array: Replace safe_sequence.h include with
formatter.h and macros.h.
* include/debug/deque: Include functions.tcc.
* include/debug/forward_list: Likewise.
* include/debug/list: Likewise.
* include/debug/string: Likewise.
* include/debug/vector: Likewise.
* include/bits/unique_ptr.h: Replace debug.h include with new
assertions.h.
* include/bits/stl_iterator_base_funcs.h: Likewise.
* testsuite/23_containers/array/tuple_interface/get_debug_neg.cc:
Adjust dg-error line number.
* testsuite/23_containers/array/tuple_interface/
tuple_element_debug_neg.cc: Likewise.
* src/c++11/debug.cc: Adapt.
From-SVN: r223877
2015-05-29 23:29:07 +02:00
|
|
|
#include <debug/assertions.h>
|
2005-05-27 17:01:45 +02:00
|
|
|
#include <debug/macros.h>
|
|
|
|
#include <debug/functions.h>
|
2003-11-11 21:09:16 +01:00
|
|
|
#include <debug/safe_base.h>
|
|
|
|
|
|
|
|
namespace __gnu_debug
|
|
|
|
{
|
|
|
|
/** A simple function object that returns true if the passed-in
|
|
|
|
* value is not equal to the stored value. It saves typing over
|
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
|
|
|
* using both bind1st and not_equal.
|
2003-11-11 21:09:16 +01:00
|
|
|
*/
|
|
|
|
template<typename _Type>
|
|
|
|
class _Not_equal_to
|
|
|
|
{
|
|
|
|
_Type __value;
|
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 21:09:16 +01:00
|
|
|
public:
|
|
|
|
explicit _Not_equal_to(const _Type& __v) : __value(__v) { }
|
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
|
|
|
|
operator()(const _Type& __x) const
|
2003-11-11 21:09:16 +01:00
|
|
|
{ return __value != __x; }
|
|
|
|
};
|
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
|
|
|
|
debug.cc: Introduce a mutex pool in get_safe_base_mutex.
2010-11-25 François Dumont <francois.cppdevs@free.fr>
* src/debug.cc: Introduce a mutex pool in get_safe_base_mutex.
Move code used to manipulate sequence safe iterators from safe
iterator methods to safe sequence ones. Remove usage of safe iterator
mutex, keep _Safe_iterator_base::_M_get_mutex for library backward
binary compatibility.
* src/Makefile.am: Build debug.cc in gnu++0x mode for _Hash_impl usage.
* src/Makefile.in: Regenerate
* include/debug/safe_base.h: Add _Safe_iterator_base _M_invalidate
and _M_reset. Add _Safe_sequence_base _M_attach, _M_attach_single,
_M_detach and _M_detach_single.
* include/debug.safe_iterator.h, safe_iterator.tcc: Remove
_Safe_iterator _M_invalidate and _M_invalidate_single. Implement all
methods in terms of normal iterators rather than safe ones.
* include/debug/safe_sequence.h: Replace _Safe_sequence
_M_transfe_iter with _M_transfer_from_if taking the source sequence
and a predicate signaling when a safe iterator shall be transfered.
Add _Equal_to predicate.
* include/debug/safe_sequence.tcc: New.
* include/Makefile.am: Adjust.
* include/Makefile.in: Regenerate.
* include/debug/forward_list: Swap safe iterators in move constructor.
Do not invalidate before begin in _M_invalidate_all method.
Reimplement safe methods using normal iterators rather than safe ones.
* include/debug/set.h, unordered_map, multiset.h, vector,
unordered_set, deque, map.h, list, multimap.h: Reimplement safe method
using normal iterators rather than safe ones.
* testsuite/23_containers/forward_list/debug/clear.cc, swap.cc,
move_constructor.cc, splice_after.cc, splice_after1.cc,
splice_after2.cc, splice_after3.cc, splice_after4.cc: New.
* testsuite/23_containers/vector/debug/multithreaded_swap.cc: New.
From-SVN: r167152
2010-11-25 21:53:39 +01:00
|
|
|
/** A simple function object that returns true if the passed-in
|
|
|
|
* value is equal to the stored value. */
|
|
|
|
template <typename _Type>
|
|
|
|
class _Equal_to
|
|
|
|
{
|
|
|
|
_Type __value;
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit _Equal_to(const _Type& __v) : __value(__v) { }
|
|
|
|
|
|
|
|
bool
|
|
|
|
operator()(const _Type& __x) const
|
|
|
|
{ return __value == __x; }
|
|
|
|
};
|
|
|
|
|
2003-11-11 21:09:16 +01:00
|
|
|
/** 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>
|
|
|
|
class _After_nth_from
|
|
|
|
{
|
|
|
|
typedef typename std::iterator_traits<_Iterator>::difference_type
|
|
|
|
difference_type;
|
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 21:09:16 +01:00
|
|
|
_Iterator _M_base;
|
|
|
|
difference_type _M_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
|
|
|
|
2003-11-11 21:09:16 +01:00
|
|
|
public:
|
|
|
|
_After_nth_from(const difference_type& __n, const _Iterator& __base)
|
|
|
|
: _M_base(__base), _M_n(__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
|
|
|
|
|
|
|
bool
|
2003-11-11 21:09:16 +01:00
|
|
|
operator()(const _Iterator& __x) const
|
|
|
|
{ return __x - _M_base >= _M_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
|
|
|
|
2003-11-11 21:09:16 +01:00
|
|
|
/**
|
2010-02-04 19:20:34 +01:00
|
|
|
* @brief Base class for constructing a @a safe sequence type that
|
2003-11-11 21:09:16 +01:00
|
|
|
* tracks iterators that reference it.
|
|
|
|
*
|
|
|
|
* The class template %_Safe_sequence simplifies the construction of
|
2010-02-04 19:20:34 +01:00
|
|
|
* @a safe sequences that track the iterators that reference the
|
2003-11-11 21:09:16 +01:00
|
|
|
* sequence, so that the iterators are notified of changes in the
|
|
|
|
* sequence that may affect their operation, e.g., if the container
|
|
|
|
* invalidates its iterators or is destructed. This class template
|
|
|
|
* may only be used by deriving from it and passing the name of the
|
|
|
|
* derived class as its template parameter via the curiously
|
|
|
|
* recurring template pattern. The derived class must have @c
|
2011-08-07 09:27:06 +02:00
|
|
|
* iterator and @c const_iterator types that are instantiations of
|
2003-11-11 21:09:16 +01:00
|
|
|
* class template _Safe_iterator for this sequence. Iterators will
|
|
|
|
* then be tracked automatically.
|
|
|
|
*/
|
|
|
|
template<typename _Sequence>
|
|
|
|
class _Safe_sequence : public _Safe_sequence_base
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/** Invalidates all iterators @c x that reference this sequence,
|
2011-08-07 09:27:06 +02:00
|
|
|
are not singular, and for which @c __pred(x) returns @c
|
|
|
|
true. @c __pred will be invoked with the normal iterators nested
|
debug.cc: Introduce a mutex pool in get_safe_base_mutex.
2010-11-25 François Dumont <francois.cppdevs@free.fr>
* src/debug.cc: Introduce a mutex pool in get_safe_base_mutex.
Move code used to manipulate sequence safe iterators from safe
iterator methods to safe sequence ones. Remove usage of safe iterator
mutex, keep _Safe_iterator_base::_M_get_mutex for library backward
binary compatibility.
* src/Makefile.am: Build debug.cc in gnu++0x mode for _Hash_impl usage.
* src/Makefile.in: Regenerate
* include/debug/safe_base.h: Add _Safe_iterator_base _M_invalidate
and _M_reset. Add _Safe_sequence_base _M_attach, _M_attach_single,
_M_detach and _M_detach_single.
* include/debug.safe_iterator.h, safe_iterator.tcc: Remove
_Safe_iterator _M_invalidate and _M_invalidate_single. Implement all
methods in terms of normal iterators rather than safe ones.
* include/debug/safe_sequence.h: Replace _Safe_sequence
_M_transfe_iter with _M_transfer_from_if taking the source sequence
and a predicate signaling when a safe iterator shall be transfered.
Add _Equal_to predicate.
* include/debug/safe_sequence.tcc: New.
* include/Makefile.am: Adjust.
* include/Makefile.in: Regenerate.
* include/debug/forward_list: Swap safe iterators in move constructor.
Do not invalidate before begin in _M_invalidate_all method.
Reimplement safe methods using normal iterators rather than safe ones.
* include/debug/set.h, unordered_map, multiset.h, vector,
unordered_set, deque, map.h, list, multimap.h: Reimplement safe method
using normal iterators rather than safe ones.
* testsuite/23_containers/forward_list/debug/clear.cc, swap.cc,
move_constructor.cc, splice_after.cc, splice_after1.cc,
splice_after2.cc, splice_after3.cc, splice_after4.cc: New.
* testsuite/23_containers/vector/debug/multithreaded_swap.cc: New.
From-SVN: r167152
2010-11-25 21:53:39 +01:00
|
|
|
in the safe ones. */
|
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
|
|
|
template<typename _Predicate>
|
2014-05-06 21:59:44 +02:00
|
|
|
void
|
|
|
|
_M_invalidate_if(_Predicate __pred);
|
2003-11-11 21:09:16 +01:00
|
|
|
|
debug.cc: Introduce a mutex pool in get_safe_base_mutex.
2010-11-25 François Dumont <francois.cppdevs@free.fr>
* src/debug.cc: Introduce a mutex pool in get_safe_base_mutex.
Move code used to manipulate sequence safe iterators from safe
iterator methods to safe sequence ones. Remove usage of safe iterator
mutex, keep _Safe_iterator_base::_M_get_mutex for library backward
binary compatibility.
* src/Makefile.am: Build debug.cc in gnu++0x mode for _Hash_impl usage.
* src/Makefile.in: Regenerate
* include/debug/safe_base.h: Add _Safe_iterator_base _M_invalidate
and _M_reset. Add _Safe_sequence_base _M_attach, _M_attach_single,
_M_detach and _M_detach_single.
* include/debug.safe_iterator.h, safe_iterator.tcc: Remove
_Safe_iterator _M_invalidate and _M_invalidate_single. Implement all
methods in terms of normal iterators rather than safe ones.
* include/debug/safe_sequence.h: Replace _Safe_sequence
_M_transfe_iter with _M_transfer_from_if taking the source sequence
and a predicate signaling when a safe iterator shall be transfered.
Add _Equal_to predicate.
* include/debug/safe_sequence.tcc: New.
* include/Makefile.am: Adjust.
* include/Makefile.in: Regenerate.
* include/debug/forward_list: Swap safe iterators in move constructor.
Do not invalidate before begin in _M_invalidate_all method.
Reimplement safe methods using normal iterators rather than safe ones.
* include/debug/set.h, unordered_map, multiset.h, vector,
unordered_set, deque, map.h, list, multimap.h: Reimplement safe method
using normal iterators rather than safe ones.
* testsuite/23_containers/forward_list/debug/clear.cc, swap.cc,
move_constructor.cc, splice_after.cc, splice_after1.cc,
splice_after2.cc, splice_after3.cc, splice_after4.cc: New.
* testsuite/23_containers/vector/debug/multithreaded_swap.cc: New.
From-SVN: r167152
2010-11-25 21:53:39 +01:00
|
|
|
/** Transfers all iterators @c x that reference @c from sequence,
|
2011-08-07 09:27:06 +02:00
|
|
|
are not singular, and for which @c __pred(x) returns @c
|
|
|
|
true. @c __pred will be invoked with the normal iterators nested
|
debug.cc: Introduce a mutex pool in get_safe_base_mutex.
2010-11-25 François Dumont <francois.cppdevs@free.fr>
* src/debug.cc: Introduce a mutex pool in get_safe_base_mutex.
Move code used to manipulate sequence safe iterators from safe
iterator methods to safe sequence ones. Remove usage of safe iterator
mutex, keep _Safe_iterator_base::_M_get_mutex for library backward
binary compatibility.
* src/Makefile.am: Build debug.cc in gnu++0x mode for _Hash_impl usage.
* src/Makefile.in: Regenerate
* include/debug/safe_base.h: Add _Safe_iterator_base _M_invalidate
and _M_reset. Add _Safe_sequence_base _M_attach, _M_attach_single,
_M_detach and _M_detach_single.
* include/debug.safe_iterator.h, safe_iterator.tcc: Remove
_Safe_iterator _M_invalidate and _M_invalidate_single. Implement all
methods in terms of normal iterators rather than safe ones.
* include/debug/safe_sequence.h: Replace _Safe_sequence
_M_transfe_iter with _M_transfer_from_if taking the source sequence
and a predicate signaling when a safe iterator shall be transfered.
Add _Equal_to predicate.
* include/debug/safe_sequence.tcc: New.
* include/Makefile.am: Adjust.
* include/Makefile.in: Regenerate.
* include/debug/forward_list: Swap safe iterators in move constructor.
Do not invalidate before begin in _M_invalidate_all method.
Reimplement safe methods using normal iterators rather than safe ones.
* include/debug/set.h, unordered_map, multiset.h, vector,
unordered_set, deque, map.h, list, multimap.h: Reimplement safe method
using normal iterators rather than safe ones.
* testsuite/23_containers/forward_list/debug/clear.cc, swap.cc,
move_constructor.cc, splice_after.cc, splice_after1.cc,
splice_after2.cc, splice_after3.cc, splice_after4.cc: New.
* testsuite/23_containers/vector/debug/multithreaded_swap.cc: New.
From-SVN: r167152
2010-11-25 21:53:39 +01:00
|
|
|
in the safe ones. */
|
|
|
|
template<typename _Predicate>
|
2014-05-06 21:59:44 +02:00
|
|
|
void
|
|
|
|
_M_transfer_from_if(_Safe_sequence& __from, _Predicate __pred);
|
2003-11-11 21:09:16 +01:00
|
|
|
};
|
2014-05-06 21:59:44 +02:00
|
|
|
|
|
|
|
/// Like _Safe_sequence but with a special _M_invalidate_all implementation
|
|
|
|
/// not invalidating past-the-end iterators. Used by node based sequence.
|
|
|
|
template<typename _Sequence>
|
|
|
|
class _Safe_node_sequence
|
|
|
|
: public _Safe_sequence<_Sequence>
|
|
|
|
{
|
|
|
|
protected:
|
|
|
|
void
|
|
|
|
_M_invalidate_all()
|
|
|
|
{
|
|
|
|
typedef typename _Sequence::const_iterator _Const_iterator;
|
|
|
|
typedef typename _Const_iterator::iterator_type _Base_const_iterator;
|
|
|
|
typedef __gnu_debug::_Not_equal_to<_Base_const_iterator> _Not_equal;
|
|
|
|
const _Sequence& __seq = *static_cast<_Sequence*>(this);
|
|
|
|
this->_M_invalidate_if(_Not_equal(__seq._M_base().end()));
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2003-11-11 21:09:16 +01:00
|
|
|
} // namespace __gnu_debug
|
|
|
|
|
2011-01-21 20:41:13 +01:00
|
|
|
#include <debug/safe_sequence.tcc>
|
debug.cc: Introduce a mutex pool in get_safe_base_mutex.
2010-11-25 François Dumont <francois.cppdevs@free.fr>
* src/debug.cc: Introduce a mutex pool in get_safe_base_mutex.
Move code used to manipulate sequence safe iterators from safe
iterator methods to safe sequence ones. Remove usage of safe iterator
mutex, keep _Safe_iterator_base::_M_get_mutex for library backward
binary compatibility.
* src/Makefile.am: Build debug.cc in gnu++0x mode for _Hash_impl usage.
* src/Makefile.in: Regenerate
* include/debug/safe_base.h: Add _Safe_iterator_base _M_invalidate
and _M_reset. Add _Safe_sequence_base _M_attach, _M_attach_single,
_M_detach and _M_detach_single.
* include/debug.safe_iterator.h, safe_iterator.tcc: Remove
_Safe_iterator _M_invalidate and _M_invalidate_single. Implement all
methods in terms of normal iterators rather than safe ones.
* include/debug/safe_sequence.h: Replace _Safe_sequence
_M_transfe_iter with _M_transfer_from_if taking the source sequence
and a predicate signaling when a safe iterator shall be transfered.
Add _Equal_to predicate.
* include/debug/safe_sequence.tcc: New.
* include/Makefile.am: Adjust.
* include/Makefile.in: Regenerate.
* include/debug/forward_list: Swap safe iterators in move constructor.
Do not invalidate before begin in _M_invalidate_all method.
Reimplement safe methods using normal iterators rather than safe ones.
* include/debug/set.h, unordered_map, multiset.h, vector,
unordered_set, deque, map.h, list, multimap.h: Reimplement safe method
using normal iterators rather than safe ones.
* testsuite/23_containers/forward_list/debug/clear.cc, swap.cc,
move_constructor.cc, splice_after.cc, splice_after1.cc,
splice_after2.cc, splice_after3.cc, splice_after4.cc: New.
* testsuite/23_containers/vector/debug/multithreaded_swap.cc: New.
From-SVN: r167152
2010-11-25 21:53:39 +01: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
|
|
|
#endif
|