ipaddress 1.2.0
Loading...
Searching...
No Matches
fixed_vector_iterator< T > Class Template Reference

A fixed-size vector iterator class template. More...

#include <fixed-vector.hpp>

Public Types

using iterator_category = std::random_access_iterator_tag
 The iterator category.
 
using value_type = T
 The type of the elements.
 
using difference_type = ptrdiff_t
 The type used for representing differences between iterators.
 
using pointer = T*
 Pointer to the element type.
 
using reference = T&
 Reference to the element type.
 

Public Member Functions

constexpr inline fixed_vector_iterator () noexcept=default
 Default constructor.
 
constexpr inline fixed_vector_iterator (pointer ptr) noexcept
 Constructs a fixed_vector_iterator from a pointer.
 
template<typename U , typename = typename std::enable_if<std::is_convertible<U*, T*>::value>::type>
constexpr inline fixed_vector_iterator (const fixed_vector_iterator< U > &it) noexcept
 Constructs a const-compatible fixed_vector_iterator from a non-const fixed_vector_iterator.
 
constexpr inline reference operator* () const noexcept
 Dereference operator.
 
constexpr inline pointer operator-> () const noexcept
 Pointer access operator.
 
constexpr inline reference operator[] (size_t n) const noexcept
 Access operator.
 
constexpr inline fixed_vector_iteratoroperator++ () noexcept
 Pre-increment operator.
 
constexpr inline fixed_vector_iterator operator++ (int) noexcept
 Post-increment operator.
 
constexpr inline fixed_vector_iteratoroperator-- () noexcept
 Pre-decrement operator.
 
constexpr inline fixed_vector_iterator operator-- (int) noexcept
 Post-decrement operator.
 
constexpr inline fixed_vector_iteratoroperator+= (difference_type n) noexcept
 Addition assignment operator.
 
constexpr inline fixed_vector_iteratoroperator-= (difference_type n) noexcept
 Subtraction assignment operator.
 
constexpr inline fixed_vector_iterator operator+ (difference_type n) const noexcept
 Addition operator.
 
constexpr inline fixed_vector_iterator operator- (difference_type n) const noexcept
 Subtraction operator.
 
constexpr inline difference_type operator- (const fixed_vector_iterator &it) const noexcept
 Subtraction operator.
 
constexpr inline bool operator== (const fixed_vector_iterator &it) const noexcept
 Equality operator.
 
constexpr inline bool operator!= (const fixed_vector_iterator &it) const noexcept
 Inequality operator.
 
constexpr inline bool operator< (const fixed_vector_iterator &it) const noexcept
 Less than operator.
 
constexpr inline bool operator<= (const fixed_vector_iterator &it) const noexcept
 Less than or equal to operator.
 
constexpr inline bool operator> (const fixed_vector_iterator &it) const noexcept
 Greater than operator.
 
constexpr inline bool operator>= (const fixed_vector_iterator &it) const noexcept
 Greater than or equal to operator.
 

Detailed Description

template<typename T>
class ipaddress::fixed_vector_iterator< T >

A fixed-size vector iterator class template.

The fixed_vector_iterator class template provides an iterator for the fixed_vector class template. It allows for iteration over the elements in the fixed_vector.

Template Parameters
Ttype of the elements in the vector.

Constructor & Destructor Documentation

◆ fixed_vector_iterator() [1/2]

template<typename T >
inline fixed_vector_iterator ( pointer ptr)
inlineexplicitnoexcept

Constructs a fixed_vector_iterator from a pointer.

Parameters
[in]ptrThe pointer to the element type.

◆ fixed_vector_iterator() [2/2]

template<typename T >
template<typename U , typename = typename std::enable_if<std::is_convertible<U*, T*>::value>::type>
inline fixed_vector_iterator ( const fixed_vector_iterator< U > & it)
inlinenoexcept

Constructs a const-compatible fixed_vector_iterator from a non-const fixed_vector_iterator.

Parameters
[in]itThe iterator to convert.

Member Function Documentation

◆ operator*()

template<typename T >
inline reference operator* ( ) const
inlinenodiscardnoexcept

Dereference operator.

Returns
A reference to the element pointed to by the iterator.

◆ operator->()

template<typename T >
inline pointer operator-> ( ) const
inlinenodiscardnoexcept

Pointer access operator.

Returns
A pointer to the element pointed to by the iterator.

◆ operator[]()

template<typename T >
inline reference operator[] ( size_t n) const
inlinenodiscardnoexcept

Access operator.

Parameters
[in]nThe index of the element to access.
Returns
A reference to the element at index n.

◆ operator++() [1/2]

template<typename T >
inline fixed_vector_iterator & operator++ ( )
inlinenoexcept

Pre-increment operator.

Returns
A reference to the iterator after incrementing.

◆ operator++() [2/2]

template<typename T >
inline fixed_vector_iterator operator++ ( int )
inlinenoexcept

Post-increment operator.

Returns
A copy of the iterator before incrementing.

◆ operator--() [1/2]

template<typename T >
inline fixed_vector_iterator & operator-- ( )
inlinenoexcept

Pre-decrement operator.

Returns
A reference to the iterator after decrementing.

◆ operator--() [2/2]

template<typename T >
inline fixed_vector_iterator operator-- ( int )
inlinenoexcept

Post-decrement operator.

Returns
A copy of the iterator before decrementing.

◆ operator+=()

template<typename T >
inline fixed_vector_iterator & operator+= ( difference_type n)
inlinenoexcept

Addition assignment operator.

Parameters
[in]nThe number of elements to add.
Returns
A reference to the iterator after addition.

◆ operator-=()

template<typename T >
inline fixed_vector_iterator & operator-= ( difference_type n)
inlinenoexcept

Subtraction assignment operator.

Parameters
[in]nThe number of elements to subtract.
Returns
A reference to the iterator after subtraction.

◆ operator+()

template<typename T >
inline fixed_vector_iterator operator+ ( difference_type n) const
inlinenodiscardnoexcept

Addition operator.

Parameters
[in]nThe number of elements to add.
Returns
A new fixed_vector_iterator instance after addition.

◆ operator-() [1/2]

template<typename T >
inline fixed_vector_iterator operator- ( difference_type n) const
inlinenodiscardnoexcept

Subtraction operator.

Parameters
[in]nThe number of elements to subtract.
Returns
A new fixed_vector_iterator instance after subtraction.

◆ operator-() [2/2]

template<typename T >
inline difference_type operator- ( const fixed_vector_iterator< T > & it) const
inlinenodiscardnoexcept

Subtraction operator.

Parameters
[in]itThe iterator to subtract from.
Returns
The difference between the two iterators.

◆ operator==()

template<typename T >
inline bool operator== ( const fixed_vector_iterator< T > & it) const
inlinenodiscardnoexcept

Equality operator.

Parameters
[in]itThe iterator to compare with.
Returns
true if this iterator is equal to the other iterator, false otherwise.

◆ operator!=()

template<typename T >
inline bool operator!= ( const fixed_vector_iterator< T > & it) const
inlinenodiscardnoexcept

Inequality operator.

Parameters
[in]itThe iterator to compare with.
Returns
true if this iterator is not equal to the other iterator, false otherwise.

◆ operator<()

template<typename T >
inline bool operator< ( const fixed_vector_iterator< T > & it) const
inlinenodiscardnoexcept

Less than operator.

Parameters
[in]itThe iterator to compare with.
Returns
true if this iterator is less than the other iterator, false otherwise.

◆ operator<=()

template<typename T >
inline bool operator<= ( const fixed_vector_iterator< T > & it) const
inlinenodiscardnoexcept

Less than or equal to operator.

Parameters
[in]itThe iterator to compare with.
Returns
true if this iterator is less than or equal to the other iterator, false otherwise.

◆ operator>()

template<typename T >
inline bool operator> ( const fixed_vector_iterator< T > & it) const
inlinenodiscardnoexcept

Greater than operator.

Parameters
[in]itThe iterator to compare with.
Returns
true if this iterator is greater than the other iterator, false otherwise.

◆ operator>=()

template<typename T >
inline bool operator>= ( const fixed_vector_iterator< T > & it) const
inlinenodiscardnoexcept

Greater than or equal to operator.

Parameters
[in]itThe iterator to compare with.
Returns
true if this iterator is greater than or equal to the other iterator, false otherwise.

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