---
name: "__gnu_debug::Safe_iterator_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_iterator_base"
---

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

Basic functionality for a 'safe' iterator.

## NAME

\_\_gnu\_debug::Safe\_iterator\_base - Basic functionality for a 'safe' iterator.

## SYNOPSIS

`#include <safe_base.h>`

Inherited by **\_\_gnu\_debug::Safe\_iterator\< Iterator, Sequence \>**, and **\_\_gnu\_debug\_def::bitset\< Nb \>::reference**.

### Public Member Functions

void **M\_attach** (**Safe\_sequence\_base** \*seq, bool constant)\
 void **M\_detach** ()\
 bool **M\_attached\_to** (const **Safe\_sequence\_base** \*seq) const \
 bool **M\_singular** () const\
 bool **M\_can\_compare** (const **Safe\_iterator\_base** &x) const\

### Public Attributes

**Safe\_sequence\_base** \* **M\_sequence**\
 unsigned int **M\_version**\
 **Safe\_iterator\_base** \* **M\_prior**\
 **Safe\_iterator\_base** \* **M\_next**\

### Protected Member Functions

**Safe\_iterator\_base** ()\
 **Safe\_iterator\_base** (const **Safe\_sequence\_base** \*seq, bool constant)\
 **Safe\_iterator\_base** (const **Safe\_iterator\_base** &x, bool constant)\
 **~Safe\_iterator\_base** ()\

## Detailed Description

Basic functionality for a 'safe' iterator.

The Safe\_iterator\_base base class implements the functionality of a safe iterator that is not specific to a particular iterator type. It contains a pointer back to the sequence it references along with iterator version information and pointers to form a doubly-linked list of iterators referenced by the container.

This class must not perform any operations that can throw an exception, or the exception guarantees of derived iterators will be broken.

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

## Constructor & Destructor Documentation

### \_\_gnu\_debug::Safe\_iterator\_base::Safe\_iterator\_base ()` [inline, protected]`

Initializes the iterator and makes it singular.

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

### \_\_gnu\_debug::Safe\_iterator\_base::Safe\_iterator\_base (const Safe\_sequence\_base \* seq, bool constant)` [inline, protected]`

Initialize the iterator to reference the sequence pointed to by . `constant` is true when we are initializing a constant iterator, and false if it is a mutable iterator. Note that `seq` may be NULL, in which case the iterator will be singular. Otherwise, the iterator will reference `seq` and be nonsingular.

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

### \_\_gnu\_debug::Safe\_iterator\_base::Safe\_iterator\_base (const Safe\_iterator\_base & x, bool constant)` [inline, protected]`

Initializes the iterator to reference the same sequence that `x` does. `constant` is true if this is a constant iterator, and false if it is mutable.

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

## Member Function Documentation

### void \_\_gnu\_debug::Safe\_iterator\_base::M\_attach (Safe\_sequence\_base \* seq, bool constant)

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

Definition at line 190 of file debug.cc.

### void \_\_gnu\_debug::Safe\_iterator\_base::M\_detach ()

Detach the iterator for whatever sequence it is attached to, if any.

Definition at line 220 of file debug.cc.

### bool \_\_gnu\_debug::Safe\_iterator\_base::M\_attached\_to (const Safe\_sequence\_base \* seq) const` [inline]`

Determines if we are attached to the given sequence.

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

### bool \_\_gnu\_debug::Safe\_iterator\_base::M\_singular () const

Is this iterator singular?

Definition at line 245 of file debug.cc.

### bool \_\_gnu\_debug::Safe\_iterator\_base::M\_can\_compare (const Safe\_iterator\_base & x) const

Can we compare this iterator to the given iterator `x`? Returns true if both iterators are nonsingular and reference the same sequence.

Definition at line 250 of file debug.cc.

## Member Data Documentation

### Safe\_sequence\_base\* \_\_gnu\_debug::Safe\_iterator\_base::M\_sequence

The sequence this iterator references; may be NULL to indicate a singular iterator.

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

### unsigned int \_\_gnu\_debug::Safe\_iterator\_base::M\_version

The version number of this iterator. The sentinel value 0 is used to indicate an invalidated iterator (i.e., one that is singular because of an operation on the container). This version number must equal the version number in the sequence referenced by M\_sequence for the iterator to be non-singular.

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

### Safe\_iterator\_base\* \_\_gnu\_debug::Safe\_iterator\_base::M\_prior

Pointer to the previous iterator in the sequence's list of iterators. Only valid when M\_sequence != NULL.

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

### Safe\_iterator\_base\* \_\_gnu\_debug::Safe\_iterator\_base::M\_next

Pointer to the next iterator in the sequence's list of iterators. Only valid when M\_sequence != NULL.

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

## Author

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