libcppwrap
A collection of C++ wrappers for native APIs
Loading...
Searching...
No Matches
Public Member Functions | List of all members
w::const_list_iterator< ListNode, Next > Struct Template Reference

A forward iterator for linked lists. More...

#include <iterators.hpp>

Public Member Functions

 const_list_iterator () noexcept
 Constructs an end iterator. More...
 
 const_list_iterator (const ListNode *current) noexcept
 Constructs an iterator pointing to the specified linked list node. More...
 
const_list_iteratoroperator++ () noexcept
 Advances to the next linked list node. More...
 
const ListNode & operator* () const noexcept
 Gets a reference to the linked list node pointed to by this iterator. More...
 
const ListNode * operator-> () const noexcept
 Gets a pointer to the linked list node pointed to by this iterator. More...
 
bool operator== (const_list_iterator const &rhs) const noexcept
 Tests if this object and rhs point to the same linked list node. More...
 
bool operator!= (const_list_iterator const &rhs) const noexcept
 Tests if this object and rhs point to the same linked list node. More...
 

Detailed Description

template<typename ListNode, const ListNode *(*)(const ListNode *) Next>
struct w::const_list_iterator< ListNode, Next >

A forward iterator for linked lists.

Template Parameters
ListNodeThe type of the linked list node.
NextA mutator function which, given a pointer to a linked list node, returns a pointer to the next linked list node.

Constructor & Destructor Documentation

◆ const_list_iterator() [1/2]

template<typename ListNode , const ListNode *(*)(const ListNode *) Next>
w::const_list_iterator< ListNode, Next >::const_list_iterator ( )
inlinenoexcept

Constructs an end iterator.

◆ const_list_iterator() [2/2]

template<typename ListNode , const ListNode *(*)(const ListNode *) Next>
w::const_list_iterator< ListNode, Next >::const_list_iterator ( const ListNode *  current)
inlinenoexcept

Constructs an iterator pointing to the specified linked list node.

Parameters
currentThe linked list node to point to.

Member Function Documentation

◆ operator!=()

template<typename ListNode , const ListNode *(*)(const ListNode *) Next>
bool w::const_list_iterator< ListNode, Next >::operator!= ( const_list_iterator< ListNode, Next > const &  rhs) const
inlinenoexcept

Tests if this object and rhs point to the same linked list node.

Parameters
rhsThe other iterator to compare.
Returns
true if and only if this object and rhs point to different linked list nodes.

◆ operator*()

template<typename ListNode , const ListNode *(*)(const ListNode *) Next>
const ListNode & w::const_list_iterator< ListNode, Next >::operator* ( ) const
inlinenoexcept

Gets a reference to the linked list node pointed to by this iterator.

The behavior is undefined if this is an end iterator.

Returns
a reference to the linked list node pointed to by this iterator

◆ operator++()

template<typename ListNode , const ListNode *(*)(const ListNode *) Next>
const_list_iterator & w::const_list_iterator< ListNode, Next >::operator++ ( )
inlinenoexcept

Advances to the next linked list node.

The behavior is undefined if this is an end iterator.

Returns
A reference to this object.

◆ operator->()

template<typename ListNode , const ListNode *(*)(const ListNode *) Next>
const ListNode * w::const_list_iterator< ListNode, Next >::operator-> ( ) const
inlinenoexcept

Gets a pointer to the linked list node pointed to by this iterator.

Returns
a pointer to the linked list node pointed to by this iterator, or nullptr if this is an end iterator.

◆ operator==()

template<typename ListNode , const ListNode *(*)(const ListNode *) Next>
bool w::const_list_iterator< ListNode, Next >::operator== ( const_list_iterator< ListNode, Next > const &  rhs) const
inlinenoexcept

Tests if this object and rhs point to the same linked list node.

Parameters
rhsThe other iterator to compare.
Returns
true if and only if this object and rhs point to the same linked list node.

The documentation for this struct was generated from the following file: