AlgoPlus v0.1.0
Loading...
Searching...
No Matches
frequency_list< T >::Iterator Class Reference

Public Member Functions

 Iterator (const std::shared_ptr< node > &ptr) noexcept
 Iterator class for a linked list.
 
Iteratoroperator= (const std::shared_ptr< node > &ptr)
 Assignment operator for the Iterator class.
 
Iteratoroperator++ ()
 Pre-increment operator for the Iterator class.
 
Iterator operator++ (int)
 Post-increment operator for the Iterator class.
 
Iteratoroperator-- ()
 Pre-increment – operator for the Iterator class. This operator overloads the pre-increment operator (–). It increments the iterator to the next node and returns a reference to the updated iterator.
 
Iterator operator-- (int)
 Post-increment –operator for the Iterator class. This operator overloads the post-increment operator (–). It increments the iterator to the next node and returns a copy of the iterator before the increment.
 
bool operator== (const Iterator &it)
 Equality operator for the Iterator class.
 
bool operator!= (const Iterator &it)
 Inequality operator for the Iterator class.
 
operator* ()
 Dereference operator for the Iterator class.
 

Constructor & Destructor Documentation

◆ Iterator()

template<typename T >
frequency_list< T >::Iterator::Iterator ( const std::shared_ptr< node > & ptr)
inlineexplicitnoexcept

Iterator class for a linked list.

The Iterator class provides an iterator for traversing a linked list.

Member Function Documentation

◆ operator!=()

template<typename T >
bool frequency_list< T >::Iterator::operator!= ( const Iterator & it)
inline

Inequality operator for the Iterator class.

This operator checks if two iterators are not equal by comparing their current nodes.

Parameters
itThe other Iterator object to compare with.
Returns
true if the iterators are not equal, false otherwise.

◆ operator*()

template<typename T >
T frequency_list< T >::Iterator::operator* ( )
inline

Dereference operator for the Iterator class.

Returns
The data pointed to by the current node.

◆ operator++() [1/2]

template<typename T >
Iterator & frequency_list< T >::Iterator::operator++ ( )
inline

Pre-increment operator for the Iterator class.

This operator overloads the pre-increment operator (++). It increments the iterator to the next node and returns a reference to the updated iterator.

Returns
A reference to the updated iterator.

◆ operator++() [2/2]

template<typename T >
Iterator frequency_list< T >::Iterator::operator++ ( int )
inline

Post-increment operator for the Iterator class.

This operator overloads the post-increment operator (++). It increments the iterator to the next node and returns a copy of the iterator before the increment.

Returns
A copy of the iterator before the increment.

◆ operator--() [1/2]

template<typename T >
Iterator & frequency_list< T >::Iterator::operator-- ( )
inline

Pre-increment – operator for the Iterator class. This operator overloads the pre-increment operator (–). It increments the iterator to the next node and returns a reference to the updated iterator.

Returns
Iterator&

◆ operator--() [2/2]

template<typename T >
Iterator frequency_list< T >::Iterator::operator-- ( int )
inline

Post-increment –operator for the Iterator class. This operator overloads the post-increment operator (–). It increments the iterator to the next node and returns a copy of the iterator before the increment.

Returns
Iterator

◆ operator=()

template<typename T >
Iterator & frequency_list< T >::Iterator::operator= ( const std::shared_ptr< node > & ptr)
inline

Assignment operator for the Iterator class.

It assigns the value of the given shared pointer to the current node of the iterator and returns a reference to the updated iterator.

Parameters
ptrThe shared pointer to assign.
Returns
A reference to the updated iterator.

◆ operator==()

template<typename T >
bool frequency_list< T >::Iterator::operator== ( const Iterator & it)
inline

Equality operator for the Iterator class.

This operator checks if two iterators are equal by comparing their current nodes.

Parameters
itThe other Iterator object to compare with.
Returns
true if the iterators are equal, false otherwise.

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