---
name: "__gnu_debug__Safe_iterator_base"
section: "3"
platform: "linux"
package: "libstdc++6-4.2-doc"
version: "4.2.4-6"
release: "Debian 5.0 (Lenny)"
platforms: ["linux"]
url: "https://new.carta.tech/__gnu_debug__Safe_iterator_base"
---

# \_\_gnu\_debug\_\_Safe\_iterator\_base(3)

## NAME

\_\_gnu\_debug::\_Safe\_iterator\_base -

## SYNOPSIS

Inherited by **\_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence \>**, and std::\_\_debug::bitset\< \_Nb \>::reference.

## Detailed Description

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 56 of file safe\_base.h.

### Public Member Functions

void **\_M\_attach** (**\_Safe\_sequence\_base** \*\_\_seq, bool \_\_constant)\
 void **\_M\_attach\_single** (**\_Safe\_sequence\_base** \*\_\_seq, bool \_\_constant)\
 bool **\_M\_attached\_to** (const **\_Safe\_sequence\_base** \*\_\_seq) const \
 bool **\_M\_can\_compare** (const **\_Safe\_iterator\_base** &\_\_x) const \
 void **\_M\_detach** ()\
 void **\_M\_detach\_single** ()\
 bool **\_M\_singular** () const \

### Public Attributes

**\_Safe\_iterator\_base** \* **\_M\_next**\
 **\_Safe\_iterator\_base** \* **\_M\_prior**\
 **\_Safe\_sequence\_base** \* **\_M\_sequence**\
 unsigned int **\_M\_version**\

### Protected Member Functions

\_\_gnu\_cxx::\_\_mutex & **\_M\_get\_mutex** ()\
 **\_Safe\_iterator\_base** (const **\_Safe\_iterator\_base** &)\
 **\_Safe\_iterator\_base** (const **\_Safe\_iterator\_base** &\_\_x, bool \_\_constant)\
 **\_Safe\_iterator\_base** (const **\_Safe\_sequence\_base** \*\_\_seq, bool \_\_constant)\
 **\_Safe\_iterator\_base** ()\
 **\_Safe\_iterator\_base** & **operator=** (const **\_Safe\_iterator\_base** &)\

## Constructor & Destructor Documentation

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

Initializes the iterator and makes it singular.

Definition at line 82 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 93 of file safe\_base.h.

References \_M\_attach().

### \_\_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 100 of file safe\_base.h.

References \_M\_attach(), and \_M\_sequence.

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

Referenced by \_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence \>::\_M\_attach(), and \_Safe\_iterator\_base().

### void \_\_gnu\_debug::\_Safe\_iterator\_base::\_M\_attach\_single (\_Safe\_sequence\_base \* \_\_seq, bool \_\_constant)

Likewise, but not thread-safe.

Referenced by \_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence \>::\_M\_attach\_single().

### 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 135 of file safe\_base.h.

References \_M\_sequence.

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

### void \_\_gnu\_debug::\_Safe\_iterator\_base::\_M\_detach ()

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

### void \_\_gnu\_debug::\_Safe\_iterator\_base::\_M\_detach\_single ()

Likewise, but not thread-safe.

### \_\_gnu\_cxx::\_\_mutex& \_\_gnu\_debug::\_Safe\_iterator\_base::\_M\_get\_mutex ()` [protected]`

For use in **\_Safe\_iterator**.

Referenced by \_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence \>::\_M\_invalidate().

### bool \_\_gnu\_debug::\_Safe\_iterator\_base::\_M\_singular () const

Is this iterator singular?

Referenced by \_\_gnu\_debug::\_\_check\_singular(), \_\_gnu\_debug::\_\_check\_singular\_aux(), \_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence \>::\_M\_dereferenceable(), \_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence \>::\_M\_invalidate\_single(), \_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence \>::\_Safe\_iterator(), and \_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence \>::operator=().

## Member Data Documentation

### \_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 78 of file safe\_base.h.

Referenced by \_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence \>::\_M\_invalidate\_single().

### \_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 74 of file safe\_base.h.

### \_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 61 of file safe\_base.h.

Referenced by \_M\_attached\_to(), \_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence \>::\_M\_invalidate\_single(), \_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence \>::\_M\_is\_begin(), \_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence \>::\_M\_is\_end(), \_\_gnu\_debug::\_Safe\_sequence\< \_Sequence \>::\_M\_transfer\_iter(), \_Safe\_iterator\_base(), and \_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence \>::operator=().

### 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 70 of file safe\_base.h.

Referenced by \_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence \>::\_M\_invalidate\_single().

## Author

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