---
name: "__gnu_debug::_Safe_sequence_base"
section: "3"
platform: "linux"
package: "gcc"
version: "16.2.1+r23+gd564253eb6c8-1"
release: "Arch Linux 2026-11-01"
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\< \_SafeSequence \>**, **\_\_gnu\_debug::\_Safe\_sequence\< basic\_string\< \_CharT, std::char\_traits\< \_CharT \>, std::allocator\< \_CharT \> \> \>**, **\_\_gnu\_debug::\_Safe\_sequence\< deque\< \_Tp, std::allocator\< \_Tp \> \> \>**, **\_\_gnu\_debug::\_Safe\_sequence\< \_SafeContainer \>**, **\_\_gnu\_debug::\_Safe\_sequence\< list\< \_Tp, std::allocator\< \_Tp \> \> \>**, **\_\_gnu\_debug::\_Safe\_sequence\< map\< \_Key, \_Tp, std::less\< \_Key \>, std::allocator\< std::pair\< const \_Key, \_Tp \> \> \> \>**, **\_\_gnu\_debug::\_Safe\_sequence\< multimap\< \_Key, \_Tp, std::less\< \_Key \>, std::allocator\< std::pair\< const \_Key, \_Tp \> \> \> \>**, **\_\_gnu\_debug::\_Safe\_sequence\< multiset\< \_Key, std::less\< \_Key \>, std::allocator\< \_Key \> \> \>**, **\_\_gnu\_debug::\_Safe\_sequence\< set\< \_Key, std::less\< \_Key \>, std::allocator\< \_Key \> \> \>**, **\_\_gnu\_debug::\_Safe\_sequence\< vector\< \_Tp, std::allocator\< \_Tp \> \> \>**, **\_\_gnu\_debug::\_Safe\_sequence\< \_Sequence \>**, and **\_\_gnu\_debug::\_Safe\_unordered\_container\_base**.

### Public Attributes

\_Safe\_iterator\_base \* **\_M\_const\_iterators**\
 The list of constant iterators that reference this container.  \_Safe\_iterator\_base \* **\_M\_iterators**\
 The list of mutable iterators that reference this container.  unsigned int **\_M\_version**\
 The container version number. This number may never be 0.

### Protected Member Functions

constexpr **\_Safe\_sequence\_base** (\_Safe\_sequence\_base &&\_\_seq) noexcept\
 constexpr **\_Safe\_sequence\_base** (const \_Safe\_sequence\_base &) noexcept\
 constexpr **~\_Safe\_sequence\_base** () noexcept\
 void **\_M\_detach\_all** () const\
 void **\_M\_detach\_singular** () const\
 \_\_gnu\_cxx::\_\_mutex & **\_M\_get\_mutex** () const noexcept\
 constexpr void **\_M\_invalidate\_all** () const\
 void **\_M\_revalidate\_singular** () const\
 void **\_M\_swap** (const \_Safe\_sequence\_base &\_\_x) const noexcept\
 constexpr \_Safe\_sequence\_base & **operator=** (\_Safe\_sequence\_base &&\_\_x) noexcept\
 constexpr \_Safe\_sequence\_base & **operator=** (const \_Safe\_sequence\_base &) noexcept\

### Friends

class **\_Safe\_iterator\_base**\

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

## Constructor & Destructor Documentation

### \_\_gnu\_debug::\_Safe\_sequence\_base::~\_Safe\_sequence\_base () \[inline\], \[constexpr\], \[protected\], \[noexcept\]

Notify all iterators that reference this sequence that the sequence is being destroyed.

References **\_M\_detach\_all()**.

## Member Function Documentation

### void \_\_gnu\_debug::\_Safe\_sequence\_base::\_M\_detach\_all () const \[protected\]

Detach all iterators, leaving them singular.

Referenced by **~\_Safe\_sequence\_base()**.

### void \_\_gnu\_debug::\_Safe\_sequence\_base::\_M\_detach\_singular () const \[protected\]

Detach all singular iterators.

**Postcondition**

for all iterators i attached to this sequence, i-\>\_M\_version == \_M\_version.

### \_\_gnu\_cxx::\_\_mutex & \_\_gnu\_debug::\_Safe\_sequence\_base::\_M\_get\_mutex () const \[protected\], \[noexcept\]

For use in \_Safe\_sequence.

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

### void \_\_gnu\_debug::\_Safe\_sequence\_base::\_M\_invalidate\_all () const \[inline\], \[constexpr\], \[protected\]

Invalidates all iterators.

References **\_M\_invalidate\_all()**, and **\_M\_version**.

Referenced by **\_M\_invalidate\_all()**.

### void \_\_gnu\_debug::\_Safe\_sequence\_base::\_M\_revalidate\_singular () const \[protected\]

Revalidates all attached singular iterators. This method may be used to validate iterators that were invalidated before (but for some reason, such as an exception, need to become valid again).

### void \_\_gnu\_debug::\_Safe\_sequence\_base::\_M\_swap (const \_Safe\_sequence\_base & \_\_x) const \[protected\], \[noexcept\]

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.

## Member Data Documentation

### \_Safe\_iterator\_base\* \_\_gnu\_debug::\_Safe\_sequence\_base::\_M\_const\_iterators \[mutable\]

The list of constant iterators that reference this container.

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

### \_Safe\_iterator\_base\* \_\_gnu\_debug::\_Safe\_sequence\_base::\_M\_iterators \[mutable\]

The list of mutable iterators that reference this container.

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

### unsigned int \_\_gnu\_debug::\_Safe\_sequence\_base::\_M\_version \[mutable\]

The container version number. This number may never be 0.

Referenced by **\_M\_invalidate\_all()**, **\_\_gnu\_debug::\_Safe\_sequence\< \_Sequence \>::\_M\_transfer\_from\_if()**, **\_\_gnu\_debug::\_Safe\_iterator\< \_Base\_iterator, map \>::operator=()**, **\_\_gnu\_debug::\_Safe\_iterator\< \_Base\_iterator, map \>::operator=()**, **\_\_gnu\_debug::\_Safe\_local\_iterator\< \_OtherIterator, \_UContainer \>::operator=()**, and **\_\_gnu\_debug::\_Safe\_local\_iterator\< \_OtherIterator, \_UContainer \>::operator=()**.

## Author

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