semf
semf::LinkedQueue< T >::ConstIterator Class Reference

Implementation of a forward constant iterator for LinkedQueue. More...

#include <linkedqueue.h>

Collaboration diagram for semf::LinkedQueue< T >::ConstIterator:
Collaboration graph

Public Types

using iterator_category = std::forward_iterator_tag
 
using value_type = T
 
using difference_type = std::ptrdiff_t
 
using pointer = T *
 
using refernce = T &
 

Public Member Functions

 ConstIterator ()=default
 
 ConstIterator (const T *element)
 Constructor with member variable initialization. More...
 
 ConstIterator (const Iterator &iterator)
 Copy constructor. More...
 
virtual ~ConstIterator ()=default
 
const T & operator* () const
 Returns the reference of the element the iterator's position. More...
 
const T * operator-> () const
 Returns the pointer into the element the iterator's position. More...
 
ConstIteratoroperator++ ()
 Iterates to the next element in the queue. More...
 
ConstIterator operator++ (int)
 Iterates to the next element in the queue. More...
 
bool operator== (const ConstIterator &other) const
 Compares this element with that element. More...
 
bool operator!= (const ConstIterator &other) const
 Compares this element with that element. More...
 

Detailed Description

template<class T>
class semf::LinkedQueue< T >::ConstIterator

Implementation of a forward constant iterator for LinkedQueue.

Definition at line 181 of file linkedqueue.h.

Member Typedef Documentation

◆ difference_type

template<class T >
using semf::LinkedQueue< T >::ConstIterator::difference_type = std::ptrdiff_t

Definition at line 186 of file linkedqueue.h.

◆ iterator_category

template<class T >
using semf::LinkedQueue< T >::ConstIterator::iterator_category = std::forward_iterator_tag

Definition at line 184 of file linkedqueue.h.

◆ pointer

template<class T >
using semf::LinkedQueue< T >::ConstIterator::pointer = T*

Definition at line 187 of file linkedqueue.h.

◆ refernce

template<class T >
using semf::LinkedQueue< T >::ConstIterator::refernce = T&

Definition at line 188 of file linkedqueue.h.

◆ value_type

template<class T >
using semf::LinkedQueue< T >::ConstIterator::value_type = T

Definition at line 185 of file linkedqueue.h.

Constructor & Destructor Documentation

◆ ConstIterator() [1/3]

template<class T >
semf::LinkedQueue< T >::ConstIterator::ConstIterator ( )
default

◆ ConstIterator() [2/3]

template<class T >
semf::LinkedQueue< T >::ConstIterator::ConstIterator ( const T *  element)
inlineexplicit

Constructor with member variable initialization.

Parameters
elementPointer to the element starting iterating.

Definition at line 195 of file linkedqueue.h.

◆ ConstIterator() [3/3]

template<class T >
semf::LinkedQueue< T >::ConstIterator::ConstIterator ( const Iterator iterator)
inlineexplicit

Copy constructor.

Parameters
iteratoriterator to copy from.

Definition at line 203 of file linkedqueue.h.

◆ ~ConstIterator()

template<class T >
virtual semf::LinkedQueue< T >::ConstIterator::~ConstIterator ( )
virtualdefault

Member Function Documentation

◆ operator!=()

template<class T >
bool semf::LinkedQueue< T >::ConstIterator::operator!= ( const ConstIterator other) const
inline

Compares this element with that element.

Parameters
otherIterator to compare.
Returns
true for both iterators are different elements; false for both iterators are the same element.

Definition at line 268 of file linkedqueue.h.

◆ operator*()

template<class T >
const T & semf::LinkedQueue< T >::ConstIterator::operator* ( ) const
inline

Returns the reference of the element the iterator's position.

Attention
Using the reference for an iterator being nullptr (e.g. LinkedQueue::end) leads to undefined behavior.
Returns
Reference to the element.

Definition at line 215 of file linkedqueue.h.

◆ operator++() [1/2]

template<class T >
ConstIterator & semf::LinkedQueue< T >::ConstIterator::operator++ ( )
inline

Iterates to the next element in the queue.

Attention
Using the reference for an iterator being nullptr (e.g. LinkedQueue::end) leads to undefined behavior.
Returns
Next element in the queue.

Definition at line 235 of file linkedqueue.h.

◆ operator++() [2/2]

template<class T >
ConstIterator semf::LinkedQueue< T >::ConstIterator::operator++ ( int  )
inline

Iterates to the next element in the queue.

Attention
Using the reference for an iterator being nullptr (e.g. LinkedQueue::end) leads to undefined behavior.
Returns
Next element in the queue.

Definition at line 246 of file linkedqueue.h.

◆ operator->()

template<class T >
const T * semf::LinkedQueue< T >::ConstIterator::operator-> ( ) const
inline

Returns the pointer into the element the iterator's position.

Attention
Using the reference for an iterator being nullptr (e.g. LinkedQueue::end) leads to undefined behavior.
Returns
Pointer into the element.

Definition at line 225 of file linkedqueue.h.

◆ operator==()

template<class T >
bool semf::LinkedQueue< T >::ConstIterator::operator== ( const ConstIterator other) const
inline

Compares this element with that element.

Parameters
otherIterator to compare.
Returns
true for both iterator's position is the same element; false for both iterator's position are different elements.

Definition at line 258 of file linkedqueue.h.