__gnu_debu...uence_base(3)

πŸ’– __gnu_debug::_Safe_sequence_base β€” from the Library Functions Manual πŸŽ€

okay bestie, sit down, grab a boba, because we're about to talk about the ✨base class✨ that makes sure your iterators don't betray you. no cap. this one lives in the libstdc++ manual, section 3, and it's literally the foundation underneath all the safe containers. it's giving "quiet kid in the back of the class who is actually running the whole group project." πŸ’…


🌸 NAME 🌸

__gnu_debug::_Safe_sequence_base β€” the base class that supports tracking of iterators that reference a sequence.


✨ SYNOPSIS ✨

#include <safe_base.h>

πŸ¦‹ Inherited by

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.

look at that family tree 😭 it's a whole dynasty.

πŸ‘‘ Public Attributes

  • _Safe_iterator_base * _M_const_iterators β€” the list of constant iterators that reference this container. const girlies, assemble 🫢
  • _Safe_iterator_base * _M_iterators β€” the list of mutable iterators that reference this container. the ones who are allowed to change things, main character energy fr fr
  • unsigned int _M_version β€” the container version number. This number may never be 0. not ever. zero is forbidden. 🚫

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

⚠️ okay this next bit is IMPORTANT, do not skip: 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. like, that's the whole assignment. no throwing. not even a little. 🚨

πŸŽ€ 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. it's a goodbye tour, and every iterator gets a text. πŸ₯²

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. all of them. every single one. πŸ’€

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). it's the glow-up arc for iterators that got cancelled earlier. ✨

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. it's a trade, bestie β€” everything moves, nobody gets left behind. πŸ”„


πŸ“ 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. (saying it twice because it MATTERS πŸ’…)

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.


okay that's the whole page, you ate it, periodt πŸ’– this was __gnu_debug::_Safe_sequence_base(3) from the libstdc++ manual β€” auto-generated by Doxygen for libstdc++ straight from the source code, so if you ever need to cite it, that's the vibe. mwah, go write some safe iterators 🫢🌸

πŸ“¦ where this page comes from
  • arch rolling: gcc 16.2.1+r23+gd564253eb6c8-1 Β· GPL-3.0-or-later WITH GCC-exception-3.1 AND GFDL-1.3-or-later
  • fedora 44: libstdc++-docs 16.0.1-0.10.fc44 Β· GPL-3.0-or-later AND LGPL-3.0-or-later AND (GPL-3.0-or-later WITH GCC-exception-3.1) AND (GPL-3.0-or-later WITH Texinfo-exception) AND (LGPL-2.1-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GNU-compiler-exception) AND BSL-1.0 AND GFDL-1.3-or-later AND Linux-man-pages-copyleft-2-para AND SunPro AND BSD-1-Clause AND BSD-2-Clause AND BSD-2-Clause-Views AND BSD-3-Clause AND BSD-4-Clause AND BSD-Source-Code AND Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 WITH LLVM-Exception) AND ZPL-2.1 AND ISC AND LicenseRef-Fedora-Public-Domain AND HP-1986 AND curl AND Martin-Birgmeier AND HPND-Markus-Kuhn AND dtoa AND SMLNJ AND AMD-newlib AND OAR AND HPND-merchantability-variant AND HPND-Intel
  • fedora 44: libstdc++-docs 16.2.1-2.fc44
  • fedora 44: libstdc++-docs 16.2.1-3.fc44 Β· GPL-3.0-or-later AND LGPL-3.0-or-later AND (GPL-3.0-or-later WITH GCC-exception-3.1) AND (GPL-3.0-or-later WITH Texinfo-exception) AND (LGPL-2.1-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GNU-compiler-exception) AND BSL-1.0 AND GFDL-1.3-or-later AND Linux-man-pages-copyleft-2-para AND SunPro AND BSD-1-Clause AND BSD-2-Clause AND BSD-2-Clause-Views AND BSD-3-Clause AND BSD-4-Clause AND BSD-Source-Code AND Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 WITH LLVM-Exception) AND ZPL-2.1 AND ISC AND LicenseRef-Fedora-Public-Domain AND HP-1986 AND curl AND Martin-Birgmeier AND HPND-Markus-Kuhn AND dtoa AND SMLNJ AND AMD-newlib AND OAR AND HPND-merchantability-variant AND HPND-Intel
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms