STD::_DEQUE_ITERATOR(3cxx)

πŸ’… std::_Deque_it...p, _Ref, _Ptr > β€” the 3cxx manual, bestie!! ✨

okay so this is the group chat for std::_Deque_iterator< _Tp, _Ref, _Ptr >, manual page 3cxx. She is the iterator brain cell for deque, and yes she is serving main-character energy. 🫢

🌸 NAME 🌸

std::_Deque_iterator< _Tp, _Ref, _Ptr > β€” A deque::iterator. No cap, that's the whole name vibe. πŸ’–

✨ SYNOPSIS ✨

First things first, you gotta bring in the header:

#include <deque>

πŸŽ€ Public Types πŸŽ€

  • typedef __ptr_rebind< _Ptr, _Tp > _Elt_pointer
  • typedef __ptr_rebind< _Ptr, _Elt_pointer > _Map_pointer
  • typedef _Deque_iterator _Self
  • typedef __iter< const _Tp > const_iterator
  • typedef ptrdiff_t difference_type
  • typedef __iter< _Tp > iterator
  • typedef std::random_access_iterator_tag iterator_category
  • typedef _Ptr pointer
  • typedef _Ref reference
  • typedef size_t size_type
  • typedef _Tp value_type

πŸ’… Public Member Functions πŸ’…

  • _Deque_iterator (_Elt_pointer __x, _Map_pointer __y) noexcept
  • _Deque_iterator (const _Deque_iterator &__x) noexcept

the template constructor is its own lil diva, exact signature bestie:

template<typename _Iter , typename  = _Require<is_same<_Self,
    const_iterator>,                    is_same<_Iter, iterator>>>
    _Deque_iterator (const _Iter &__x) noexcept
  • iterator _M_const_cast () const noexcept
  • void _M_set_node (_Map_pointer __new_node) noexcept
  • reference operator* () const noexcept
  • _Self & operator++ () noexcept
  • _Self operator++ (int) noexcept
  • _Self & operator+= (difference_type __n) noexcept
  • _Self & operator-- () noexcept
  • _Self operator-- (int) noexcept
  • _Self & operator-= (difference_type __n) noexcept
  • pointer operator-> () const noexcept
  • _Deque_iterator & operator= (const _Deque_iterator &)=default
  • reference operator[] (difference_type __n) const noexcept

🧚 Static Public Member Functions 🧚

  • static size_t _S_buffer_size () noexcept

πŸ’– Public Attributes πŸ’–

  • _Elt_pointer _M_cur
  • _Elt_pointer _M_first
  • _Elt_pointer _M_last
  • _Map_pointer _M_node

πŸ¦‹ Friends πŸ¦‹

  • _Self operator+ (const _Self &__x, difference_type __n) noexcept
  • _Self operator+ (difference_type __n, const _Self &__x) noexcept

template friend operator-, exact:

template<typename _RefR , typename _PtrR > difference_type operator-
    (const _Self &__x, const _Deque_iterator< _Tp, _RefR, _PtrR > &__y)
    noexcept
  • difference_type operator- (const _Self &__x, const _Self &__y) noexcept
  • _Self operator- (const _Self &__x, difference_type __n) noexcept
  • strong_ordering operator<=> (const _Self &__x, const _Self &__y) noexcept

template friend operator==, exact:

template<typename _RefR , typename _PtrR > bool operator== (const _Self
    &__x, const _Deque_iterator< _Tp, _RefR, _PtrR > &__y) noexcept
  • bool operator== (const _Self &__x, const _Self &__y) noexcept

🧠 Detailed Description 🧠

the template + struct line is literally this, bestie:

template<typename _Tp, typename _Ref, typename _Ptr>
    struct std::_Deque_iterator< _Tp, _Ref, _Ptr >

and the description line in the source has that lil quote energy: "A deque::iterator.

so like, there is quite a bit of intelligence here. Much of the functionality of deque is actually passed off to this class. A deque holds two of these internally, marking its valid range. Access to elements is done as offsets of either of those two, relying on operator overloading in this class. periodt.

All the functions are op overloads except for _M_set_node. that's the rule, iykyk. πŸ’…

πŸ‘‘ Member Function Documentation πŸ‘‘

🌟 _M_set_node β€” the one non-op-overload icon

exact signature, no edits:

template<typename _Tp , typename _Ref , typename _Ptr > void
    std::_Deque_iterator< _Tp, _Ref, _Ptr >::_M_set_node (_Map_pointer
    __new_node) [inline],  [noexcept]

what she does: prepares to traverse new_node. Sets everything except _M_cur, which should therefore be set by the caller immediately afterwards, based on _M_first and _M_last. that's the whole assignment, bestie. 🫢

🌈 Author 🌈

Generated automatically by Doxygen for libstdc++ from the source code. she was built by the machine, not by us. iconic. πŸ€–πŸ’–


footer sign-off: source/version vibes from libstd, manual section 3cxx, and the date slot is not shown on this footer β€” she left it on read 😭. stay slay, bestie βœ¨πŸ’…πŸŽ€

πŸ“¦ where this page comes from