Attached patch applied:
2011-07-21 François Dumont <francois.cppd...@free.fr>
* include/debug/safe_unordered_sequence.h,
safe_unordered_sequence.tcc: Rename respectively in...
* include/debug/safe_unordered_container.h,
safe_unordered_container.tcc: ...those. _Safe_unordered_sequence
rename _Safe_unordered_container.
* include/debug/safe_unordered_base.h:
_Safe_unordered_sequence_base
rename _Safe_unordered_container_base.
* include/debug/unordered_map, unordered_set: Adapt to previous
modifications.
* config/abi/pre/gnu.ver: Likewise.
* src/debug.cc: Likewise.
* include/Makefile.am: Likewise.
* include/Makefile.in: Regenerate.
Regards
On 07/21/2011 12:58 AM, Jonathan Wakely wrote:
On 20 July 2011 22:40, Paolo Carlini<paolo.carl...@oracle.com> wrote:
On 07/20/2011 10:46 PM, François Dumont wrote:
Hello
Sorry for the inconvenience. Here is my proposition for the renaming, I
I should probably apologise for the inconvenience for suggesting
changing it! I do think it is a bit confusing though, the "Sequence"
containers in the standard library have a definite ordering, so an
unordered sequence is confusing :)
haven't tested it yet but will of course before commiting.
I'm Ok with it if Jonathan is...
Yes, thanks for changing it.
Thanks,
Paolo.
PS: my first language obviously isn't English, but I see you are using
<proposition> a lot where I would normally prefer<proposal>...
Yes, proposal would be correct there.
Index: src/debug.cc
===================================================================
--- src/debug.cc (revision 176533)
+++ src/debug.cc (working copy)
@@ -25,7 +25,7 @@
#include <debug/debug.h>
#include <debug/safe_sequence.h>
-#include <debug/safe_unordered_sequence.h>
+#include <debug/safe_unordered_container.h>
#include <debug/safe_iterator.h>
#include <debug/safe_local_iterator.h>
#include <algorithm>
@@ -78,8 +78,8 @@
}
void
- swap_useq(__gnu_debug::_Safe_unordered_sequence_base& __lhs,
- __gnu_debug::_Safe_unordered_sequence_base& __rhs)
+ swap_ucont(__gnu_debug::_Safe_unordered_container_base& __lhs,
+ __gnu_debug::_Safe_unordered_container_base& __rhs)
{
swap_seq(__lhs, __rhs);
swap_its(__lhs, __lhs._M_local_iterators,
@@ -174,8 +174,8 @@
" by a dereferenceable one",
"function requires a valid iterator range (%2.name;, %3.name;)"
", \"%2.name;\" shall be before and not equal to \"%3.name;\"",
- // std::unordered_sequence::local_iterator
- "attempt to compare local iterators from different unordered sequence"
+ // std::unordered_container::local_iterator
+ "attempt to compare local iterators from different unordered container"
" buckets"
};
@@ -374,38 +374,38 @@
_M_get_mutex() throw ()
{ return get_safe_base_mutex(_M_sequence); }
- _Safe_unordered_sequence_base*
+ _Safe_unordered_container_base*
_Safe_local_iterator_base::
- _M_get_sequence() const _GLIBCXX_NOEXCEPT
- { return static_cast<_Safe_unordered_sequence_base*>(_M_sequence); }
+ _M_get_container() const _GLIBCXX_NOEXCEPT
+ { return static_cast<_Safe_unordered_container_base*>(_M_sequence); }
void
_Safe_local_iterator_base::
- _M_attach(_Safe_sequence_base* __seq, bool __constant)
+ _M_attach(_Safe_sequence_base* __cont, bool __constant)
{
_M_detach();
- // Attach to the new sequence (if there is one)
- if (__seq)
+ // Attach to the new container (if there is one)
+ if (__cont)
{
- _M_sequence = __seq;
+ _M_sequence = __cont;
_M_version = _M_sequence->_M_version;
- _M_get_sequence()->_M_attach_local(this, __constant);
+ _M_get_container()->_M_attach_local(this, __constant);
}
}
void
_Safe_local_iterator_base::
- _M_attach_single(_Safe_sequence_base* __seq, bool __constant) throw ()
+ _M_attach_single(_Safe_sequence_base* __cont, bool __constant) throw ()
{
_M_detach_single();
- // Attach to the new sequence (if there is one)
- if (__seq)
+ // Attach to the new container (if there is one)
+ if (__cont)
{
- _M_sequence = __seq;
+ _M_sequence = __cont;
_M_version = _M_sequence->_M_version;
- _M_get_sequence()->_M_attach_local_single(this, __constant);
+ _M_get_container()->_M_attach_local_single(this, __constant);
}
}
@@ -414,7 +414,7 @@
_M_detach()
{
if (_M_sequence)
- _M_get_sequence()->_M_detach_local(this);
+ _M_get_container()->_M_detach_local(this);
_M_reset();
}
@@ -424,13 +424,13 @@
_M_detach_single() throw ()
{
if (_M_sequence)
- _M_get_sequence()->_M_detach_local_single(this);
+ _M_get_container()->_M_detach_local_single(this);
_M_reset();
}
void
- _Safe_unordered_sequence_base::
+ _Safe_unordered_container_base::
_M_detach_all()
{
__gnu_cxx::__scoped_lock sentry(_M_get_mutex());
@@ -448,17 +448,17 @@
}
void
- _Safe_unordered_sequence_base::
- _M_swap(_Safe_unordered_sequence_base& __x)
+ _Safe_unordered_container_base::
+ _M_swap(_Safe_unordered_container_base& __x)
{
- // We need to lock both sequences to swap
+ // We need to lock both containers to swap
using namespace __gnu_cxx;
__mutex *__this_mutex = &_M_get_mutex();
__mutex *__x_mutex = &__x._M_get_mutex();
if (__this_mutex == __x_mutex)
{
__scoped_lock __lock(*__this_mutex);
- swap_useq(*this, __x);
+ swap_ucont(*this, __x);
}
else
{
@@ -466,12 +466,12 @@
? *__this_mutex : *__x_mutex);
__scoped_lock __l2(__this_mutex < __x_mutex
? *__x_mutex : *__this_mutex);
- swap_useq(*this, __x);
+ swap_ucont(*this, __x);
}
}
void
- _Safe_unordered_sequence_base::
+ _Safe_unordered_container_base::
_M_attach_local(_Safe_iterator_base* __it, bool __constant)
{
__gnu_cxx::__scoped_lock sentry(_M_get_mutex());
@@ -479,7 +479,7 @@
}
void
- _Safe_unordered_sequence_base::
+ _Safe_unordered_container_base::
_M_attach_local_single(_Safe_iterator_base* __it, bool __constant) throw ()
{
_Safe_iterator_base*& __its =
@@ -491,19 +491,19 @@
}
void
- _Safe_unordered_sequence_base::
+ _Safe_unordered_container_base::
_M_detach_local(_Safe_iterator_base* __it)
{
- // Remove __it from this sequence's list
+ // Remove __it from this container's list
__gnu_cxx::__scoped_lock sentry(_M_get_mutex());
_M_detach_local_single(__it);
}
void
- _Safe_unordered_sequence_base::
+ _Safe_unordered_container_base::
_M_detach_local_single(_Safe_iterator_base* __it) throw ()
{
- // Remove __it from this sequence's list
+ // Remove __it from this container's list
__it->_M_unlink();
if (_M_const_local_iterators == __it)
_M_const_local_iterators = __it->_M_next;
Index: include/Makefile.in
===================================================================
--- include/Makefile.in (revision 176533)
+++ include/Makefile.in (working copy)
@@ -951,8 +951,8 @@
${debug_srcdir}/safe_sequence.h \
${debug_srcdir}/safe_sequence.tcc \
${debug_srcdir}/safe_unordered_base.h \
- ${debug_srcdir}/safe_unordered_sequence.h \
- ${debug_srcdir}/safe_unordered_sequence.tcc \
+ ${debug_srcdir}/safe_unordered_container.h \
+ ${debug_srcdir}/safe_unordered_container.tcc \
${debug_srcdir}/set \
${debug_srcdir}/set.h \
${debug_srcdir}/string \
Index: include/debug/unordered_map
===================================================================
--- include/debug/unordered_map (revision 176533)
+++ include/debug/unordered_map (working copy)
@@ -35,7 +35,7 @@
#else
# include <unordered_map>
-#include <debug/safe_unordered_sequence.h>
+#include <debug/safe_unordered_container.h>
#include <debug/safe_iterator.h>
#include <debug/safe_local_iterator.h>
@@ -50,12 +50,12 @@
typename _Alloc = std::allocator<_Key> >
class unordered_map
: public _GLIBCXX_STD_C::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>,
- public __gnu_debug::_Safe_unordered_sequence<unordered_map<_Key, _Tp,
+ public __gnu_debug::_Safe_unordered_container<unordered_map<_Key, _Tp,
_Hash, _Pred, _Alloc> >
{
typedef _GLIBCXX_STD_C::unordered_map<_Key, _Tp, _Hash,
_Pred, _Alloc> _Base;
- typedef __gnu_debug::_Safe_unordered_sequence<unordered_map> _Safe_base;
+ typedef __gnu_debug::_Safe_unordered_container<unordered_map> _Safe_base;
typedef typename _Base::const_iterator _Base_const_iterator;
typedef typename _Base::iterator _Base_iterator;
typedef typename _Base::const_local_iterator _Base_const_local_iterator;
@@ -430,12 +430,12 @@
class unordered_multimap
: public _GLIBCXX_STD_C::unordered_multimap<_Key, _Tp, _Hash,
_Pred, _Alloc>,
- public __gnu_debug::_Safe_unordered_sequence<unordered_multimap<_Key,
+ public __gnu_debug::_Safe_unordered_container<unordered_multimap<_Key,
_Tp, _Hash, _Pred, _Alloc> >
{
typedef _GLIBCXX_STD_C::unordered_multimap<_Key, _Tp, _Hash,
_Pred, _Alloc> _Base;
- typedef __gnu_debug::_Safe_unordered_sequence<unordered_multimap>
+ typedef __gnu_debug::_Safe_unordered_container<unordered_multimap>
_Safe_base;
typedef typename _Base::const_iterator _Base_const_iterator;
typedef typename _Base::iterator _Base_iterator;
Index: include/debug/safe_unordered_sequence.tcc
===================================================================
--- include/debug/safe_unordered_sequence.tcc (revision 176533)
+++ include/debug/safe_unordered_sequence.tcc (working copy)
@@ -1,100 +0,0 @@
-// Safe sequence implementation -*- C++ -*-
-
-// Copyright (C) 2011 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
-// Free Software Foundation; either version 3, or (at your option)
-// 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.
-
-// 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.
-
-// 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/>.
-
-/** @file debug/safe_unordered_sequence.tcc
- * This file is a GNU debug extension to the Standard C++ Library.
- */
-
-#ifndef _GLIBCXX_DEBUG_SAFE_UNORDERED_SEQUENCE_TCC
-#define _GLIBCXX_DEBUG_SAFE_UNORDERED_SEQUENCE_TCC 1
-
-namespace __gnu_debug
-{
- template<typename _Sequence>
- template<typename _Predicate>
- void
- _Safe_unordered_sequence<_Sequence>::
- _M_invalidate_if(_Predicate __pred)
- {
- typedef typename _Sequence::iterator iterator;
- typedef typename _Sequence::const_iterator const_iterator;
-
- __gnu_cxx::__scoped_lock sentry(this->_M_get_mutex());
- for (_Safe_iterator_base* __iter = _M_iterators; __iter;)
- {
- iterator* __victim = static_cast<iterator*>(__iter);
- __iter = __iter->_M_next;
- if (!__victim->_M_singular() && __pred(__victim->base()))
- {
- __victim->_M_invalidate();
- }
- }
-
- for (_Safe_iterator_base* __iter2 = _M_const_iterators; __iter2;)
- {
- const_iterator* __victim = static_cast<const_iterator*>(__iter2);
- __iter2 = __iter2->_M_next;
- if (!__victim->_M_singular() && __pred(__victim->base()))
- {
- __victim->_M_invalidate();
- }
- }
- }
-
-
- template<typename _Sequence>
- template<typename _Predicate>
- void
- _Safe_unordered_sequence<_Sequence>::
- _M_invalidate_local_if(_Predicate __pred)
- {
- typedef typename _Sequence::local_iterator local_iterator;
- typedef typename _Sequence::const_local_iterator const_local_iterator;
-
- __gnu_cxx::__scoped_lock sentry(this->_M_get_mutex());
- for (_Safe_iterator_base* __iter = _M_local_iterators; __iter;)
- {
- local_iterator* __victim = static_cast<local_iterator*>(__iter);
- __iter = __iter->_M_next;
- if (!__victim->_M_singular() && __pred(__victim->base()))
- {
- __victim->_M_invalidate();
- }
- }
-
- for (_Safe_iterator_base* __iter2 = _M_const_local_iterators; __iter2;)
- {
- const_local_iterator* __victim =
- static_cast<const_local_iterator*>(__iter2);
- __iter2 = __iter2->_M_next;
- if (!__victim->_M_singular() && __pred(__victim->base()))
- {
- __victim->_M_invalidate();
- }
- }
- }
-
-} // namespace __gnu_debug
-
-#endif
Index: include/debug/safe_unordered_container.tcc
===================================================================
--- include/debug/safe_unordered_container.tcc (revision 176486)
+++ include/debug/safe_unordered_container.tcc (working copy)
@@ -1,4 +1,4 @@
-// Safe sequence implementation -*- C++ -*-
+// Safe container implementation -*- C++ -*-
// Copyright (C) 2011 Free Software Foundation, Inc.
//
@@ -22,23 +22,23 @@
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
-/** @file debug/safe_unordered_sequence.tcc
+/** @file debug/safe_unordered_container.tcc
* This file is a GNU debug extension to the Standard C++ Library.
*/
-#ifndef _GLIBCXX_DEBUG_SAFE_UNORDERED_SEQUENCE_TCC
-#define _GLIBCXX_DEBUG_SAFE_UNORDERED_SEQUENCE_TCC 1
+#ifndef _GLIBCXX_DEBUG_SAFE_UNORDERED_CONTAINER_TCC
+#define _GLIBCXX_DEBUG_SAFE_UNORDERED_CONTAINER_TCC 1
namespace __gnu_debug
{
- template<typename _Sequence>
+ template<typename _Container>
template<typename _Predicate>
void
- _Safe_unordered_sequence<_Sequence>::
+ _Safe_unordered_container<_Container>::
_M_invalidate_if(_Predicate __pred)
{
- typedef typename _Sequence::iterator iterator;
- typedef typename _Sequence::const_iterator const_iterator;
+ typedef typename _Container::iterator iterator;
+ typedef typename _Container::const_iterator const_iterator;
__gnu_cxx::__scoped_lock sentry(this->_M_get_mutex());
for (_Safe_iterator_base* __iter = _M_iterators; __iter;)
@@ -63,14 +63,14 @@
}
- template<typename _Sequence>
+ template<typename _Container>
template<typename _Predicate>
void
- _Safe_unordered_sequence<_Sequence>::
+ _Safe_unordered_container<_Container>::
_M_invalidate_local_if(_Predicate __pred)
{
- typedef typename _Sequence::local_iterator local_iterator;
- typedef typename _Sequence::const_local_iterator const_local_iterator;
+ typedef typename _Container::local_iterator local_iterator;
+ typedef typename _Container::const_local_iterator const_local_iterator;
__gnu_cxx::__scoped_lock sentry(this->_M_get_mutex());
for (_Safe_iterator_base* __iter = _M_local_iterators; __iter;)
Index: include/debug/unordered_set
===================================================================
--- include/debug/unordered_set (revision 176533)
+++ include/debug/unordered_set (working copy)
@@ -35,7 +35,7 @@
#else
# include <unordered_set>
-#include <debug/safe_unordered_sequence.h>
+#include <debug/safe_unordered_container.h>
#include <debug/safe_iterator.h>
#include <debug/safe_local_iterator.h>
@@ -50,12 +50,12 @@
typename _Alloc = std::allocator<_Value> >
class unordered_set
: public _GLIBCXX_STD_C::unordered_set<_Value, _Hash, _Pred, _Alloc>,
- public __gnu_debug::_Safe_unordered_sequence<unordered_set<_Value, _Hash,
+ public __gnu_debug::_Safe_unordered_container<unordered_set<_Value, _Hash,
_Pred, _Alloc> >
{
typedef _GLIBCXX_STD_C::unordered_set<_Value, _Hash,
_Pred, _Alloc> _Base;
- typedef __gnu_debug::_Safe_unordered_sequence<unordered_set> _Safe_base;
+ typedef __gnu_debug::_Safe_unordered_container<unordered_set> _Safe_base;
typedef typename _Base::const_iterator _Base_const_iterator;
typedef typename _Base::iterator _Base_iterator;
typedef typename _Base::const_local_iterator _Base_const_local_iterator;
@@ -425,12 +425,12 @@
typename _Alloc = std::allocator<_Value> >
class unordered_multiset
: public _GLIBCXX_STD_C::unordered_multiset<_Value, _Hash, _Pred, _Alloc>,
- public __gnu_debug::_Safe_unordered_sequence<
+ public __gnu_debug::_Safe_unordered_container<
unordered_multiset<_Value, _Hash, _Pred, _Alloc> >
{
typedef _GLIBCXX_STD_C::unordered_multiset<_Value, _Hash,
_Pred, _Alloc> _Base;
- typedef __gnu_debug::_Safe_unordered_sequence<unordered_multiset>
+ typedef __gnu_debug::_Safe_unordered_container<unordered_multiset>
_Safe_base;
typedef typename _Base::const_iterator _Base_const_iterator;
typedef typename _Base::iterator _Base_iterator;
Index: include/debug/safe_unordered_sequence.h
===================================================================
--- include/debug/safe_unordered_sequence.h (revision 176533)
+++ include/debug/safe_unordered_sequence.h (working copy)
@@ -1,75 +0,0 @@
-// Safe sequence implementation -*- C++ -*-
-
-// Copyright (C) 2011 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
-// Free Software Foundation; either version 3, or (at your option)
-// 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.
-
-// 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.
-
-// 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/>.
-
-/** @file debug/safe_unordered_sequence.h
- * This file is a GNU debug extension to the Standard C++ Library.
- */
-
-#ifndef _GLIBCXX_DEBUG_SAFE_UNORDERED_SEQUENCE_H
-#define _GLIBCXX_DEBUG_SAFE_UNORDERED_SEQUENCE_H 1
-
-#include <debug/debug.h>
-#include <debug/macros.h>
-#include <debug/functions.h>
-#include <debug/safe_unordered_base.h>
-
-namespace __gnu_debug
-{
- /**
- * @brief Base class for constructing a @a safe unordered sequence type
- * that tracks iterators that reference it.
- *
- * The class template %_Safe_unordered_sequence simplifies the
- * construction of @a safe unordered sequences that track the iterators
- * that reference the 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
- * iterator and @const_iterator types that are instantiations of
- * class template _Safe_iterator for this sequence. Iterators will
- * then be tracked automatically.
- */
- template<typename _Sequence>
- class _Safe_unordered_sequence : public _Safe_unordered_sequence_base
- {
- public:
- /** Invalidates all iterators @c x that reference this sequence,
- are not singular, and for which @c pred(x) returns @c
- true. @c pred will be invoked with the normal iterators nested
- in the safe ones. */
- template<typename _Predicate>
- void
- _M_invalidate_if(_Predicate __pred);
-
- template<typename _Predicate>
- void
- _M_invalidate_local_if(_Predicate __pred);
- };
-} // namespace __gnu_debug
-
-#include <debug/safe_unordered_sequence.tcc>
-
-#endif
Index: include/debug/safe_unordered_base.h
===================================================================
--- include/debug/safe_unordered_base.h (revision 176533)
+++ include/debug/safe_unordered_base.h (working copy)
@@ -1,4 +1,4 @@
-// Safe sequence/iterator base implementation -*- C++ -*-
+// Safe container/iterator base implementation -*- C++ -*-
// Copyright (C) 2011 Free Software Foundation, Inc.
//
@@ -33,13 +33,13 @@
namespace __gnu_debug
{
- class _Safe_unordered_sequence_base;
+ class _Safe_unordered_container_base;
/** \brief Basic functionality for a @a safe iterator.
*
* The %_Safe_local_iterator_base base class implements the functionality
* of a safe local iterator that is not specific to a particular iterator
- * type. It contains a pointer back to the sequence it references
+ * type. It contains a pointer back to the container it references
* along with iterator version information and pointers to form a
* doubly-linked list of local iterators referenced by the container.
*
@@ -54,7 +54,7 @@
_Safe_local_iterator_base()
{ }
- /** Initialize the iterator to reference the sequence pointed to
+ /** Initialize the iterator to reference the container pointed to
* by @p__seq. @p __constant is true when we are initializing a
* constant local iterator, and false if it is a mutable local iterator.
* Note that @p __seq may be NULL, in which case the iterator will be
@@ -64,7 +64,7 @@
_Safe_local_iterator_base(const _Safe_sequence_base* __seq, bool __constant)
{ this->_M_attach(const_cast<_Safe_sequence_base*>(__seq), __constant); }
- /** Initializes the iterator to reference the same sequence that
+ /** Initializes the iterator to reference the same container that
@p __x does. @p __constant is true if this is a constant
iterator, and false if it is mutable. */
_Safe_local_iterator_base(const _Safe_local_iterator_base& __x,
@@ -79,13 +79,13 @@
~_Safe_local_iterator_base() { this->_M_detach(); }
- _Safe_unordered_sequence_base*
- _M_get_sequence() const _GLIBCXX_NOEXCEPT;
+ _Safe_unordered_container_base*
+ _M_get_container() const _GLIBCXX_NOEXCEPT;
public:
- /** Attaches this iterator to the given sequence, detaching it
- * from whatever sequence it was attached to originally. If the
- * new sequence is the NULL pointer, the iterator is left
+ /** Attaches this iterator to the given container, detaching it
+ * from whatever container it was attached to originally. If the
+ * new container is the NULL pointer, the iterator is left
* unattached.
*/
void _M_attach(_Safe_sequence_base* __seq, bool __constant);
@@ -93,7 +93,7 @@
/** Likewise, but not thread-safe. */
void _M_attach_single(_Safe_sequence_base* __seq, bool __constant) throw ();
- /** Detach the iterator for whatever sequence it is attached to,
+ /** Detach the iterator for whatever container it is attached to,
* if any.
*/
void _M_detach();
@@ -104,23 +104,23 @@
/**
* @brief Base class that supports tracking of local iterators that
- * reference an unordered sequence.
+ * reference an unordered container.
*
- * The %_Safe_unordered_sequence_base class provides basic support for
- * tracking iterators into an unordered sequence. Sequences that track
- * iterators must derived from %_Safe_sequence_base publicly, so
+ * The %_Safe_unordered_container_base class provides basic support for
+ * tracking iterators into an unordered container. Containers that track
+ * iterators must derived from %_Safe_unordered_container_base publicly, so
* that safe iterators (which inherit _Safe_iterator_base) can
* attach to them. This class contains four linked lists of
* iterators, one for constant iterators, one for mutable
* iterators, one for constant local iterators, one for mutable local
- * iterator and a version number that allows very fast
+ * iterators and a version number that allows very fast
* invalidation of all iterators that reference the container.
*
* This class must ensure that no operation on it may throw an
- * exception, otherwise @a safe sequences may fail to provide the
+ * exception, otherwise @a safe containers may fail to provide the
* exception-safety guarantees required by the C++ standard.
*/
- class _Safe_unordered_sequence_base : public _Safe_sequence_base
+ class _Safe_unordered_container_base : public _Safe_sequence_base
{
typedef _Safe_sequence_base _Base;
public:
@@ -132,29 +132,29 @@
protected:
// Initialize with a version number of 1 and no iterators
- _Safe_unordered_sequence_base()
+ _Safe_unordered_container_base()
: _M_local_iterators(0), _M_const_local_iterators(0)
{ }
- /** Notify all iterators that reference this sequence that the
- sequence is being destroyed. */
- ~_Safe_unordered_sequence_base()
+ /** Notify all iterators that reference this container that the
+ container is being destroyed. */
+ ~_Safe_unordered_container_base()
{ this->_M_detach_all(); }
/** Detach all iterators, leaving them singular. */
void
_M_detach_all();
- /** Swap this sequence with the given sequence. This operation
+ /** Swap this container with the given container. This operation
* also swaps ownership of the iterators, so that when the
* operation is complete all iterators that originally referenced
* one container now reference the other container.
*/
void
- _M_swap(_Safe_unordered_sequence_base& __x);
+ _M_swap(_Safe_unordered_container_base& __x);
public:
- /** Attach an iterator to this sequence. */
+ /** Attach an iterator to this container. */
void
_M_attach_local(_Safe_iterator_base* __it, bool __constant);
@@ -162,7 +162,7 @@
void
_M_attach_local_single(_Safe_iterator_base* __it, bool __constant) throw ();
- /** Detach an iterator from this sequence */
+ /** Detach an iterator from this container */
void
_M_detach_local(_Safe_iterator_base* __it);
Index: include/debug/safe_unordered_container.h
===================================================================
--- include/debug/safe_unordered_container.h (revision 176486)
+++ include/debug/safe_unordered_container.h (working copy)
@@ -1,4 +1,4 @@
-// Safe sequence implementation -*- C++ -*-
+// Safe container implementation -*- C++ -*-
// Copyright (C) 2011 Free Software Foundation, Inc.
//
@@ -22,12 +22,12 @@
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
-/** @file debug/safe_unordered_sequence.h
+/** @file debug/safe_unordered_container.h
* This file is a GNU debug extension to the Standard C++ Library.
*/
-#ifndef _GLIBCXX_DEBUG_SAFE_UNORDERED_SEQUENCE_H
-#define _GLIBCXX_DEBUG_SAFE_UNORDERED_SEQUENCE_H 1
+#ifndef _GLIBCXX_DEBUG_SAFE_UNORDERED_CONTAINER_H
+#define _GLIBCXX_DEBUG_SAFE_UNORDERED_CONTAINER_H 1
#include <debug/debug.h>
#include <debug/macros.h>
@@ -37,26 +37,28 @@
namespace __gnu_debug
{
/**
- * @brief Base class for constructing a @a safe unordered sequence type
+ * @brief Base class for constructing a @a safe unordered container type
* that tracks iterators that reference it.
*
- * The class template %_Safe_unordered_sequence simplifies the
- * construction of @a safe unordered sequences that track the iterators
- * that reference the sequence, so that the iterators are notified of
- * changes in the sequence that may affect their operation, e.g., if
+ * The class template %_Safe_unordered_container simplifies the
+ * construction of @a safe unordered containers that track the iterators
+ * that reference the container, so that the iterators are notified of
+ * changes in the container 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
* iterator and @const_iterator types that are instantiations of
- * class template _Safe_iterator for this sequence. Iterators will
+ * class template _Safe_iterator for this container and @c local_iterator
+ * and @const_local_iterator types that are instantiations of class
+ * template _Safe_local_iterator for this container. Iterators will
* then be tracked automatically.
*/
- template<typename _Sequence>
- class _Safe_unordered_sequence : public _Safe_unordered_sequence_base
+ template<typename _Container>
+ class _Safe_unordered_container : public _Safe_unordered_container_base
{
public:
- /** Invalidates all iterators @c x that reference this sequence,
+ /** Invalidates all iterators @c x that reference this container,
are not singular, and for which @c pred(x) returns @c
true. @c pred will be invoked with the normal iterators nested
in the safe ones. */
@@ -64,12 +66,16 @@
void
_M_invalidate_if(_Predicate __pred);
+ /** Invalidates all local iterators @c x that reference this container,
+ are not singular, and for which @c pred(x) returns @c
+ true. @c pred will be invoked with the normal ilocal iterators
+ nested in the safe ones. */
template<typename _Predicate>
void
_M_invalidate_local_if(_Predicate __pred);
};
} // namespace __gnu_debug
-#include <debug/safe_unordered_sequence.tcc>
+#include <debug/safe_unordered_container.tcc>
#endif
Index: include/Makefile.am
===================================================================
--- include/Makefile.am (revision 176533)
+++ include/Makefile.am (working copy)
@@ -706,8 +706,8 @@
${debug_srcdir}/safe_sequence.h \
${debug_srcdir}/safe_sequence.tcc \
${debug_srcdir}/safe_unordered_base.h \
- ${debug_srcdir}/safe_unordered_sequence.h \
- ${debug_srcdir}/safe_unordered_sequence.tcc \
+ ${debug_srcdir}/safe_unordered_container.h \
+ ${debug_srcdir}/safe_unordered_container.tcc \
${debug_srcdir}/set \
${debug_srcdir}/set.h \
${debug_srcdir}/string \
Index: config/abi/pre/gnu.ver
===================================================================
--- config/abi/pre/gnu.ver (revision 176533)
+++ config/abi/pre/gnu.ver (working copy)
@@ -1284,9 +1284,9 @@
# std::thread::hardware_concurrency
_ZNSt6thread20hardware_concurrencyEv;
- # __gnu_debug::_Safe_unordered_sequence_base and _Safe_local_iterator_base
- _ZN11__gnu_debug29_Safe_unordered_sequence_base7_M_swapERS0_;
- _ZN11__gnu_debug29_Safe_unordered_sequence_base13_M_detach_allEv;
+ # __gnu_debug::_Safe_unordered_container_base and _Safe_local_iterator_base
+ _ZN11__gnu_debug30_Safe_unordered_container_base7_M_swapERS0_;
+ _ZN11__gnu_debug30_Safe_unordered_container_base13_M_detach_allEv;
_ZN11__gnu_debug25_Safe_local_iterator_base9_M_attachEPNS_19_Safe_sequence_baseEb;
_ZN11__gnu_debug25_Safe_local_iterator_base9_M_detachEv;
} GLIBCXX_3.4.16;