20 template <
typename ListNode, const ListNode * (*Next)(const ListNode *)>
43 _current = Next(_current);
53 const ListNode&
operator*() const noexcept {
return *_current; }
61 const ListNode *
operator->() const noexcept {
return _current; }
81 private:
const ListNode *_current;
85template <
typename ListNode, const ListNode * (*Next)(const ListNode *)>
Definition: assert.hpp:13
ListNode value_type
Definition: iterators.hpp:89
const ListNode * pointer
Definition: iterators.hpp:90
std::forward_iterator_tag iterator_category
Definition: iterators.hpp:92
std::ptrdiff_t difference_type
Definition: iterators.hpp:88
const ListNode & reference
Definition: iterators.hpp:91
A forward iterator for linked lists.
Definition: iterators.hpp:22
const_list_iterator & operator++() noexcept
Advances to the next linked list node.
Definition: iterators.hpp:41
const ListNode & operator*() const noexcept
Gets a reference to the linked list node pointed to by this iterator.
Definition: iterators.hpp:53
const_list_iterator(const ListNode *current) noexcept
Constructs an iterator pointing to the specified linked list node.
Definition: iterators.hpp:33
bool operator!=(const_list_iterator const &rhs) const noexcept
Tests if this object and rhs point to the same linked list node.
Definition: iterators.hpp:79
bool operator==(const_list_iterator const &rhs) const noexcept
Tests if this object and rhs point to the same linked list node.
Definition: iterators.hpp:70
const_list_iterator() noexcept
Constructs an end iterator.
Definition: iterators.hpp:26
const ListNode * operator->() const noexcept
Gets a pointer to the linked list node pointed to by this iterator.
Definition: iterators.hpp:61