Struct timeout_queue_t::const_iterator

Nested Relationships

This struct is a nested type of Template Class timeout_queue_t.

Struct Documentation

struct const_iterator

Const iterator that yields only non-expired elements in the queue.

Public Types

using base_iter = typename base_t::const_iterator
using iterator_category = std::forward_iterator_tag
using value_type = type
using difference_type = typename std::iterator_traits<base_iter>::difference_type
using reference = const type&
using pointer = const type*

Public Functions

const_iterator() = default

Default constructor.

inline const_iterator(const timeout_queue_t *o_, base_iter i_, base_iter e_)

Construct a const_iterator.

Parameters:
  • o_ – Queue instance that owns this iterator.

  • i_ – Current list iterator position.

  • e_ – Sentinel iterator marking the end position.

inline const_iterator(const iterator &other_)

Allow converting iterator to const_iterator.

Parameters:

other_ – Mutable iterator whose state is copied.

inline reference operator*() const

Dereferences the iterator.

inline pointer operator->() const

Accesses the current element pointer.

inline const_iterator &operator++()

Pre-increment operator.

inline const_iterator operator++(int int_)

Post-increment operator.

Parameters:

int_ – Dummy integer used to select postfix increment syntax.

Returns:

Iterator snapshot before incrementing.

Public Members

const timeout_queue_t *owner = nullptr

Pointer to the owning queue.

base_iter it = {}
base_iter end = {}

Underlying iterators.

Private Functions

inline void __skip_expired()

Skip expired elements and collect them in timedOutItems.

Friends

inline friend bool operator==(const const_iterator &a_, const const_iterator &b_)

Equality comparison.

Parameters:
  • a_ – Left iterator in the comparison.

  • b_ – Right iterator in the comparison.

Returns:

true when both iterators point to the same list position.

inline friend bool operator!=(const const_iterator &a_, const const_iterator &b_)

Inequality comparison.

Parameters:
  • a_ – Left iterator in the comparison.

  • b_ – Right iterator in the comparison.

Returns:

true when iterators point to different list positions.