---
name: "__gnu_debug::Safe_sequence_base"
section: "3"
platform: "linux"
package: "libstdc++6-doc"
version: "3.4.6-5"
release: "Debian 4.0 (Etch)"
platforms: ["linux"]
url: "https://new.carta.tech/__gnu_debug::Safe_sequence_base"
---

# \_\_gnu\_debug::Safe\_sequence\_base(3)

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

## NAME

\_\_gnu\_debug::Safe\_sequence\_base - Base class that supports tracking of iterators that reference a sequence.

## SYNOPSIS

`#include <safe_base.h>`

Inherited by **\_\_gnu\_debug::Safe\_sequence\< Sequence \>**, **\_\_gnu\_debug::Safe\_sequence\< \_\_gnu\_debug::basic\_string\< CharT, Traits, Allocator \> \>**, **\_\_gnu\_debug::Safe\_sequence\< \_\_gnu\_debug\_def::deque\< Type, Allocator \> \>**, **\_\_gnu\_debug::Safe\_sequence\< \_\_gnu\_debug\_def::hash\_map\< Value, Type, HashFcn, EqualKey, Alloc \> \>**, **\_\_gnu\_debug::Safe\_sequence\< \_\_gnu\_debug\_def::hash\_multimap\< Value, Type, HashFcn, EqualKey, Alloc \> \>**, **\_\_gnu\_debug::Safe\_sequence\< \_\_gnu\_debug\_def::hash\_multiset\< Value, HashFcn, EqualKey, Alloc \> \>**, **\_\_gnu\_debug::Safe\_sequence\< \_\_gnu\_debug\_def::hash\_set\< Value, HashFcn, EqualKey, Alloc \> \>**, **\_\_gnu\_debug::Safe\_sequence\< \_\_gnu\_debug\_def::list\< Type, Allocator \> \>**, **\_\_gnu\_debug::Safe\_sequence\< \_\_gnu\_debug\_def::map\< Key, Type, Compare, Allocator \> \>**, **\_\_gnu\_debug::Safe\_sequence\< \_\_gnu\_debug\_def::multimap\< Key, Type, Compare, Allocator \> \>**, **\_\_gnu\_debug::Safe\_sequence\< \_\_gnu\_debug\_def::multiset\< Key, Compare, Allocator \> \>**, **\_\_gnu\_debug::Safe\_sequence\< \_\_gnu\_debug\_def::set\< Key, Compare, Allocator \> \>**, **\_\_gnu\_debug::Safe\_sequence\< \_\_gnu\_debug\_def::vector\< Type, Allocator \> \>**, and **\_\_gnu\_debug\_def::bitset\< Nb \>**.

### 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** ()\
 **~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 169 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 114 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 133 of file debug.cc.

### 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 154 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 172 of file debug.cc.

References \_\_gnu\_debug::swap().

### void \_\_gnu\_debug::Safe\_sequence\_base::M\_invalidate\_all () const` [inline]`

Invalidates all iterators.

Definition at line 202 of file safe\_base.h.

## Member Data Documentation

### 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.

### 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.

### 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.

## Author

Generated automatically by Doxygen for libstdc++-v3 Source from the source code.
