__gnu_debug::Safe_sequence< Sequence > Class Template Reference

Base class for constructing a "safe" sequence type that tracks iterators that reference it. More...

#include <safe_sequence.h>

Inheritance diagram for __gnu_debug::Safe_sequence< Sequence >:

Inheritance graph
[legend]
Collaboration diagram for __gnu_debug::Safe_sequence< Sequence >:

Collaboration graph
[legend]
List of all members.

Public Member Functions

template<typename Predicate>
void M_invalidate_if (Predicate pred)
template<typename Iterator>
void M_transfer_iter (const Safe_iterator< Iterator, Sequence > &x)
void M_invalidate_all () const

Public Attributes

Safe_iterator_baseM_iterators
 The list of mutable iterators that reference this container.
Safe_iterator_baseM_const_iterators
 The list of constant iterators that reference this container.
unsigned int M_version
 The container version number. This number may never be 0.

Protected Member Functions

void M_detach_all ()
void M_detach_singular ()
void M_revalidate_singular ()
void M_swap (Safe_sequence_base &x)

Detailed Description

template<typename Sequence>
class __gnu_debug::Safe_sequence< Sequence >

Base class for constructing a "safe" sequence type that tracks iterators that reference it.

The class template Safe_sequence simplifies the construction of "safe" 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 iterator and types that are instantiations of class template Safe_iterator for this sequence. Iterators will then be tracked automatically.

Definition at line 96 of file safe_sequence.h.


Member Function Documentation

void __gnu_debug::Safe_sequence_base::M_detach_all  )  [protected, inherited]
 

Detach all iterators, leaving them singular.

Definition at line 114 of file debug.cc.

void __gnu_debug::Safe_sequence_base::M_detach_singular  )  [protected, inherited]
 

Detach all singular iterators.

Postcondition:
for all iterators i attached to this sequence, i->M_version == M_version.

Definition at line 133 of file debug.cc.

void __gnu_debug::Safe_sequence_base::M_invalidate_all  )  const [inline, inherited]
 

Invalidates all iterators.

Definition at line 202 of file safe_base.h.

template<typename Sequence>
template<typename Predicate>
void __gnu_debug::Safe_sequence< Sequence >::M_invalidate_if Predicate  pred  ) 
 

Invalidates all iterators x that reference this sequence, are not singular, and for which pred(x) returns true. The user of this routine should be careful not to make copies of the iterators passed to pred, as the copies may interfere with the invalidation.

Definition at line 120 of file safe_sequence.h.

void __gnu_debug::Safe_sequence_base::M_revalidate_singular  )  [protected, inherited]
 

Revalidates all attached singular iterators. This method may be used to validate iterators that were invalidated before (but for some reasion, such as an exception, need to become valid again).

Definition at line 154 of file debug.cc.

void __gnu_debug::Safe_sequence_base::M_swap Safe_sequence_base x  )  [protected, inherited]
 

Swap this sequence with the given sequence. This operation also swaps ownership of the iterators, so that when the operation is complete all iterators that originally referenced one container now reference the other container.

Definition at line 172 of file debug.cc.

References std::swap().

template<typename Sequence>
template<typename Iterator>
void __gnu_debug::Safe_sequence< Sequence >::M_transfer_iter const Safe_iterator< Iterator, Sequence > &  x  ) 
 

Transfers all iterators that reference this memory location to this sequence from whatever sequence they are attached to.

Definition at line 152 of file safe_sequence.h.


Member Data Documentation

Safe_iterator_base* __gnu_debug::Safe_sequence_base::M_const_iterators [inherited]
 

The list of constant iterators that reference this container.

Definition at line 156 of file safe_base.h.

Safe_iterator_base* __gnu_debug::Safe_sequence_base::M_iterators [inherited]
 

The list of mutable iterators that reference this container.

Definition at line 153 of file safe_base.h.

unsigned int __gnu_debug::Safe_sequence_base::M_version [mutable, inherited]
 

The container version number. This number may never be 0.

Definition at line 159 of file safe_base.h.


The documentation for this class was generated from the following file:
Generated on Fri May 6 01:12:29 2005 for libstdc++-v3 Source by  doxygen 1.4.2