# __gnu_debug::Safe_sequence_base Class Reference

Base class that supports tracking of iterators that reference a sequence. More...

`#include <safe_base.h>`

Inheritance diagram for __gnu_debug::Safe_sequence_base:

[legend]
Collaboration diagram for __gnu_debug::Safe_sequence_base:

[legend]
List of all members.

## Public Member Functions

void | M_invalidate_all () const

## Public Attributes

Safe_iterator_base * | M_iterators
| The list of mutable iterators that reference this container.
Safe_iterator_base * | M_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

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

## Detailed Description

Base class that supports tracking of iterators that reference a sequence.

The Safe_sequence_base class provides basic support for tracking iterators into a sequence. Sequences that track iterators must derived from Safe_sequence_base publicly, so that safe iterators (which inherit Safe_iterator_base) can attach to them. This class contains two linked lists of iterators, one for constant iterators and one for mutable 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 "safe" sequences may fail to provide the exception-safety guarantees required by the C++ standard.

Definition at line 149 of file safe_base.h.

## Constructor & Destructor Documentation

__gnu_debug::Safe_sequence_base::~Safe_sequence_base | ( |  | ) | `[inline, protected]`

| Notify all iterators that reference this sequence that the sequence is being destroyed. Definition at line 175 of file safe_base.h.

## Member Function Documentation

void __gnu_debug::Safe_sequence_base::M_detach_all | ( |  | ) | `[protected]`

| Detach all iterators, leaving them singular. Definition at line 108 of file debug.cc.

void __gnu_debug::Safe_sequence_base::M_detach_singular | ( |  | ) | `[protected]`

Detach all singular iterators.

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

Definition at line 127 of file debug.cc.

void __gnu_debug::Safe_sequence_base::M_invalidate_all | ( |  | ) | const`[inline]`

| Invalidates all iterators. Definition at line 208 of file safe_base.h.

void __gnu_debug::Safe_sequence_base::M_revalidate_singular | ( |  | ) | `[protected]`

| 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 148 of file debug.cc.

void __gnu_debug::Safe_sequence_base::M_swap | ( | Safe_sequence_base & | x | ) | `[protected]`

| 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 166 of file debug.cc. References std::swap().

## Member Data Documentation

Safe_iterator_base* __gnu_debug::Safe_sequence_base::M_const_iterators

| 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

| 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]`

| 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 files:

- safe_base.h
- debug.cc