---
name: "__gnu_debug::_Safe_iterator"
section: "3cxx"
platform: "linux"
package: "libstdc++-12-doc"
version: "12.4.0-5"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/__gnu_debug::_Safe_iterator/3cxx"
---

# \_\_gnu\_debug::\_Safe\_iterator(3cxx)

Safe iterator wrapper.

## NAME

\_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence, \_Category \> - Safe iterator wrapper.

## SYNOPSIS

`#include <safe_iterator.h>`

Inherits \_Iterator, and **\_\_gnu\_debug::\_Safe\_iterator\_base**.

Inherited by \_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence, std::random\_access\_iterator\_tag \>.

### Public Types

typedef **\_Safe\_iterator**\< \_Iterator, \_Sequence, iterator\_category \> **\_Self**\
 typedef \_Traits::difference\_type **difference\_type**\
 typedef \_Traits::iterator\_category **iterator\_category**\
 using **iterator\_concept** = std::\_\_detail::\_\_iter\_concept\< \_Iterator \>\
 typedef \_Iterator **iterator\_type**\
 typedef \_Traits::pointer **pointer**\
 typedef \_Traits::reference **reference**\
 typedef \_Traits::value\_type **value\_type**\

### Public Member Functions

**\_Safe\_iterator** () noexcept\
 **\_Safe\_iterator** (\_Iterator \_\_i, const **\_Safe\_sequence\_base** \*\_\_seq) noexcept\
 Safe iterator construction from an unsafe iterator and its sequence.  **\_Safe\_iterator** (**\_Safe\_iterator** &&\_\_x) noexcept\
 Move construction.  **\_Safe\_iterator** (const **\_Safe\_iterator** &\_\_x) noexcept\
 Copy construction.  template\<typename \_MutableIterator \> **\_Safe\_iterator** (const **\_Safe\_iterator**\< \_MutableIterator, \_Sequence, typename \_\_gnu\_cxx::\_\_enable\_if\< \_IsConstant::\_\_value &&std::\_\_are\_same\< \_MutableIterator, \_OtherIterator \>::\_\_value, \_Category \>::\_\_type \> &\_\_x) noexcept\
 Converting constructor from a mutable iterator to a constant iterator.  void **\_M\_attach** (**\_Safe\_sequence\_base** \*\_\_seq)\
 void **\_M\_attach\_single** (**\_Safe\_sequence\_base** \*\_\_seq)\
 bool **\_M\_attached\_to** (const **\_Safe\_sequence\_base** \*\_\_seq) const\
 bool **\_M\_before\_dereferenceable** () const\
 Is the iterator before a dereferenceable one?  template\<typename \_Diff \> bool **\_M\_can\_advance** (const **std::pair**\< \_Diff, **\_Distance\_precision** \> &\_\_dist, int \_\_way) const\
 bool **\_M\_can\_advance** (difference\_type \_\_n, bool \_\_strict=false) const\
 bool **\_M\_can\_compare** (const **\_Safe\_iterator\_base** &\_\_x) const  throw ()\
 bool **\_M\_dereferenceable** () const\
 Is the iterator dereferenceable?  void **\_M\_detach\_single** ()  throw ()\
 \_Distance\_traits\< \_Iterator \>::\_\_type **\_M\_get\_distance\_from\_begin** () const\
 \_Distance\_traits\< \_Iterator \>::\_\_type **\_M\_get\_distance\_to** (const **\_Safe\_iterator** &\_\_rhs) const\
 \_Distance\_traits\< \_Iterator \>::\_\_type **\_M\_get\_distance\_to\_end** () const\
 \_\_gnu\_cxx::\_\_conditional\_type\< \_IsConstant::\_\_value, const\_Sequence \*, \_Sequence \* \>::\_\_type **\_M\_get\_sequence** () const\
 bool **\_M\_incrementable** () const\
 Is the iterator incrementable?  void **\_M\_invalidate** ()\
 bool **\_M\_is\_before\_begin** () const\
 Is this iterator equal to the sequence's before\_begin() iterator if any?  bool **\_M\_is\_begin** () const\
 Is this iterator equal to the sequence's begin() iterator?  bool **\_M\_is\_beginnest** () const\
 Is this iterator equal to the sequence's before\_begin() iterator if any or begin() otherwise?  bool **\_M\_is\_end** () const\
 Is this iterator equal to the sequence's end() iterator?  void **\_M\_reset** ()  throw ()\
 bool **\_M\_singular** () const  throw ()\
 void **\_M\_unlink** ()  throw ()\
 bool **\_M\_valid\_range** (const **\_Safe\_iterator** &\_\_rhs, **std::pair**\< difference\_type, **\_Distance\_precision** \> &\_\_dist, bool \_\_check\_dereferenceable=true) const\
 const \_Iterator & **base** () const noexcept\
 \_Iterator & **base** () noexcept\
 Return the underlying iterator.  **operator \_Iterator** () const noexcept\
 Conversion to underlying non-debug iterator to allow better interaction with non-debug containers.  reference **operator\*** () const noexcept\
 Iterator dereference.  **\_Safe\_iterator** & **operator++** () noexcept\
 Iterator preincrement.  **\_Safe\_iterator** **operator++** (int) noexcept\
 Iterator postincrement.  pointer **operator-\>** () const noexcept\
 Iterator dereference.  **\_Safe\_iterator** & **operator=** (**\_Safe\_iterator** &&\_\_x) noexcept\
 Move assignment.  **\_Safe\_iterator** & **operator=** (const **\_Safe\_iterator** &\_\_x) noexcept\
 Copy assignment.

### Static Public Member Functions

static constexpr bool **\_S\_constant** ()\
 Determine if this is a constant iterator.

### Public Attributes

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

### Protected Types

typedef std::\_\_are\_same\< typename \_Sequence::\_Base::const\_iterator, \_Iterator \> **\_IsConstant**\
 typedef \_\_gnu\_cxx::\_\_conditional\_type\< \_IsConstant::\_\_value, typename\_Sequence::\_Base::iterator, typename\_Sequence::\_Base::const\_iterator \>::\_\_type **\_OtherIterator**\

### Protected Member Functions

**\_Safe\_iterator** (\_Iterator \_\_i, **\_Safe\_sequence\_base** \*\_\_seq, \_Attach\_single) noexcept\
 void **\_M\_attach** (**\_Safe\_sequence\_base** \*\_\_seq, bool \_\_constant)\
 void **\_M\_attach\_single** (**\_Safe\_sequence\_base** \*\_\_seq, bool \_\_constant)  throw ()\
 void **\_M\_detach** ()\
 \_\_gnu\_cxx::\_\_mutex & **\_M\_get\_mutex** ()  throw ()\

### Friends

template\<typename \_IteR \> bool **operator!=** (const **\_Self** &\_\_lhs, const **\_Safe\_iterator**\< \_IteR, \_Sequence, iterator\_category \> &\_\_rhs) noexcept\
 bool **operator!=** (const **\_Self** &\_\_lhs, const **\_Self** &\_\_rhs) noexcept\
 template\<typename \_IteR \> bool **operator==** (const **\_Self** &\_\_lhs, const **\_Safe\_iterator**\< \_IteR, \_Sequence, iterator\_category \> &\_\_rhs) noexcept\
 bool **operator==** (const **\_Self** &\_\_lhs, const **\_Self** &\_\_rhs) noexcept\

## Detailed Description

### template\<typename \_Iterator, typename \_Sequence, typename \_Category = typename std::iterator\_traits\<\_Iterator\>::iterator\_category\>

class \_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence, \_Category \>"Safe iterator wrapper.

The class template \_Safe\_iterator is a wrapper around an iterator that tracks the iterator's movement among sequences and checks that operations performed on the 'safe' iterator are legal. In additional to the basic iterator operations (which are validated, and then passed to the underlying iterator), \_Safe\_iterator has member functions for iterator invalidation, attaching/detaching the iterator from sequences, and querying the iterator's state.

Note that \_Iterator must be the first base class so that it gets initialized before the iterator is being attached to the container's list of iterators and it is being detached before \_Iterator get destroyed. Otherwise it would result in a data race.

## Constructor & Destructor Documentation

### template\<typename \_Iterator , typename \_Sequence , typename \_Category = typename std::iterator\_traits\<\_Iterator\>::iterator\_category\> \_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence, \_Category \>::\_Safe\_iterator ()` [inline]`, ` [noexcept]`

**Postcondition**

the iterator is singular and unattached

Referenced by **\_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence, \_Category \>::operator++()**.

### template\<typename \_Iterator , typename \_Sequence , typename \_Category = typename std::iterator\_traits\<\_Iterator\>::iterator\_category\> \_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence, \_Category \>::\_Safe\_iterator (\_Iterator \_\_i, const \_Safe\_sequence\_base \* \_\_seq)` [inline]`, ` [noexcept]`

Safe iterator construction from an unsafe iterator and its sequence.

**Precondition**

`seq` is not NULL

**Postcondition**

this is not singular

References **\_\_gnu\_debug::\_Safe\_iterator\_base::\_M\_singular()**.

### template\<typename \_Iterator , typename \_Sequence , typename \_Category = typename std::iterator\_traits\<\_Iterator\>::iterator\_category\> \_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence, \_Category \>::\_Safe\_iterator (const \_Safe\_iterator\< \_Iterator, \_Sequence, \_Category \> & \_\_x)` [inline]`, ` [noexcept]`

Copy construction.

References **\_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence, \_Category \>::\_M\_attach()**.

### template\<typename \_Iterator , typename \_Sequence , typename \_Category = typename std::iterator\_traits\<\_Iterator\>::iterator\_category\> \_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence, \_Category \>::\_Safe\_iterator (\_Safe\_iterator\< \_Iterator, \_Sequence, \_Category \> && \_\_x)` [inline]`, ` [noexcept]`

Move construction.

**Postcondition**

\_\_x is singular and unattached

References **\_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence, \_Category \>::\_M\_attach()**, **\_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence, \_Category \>::base()**, and **std::swap()**.

### template\<typename \_Iterator , typename \_Sequence , typename \_Category = typename std::iterator\_traits\<\_Iterator\>::iterator\_category\> template\<typename \_MutableIterator \> \_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence, \_Category \>::\_Safe\_iterator (const \_Safe\_iterator\< \_MutableIterator, \_Sequence, typename \_\_gnu\_cxx::\_\_enable\_if\< \_IsConstant::\_\_value &&std::\_\_are\_same\< \_MutableIterator, \_OtherIterator \>::\_\_value, \_Category \>::\_\_type \> & \_\_x)` [inline]`, ` [noexcept]`

Converting constructor from a mutable iterator to a constant iterator.

References **\_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence, \_Category \>::\_M\_attach()**.

## Member Function Documentation

### template\<typename \_Iterator , typename \_Sequence , typename \_Category = typename std::iterator\_traits\<\_Iterator\>::iterator\_category\> void \_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence, \_Category \>::\_M\_attach (\_Safe\_sequence\_base \* \_\_seq)` [inline]`

Attach iterator to the given sequence.

References **\_\_gnu\_debug::\_Safe\_iterator\_base::\_M\_attach()**, and **\_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence, \_Category \>::\_S\_constant()**.

Referenced by **\_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence, \_Category \>::\_Safe\_iterator()**, **\_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence, \_Category \>::\_Safe\_iterator()**, **\_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence, \_Category \>::\_Safe\_iterator()**, **\_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence, \_Category \>::operator=()**, and **\_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence, \_Category \>::operator=()**.

### void \_\_gnu\_debug::\_Safe\_iterator\_base::\_M\_attach (\_Safe\_sequence\_base \* \_\_seq, bool \_\_constant)` [protected]`, ` [inherited]`

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\_base::\_Safe\_iterator\_base()**, **\_\_gnu\_debug::\_Safe\_iterator\_base::\_Safe\_iterator\_base()**, and **\_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence, \_Category \>::\_M\_attach()**.

### template\<typename \_Iterator , typename \_Sequence , typename \_Category = typename std::iterator\_traits\<\_Iterator\>::iterator\_category\> void \_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence, \_Category \>::\_M\_attach\_single (\_Safe\_sequence\_base \* \_\_seq)` [inline]`

Likewise, but not thread-safe.

References **\_\_gnu\_debug::\_Safe\_iterator\_base::\_M\_attach\_single()**, and **\_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence, \_Category \>::\_S\_constant()**.

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

Likewise, but not thread-safe.

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

### bool \_\_gnu\_debug::\_Safe\_iterator\_base::\_M\_attached\_to (const \_Safe\_sequence\_base \* \_\_seq) const` [inline]`, ` [inherited]`

Determines if we are attached to the given sequence.

References **\_\_gnu\_debug::\_Safe\_iterator\_base::\_M\_sequence**.

### template\<typename \_Iterator , typename \_Sequence , typename \_Category = typename std::iterator\_traits\<\_Iterator\>::iterator\_category\> bool \_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence, \_Category \>::\_M\_before\_dereferenceable () const` [inline]`

Is the iterator before a dereferenceable one?

References **\_\_gnu\_debug::\_\_base()**, **\_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence, \_Category \>::\_M\_incrementable()**, and **\_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence, \_Category \>::base()**.

### bool \_\_gnu\_debug::\_Safe\_iterator\_base::\_M\_can\_compare (const \_Safe\_iterator\_base & \_\_x) const` [inherited]`

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

### template\<typename \_Iterator , typename \_Sequence , typename \_Category = typename std::iterator\_traits\<\_Iterator\>::iterator\_category\> bool \_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence, \_Category \>::\_M\_dereferenceable () const` [inline]`

Is the iterator dereferenceable?

References **\_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence, \_Category \>::\_M\_is\_before\_begin()**, **\_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence, \_Category \>::\_M\_is\_end()**, and **\_\_gnu\_debug::\_Safe\_iterator\_base::\_M\_singular()**.

Referenced by **\_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence, \_Category \>::operator\*()**, and **\_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence, \_Category \>::operator-\>()**.

### void \_\_gnu\_debug::\_Safe\_iterator\_base::\_M\_detach ()` [protected]`, ` [inherited]`

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

Referenced by **\_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence, \_Category \>::operator=()**, and **\_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence, \_Category \>::operator=()**.

### void \_\_gnu\_debug::\_Safe\_iterator\_base::\_M\_detach\_single ()` [inherited]`

Likewise, but not thread-safe.

Referenced by **\_\_gnu\_debug::\_Safe\_sequence\< \_Sequence \>::\_M\_transfer\_from\_if()**.

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

For use in \_Safe\_iterator.

Referenced by **\_\_gnu\_debug::\_Safe\_local\_iterator\< \_Iterator, \_Sequence \>::operator++()**, **\_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence, \_Category \>::operator++()**, **\_\_gnu\_debug::\_Safe\_local\_iterator\< \_Iterator, \_Sequence \>::operator++()**, **\_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence, \_Category \>::operator++()**, **\_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence, \_Category \>::operator=()**, **\_\_gnu\_debug::\_Safe\_local\_iterator\< \_Iterator, \_Sequence \>::operator=()**, **\_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence, \_Category \>::operator=()**, and **\_\_gnu\_debug::\_Safe\_local\_iterator\< \_Iterator, \_Sequence \>::operator=()**.

### template\<typename \_Iterator , typename \_Sequence , typename \_Category = typename std::iterator\_traits\<\_Iterator\>::iterator\_category\> bool \_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence, \_Category \>::\_M\_incrementable () const` [inline]`

Is the iterator incrementable?

References **\_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence, \_Category \>::\_M\_is\_end()**, and **\_\_gnu\_debug::\_Safe\_iterator\_base::\_M\_singular()**.

Referenced by **\_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence, \_Category \>::\_M\_before\_dereferenceable()**, **\_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence, \_Category \>::operator++()**, and **\_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence, \_Category \>::operator++()**.

### void \_\_gnu\_debug::\_Safe\_iterator\_base::\_M\_invalidate ()` [inline]`, ` [inherited]`

Invalidate the iterator, making it singular.

References **\_\_gnu\_debug::\_Safe\_iterator\_base::\_M\_version**.

### template\<typename \_Iterator , typename \_Sequence , typename \_Category = typename std::iterator\_traits\<\_Iterator\>::iterator\_category\> bool \_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence, \_Category \>::\_M\_is\_before\_begin () const` [inline]`

Is this iterator equal to the sequence's before\_begin() iterator if any?

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

### template\<typename \_Iterator , typename \_Sequence , typename \_Category = typename std::iterator\_traits\<\_Iterator\>::iterator\_category\> bool \_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence, \_Category \>::\_M\_is\_begin () const` [inline]`

Is this iterator equal to the sequence's begin() iterator?

References **\_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence, \_Category \>::base()**.

### template\<typename \_Iterator , typename \_Sequence , typename \_Category = typename std::iterator\_traits\<\_Iterator\>::iterator\_category\> bool \_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence, \_Category \>::\_M\_is\_beginnest () const` [inline]`

Is this iterator equal to the sequence's before\_begin() iterator if any or begin() otherwise?

### template\<typename \_Iterator , typename \_Sequence , typename \_Category = typename std::iterator\_traits\<\_Iterator\>::iterator\_category\> bool \_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence, \_Category \>::\_M\_is\_end () const` [inline]`

Is this iterator equal to the sequence's end() iterator?

References **\_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence, \_Category \>::base()**.

Referenced by **\_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence, \_Category \>::\_M\_dereferenceable()**, and **\_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence, \_Category \>::\_M\_incrementable()**.

### void \_\_gnu\_debug::\_Safe\_iterator\_base::\_M\_reset ()` [inherited]`

Reset all member variables

### bool \_\_gnu\_debug::\_Safe\_iterator\_base::\_M\_singular () const` [inherited]`

Is this iterator singular?

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

### void \_\_gnu\_debug::\_Safe\_iterator\_base::\_M\_unlink ()` [inline]`, ` [inherited]`

Unlink itself

References **\_\_gnu\_debug::\_Safe\_iterator\_base::\_M\_next**, and **\_\_gnu\_debug::\_Safe\_iterator\_base::\_M\_prior**.

### template\<typename \_Iterator , typename \_Sequence , typename \_Category = typename std::iterator\_traits\<\_Iterator\>::iterator\_category\> static constexpr bool \_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence, \_Category \>::\_S\_constant ()` [inline]`, ` [static]`, ` [constexpr]`

Determine if this is a constant iterator.

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

### template\<typename \_Iterator , typename \_Sequence , typename \_Category = typename std::iterator\_traits\<\_Iterator\>::iterator\_category\> \_Iterator & \_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence, \_Category \>::base ()` [inline]`, ` [noexcept]`

Return the underlying iterator.

Referenced by **\_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence, \_Category \>::\_Safe\_iterator()**, **\_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence, \_Category \>::\_M\_before\_dereferenceable()**, **\_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence, \_Category \>::\_M\_is\_begin()**, **\_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence, \_Category \>::\_M\_is\_end()**, **\_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence, \_Category \>::operator\*()**, **\_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence, \_Category \>::operator++()**, **\_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence, \_Category \>::operator++()**, **\_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence, \_Category \>::operator-\>()**, **\_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence, \_Category \>::operator=()**, and **\_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence, \_Category \>::operator=()**.

### template\<typename \_Iterator , typename \_Sequence , typename \_Category = typename std::iterator\_traits\<\_Iterator\>::iterator\_category\> \_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence, \_Category \>::operator \_Iterator () const` [inline]`, ` [noexcept]`

Conversion to underlying non-debug iterator to allow better interaction with non-debug containers.

### template\<typename \_Iterator , typename \_Sequence , typename \_Category = typename std::iterator\_traits\<\_Iterator\>::iterator\_category\> reference \_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence, \_Category \>::operator\* () const` [inline]`, ` [noexcept]`

Iterator dereference.

**Precondition**

iterator is dereferenceable

References **\_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence, \_Category \>::\_M\_dereferenceable()**, and **\_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence, \_Category \>::base()**.

### template\<typename \_Iterator , typename \_Sequence , typename \_Category = typename std::iterator\_traits\<\_Iterator\>::iterator\_category\> \_Safe\_iterator & \_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence, \_Category \>::operator++ ()` [inline]`, ` [noexcept]`

Iterator preincrement.

**Precondition**

iterator is incrementable

References **\_\_gnu\_debug::\_Safe\_iterator\_base::\_M\_get\_mutex()**, **\_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence, \_Category \>::\_M\_incrementable()**, and **\_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence, \_Category \>::base()**.

### template\<typename \_Iterator , typename \_Sequence , typename \_Category = typename std::iterator\_traits\<\_Iterator\>::iterator\_category\> \_Safe\_iterator \_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence, \_Category \>::operator++ (int)` [inline]`, ` [noexcept]`

Iterator postincrement.

**Precondition**

iterator is incrementable

References **\_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence, \_Category \>::\_Safe\_iterator()**, **\_\_gnu\_debug::\_Safe\_iterator\_base::\_M\_get\_mutex()**, **\_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence, \_Category \>::\_M\_incrementable()**, **\_\_gnu\_debug::\_Safe\_iterator\_base::\_M\_sequence**, and **\_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence, \_Category \>::base()**.

### template\<typename \_Iterator , typename \_Sequence , typename \_Category = typename std::iterator\_traits\<\_Iterator\>::iterator\_category\> pointer \_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence, \_Category \>::operator-\> () const` [inline]`, ` [noexcept]`

Iterator dereference.

**Precondition**

iterator is dereferenceable

References **\_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence, \_Category \>::\_M\_dereferenceable()**, and **\_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence, \_Category \>::base()**.

### template\<typename \_Iterator , typename \_Sequence , typename \_Category = typename std::iterator\_traits\<\_Iterator\>::iterator\_category\> \_Safe\_iterator & \_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence, \_Category \>::operator= (\_Safe\_iterator\< \_Iterator, \_Sequence, \_Category \> && \_\_x)` [inline]`, ` [noexcept]`

Move assignment.

**Postcondition**

\_\_x is singular and unattached

References **std::\_\_addressof()**, **\_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence, \_Category \>::\_M\_attach()**, **\_\_gnu\_debug::\_Safe\_iterator\_base::\_M\_detach()**, **\_\_gnu\_debug::\_Safe\_iterator\_base::\_M\_get\_mutex()**, **\_\_gnu\_debug::\_Safe\_iterator\_base::\_M\_sequence**, **\_\_gnu\_debug::\_Safe\_iterator\_base::\_M\_version**, and **\_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence, \_Category \>::base()**.

### template\<typename \_Iterator , typename \_Sequence , typename \_Category = typename std::iterator\_traits\<\_Iterator\>::iterator\_category\> \_Safe\_iterator & \_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence, \_Category \>::operator= (const \_Safe\_iterator\< \_Iterator, \_Sequence, \_Category \> & \_\_x)` [inline]`, ` [noexcept]`

Copy assignment.

References **\_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence, \_Category \>::\_M\_attach()**, **\_\_gnu\_debug::\_Safe\_iterator\_base::\_M\_detach()**, **\_\_gnu\_debug::\_Safe\_iterator\_base::\_M\_get\_mutex()**, **\_\_gnu\_debug::\_Safe\_iterator\_base::\_M\_sequence**, **\_\_gnu\_debug::\_Safe\_iterator\_base::\_M\_version**, and **\_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence, \_Category \>::base()**.

## Member Data Documentation

### \_Safe\_iterator\_base\* \_\_gnu\_debug::\_Safe\_iterator\_base::\_M\_next` [inherited]`

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

Referenced by **\_\_gnu\_debug::\_Safe\_sequence\< \_SafeSequence \>::\_M\_invalidate\_if()**, **\_\_gnu\_debug::\_Safe\_sequence\< \_Sequence \>::\_M\_transfer\_from\_if()**, and **\_\_gnu\_debug::\_Safe\_iterator\_base::\_M\_unlink()**.

### \_Safe\_iterator\_base\* \_\_gnu\_debug::\_Safe\_iterator\_base::\_M\_prior` [inherited]`

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

Referenced by **\_\_gnu\_debug::\_Safe\_sequence\< \_SafeSequence \>::\_M\_invalidate\_if()**, **\_\_gnu\_debug::\_Safe\_sequence\< \_Sequence \>::\_M\_transfer\_from\_if()**, and **\_\_gnu\_debug::\_Safe\_iterator\_base::\_M\_unlink()**.

### \_Safe\_sequence\_base\* \_\_gnu\_debug::\_Safe\_iterator\_base::\_M\_sequence` [inherited]`

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

Referenced by **\_\_gnu\_debug::\_Safe\_iterator\_base::\_Safe\_iterator\_base()**, **\_\_gnu\_debug::\_Safe\_local\_iterator\_base::\_Safe\_local\_iterator\_base()**, **\_\_gnu\_debug::\_Safe\_iterator\_base::\_M\_attached\_to()**, **\_\_gnu\_debug::\_Safe\_sequence\< \_Sequence \>::\_M\_transfer\_from\_if()**, **\_\_gnu\_debug::\_Safe\_local\_iterator\< \_Iterator, \_Sequence \>::operator++()**, **\_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence, \_Category \>::operator++()**, **\_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence, \_Category \>::operator=()**, **\_\_gnu\_debug::\_Safe\_local\_iterator\< \_Iterator, \_Sequence \>::operator=()**, **\_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence, \_Category \>::operator=()**, and **\_\_gnu\_debug::\_Safe\_local\_iterator\< \_Iterator, \_Sequence \>::operator=()**.

### unsigned int \_\_gnu\_debug::\_Safe\_iterator\_base::\_M\_version` [inherited]`

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.

Referenced by **\_\_gnu\_debug::\_Safe\_iterator\_base::\_M\_invalidate()**, **\_\_gnu\_debug::\_Safe\_sequence\< \_Sequence \>::\_M\_transfer\_from\_if()**, **\_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence, \_Category \>::operator=()**, **\_\_gnu\_debug::\_Safe\_local\_iterator\< \_Iterator, \_Sequence \>::operator=()**, **\_\_gnu\_debug::\_Safe\_iterator\< \_Iterator, \_Sequence, \_Category \>::operator=()**, and **\_\_gnu\_debug::\_Safe\_local\_iterator\< \_Iterator, \_Sequence \>::operator=()**.

## Author

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