msl 1.3.0
Loading...
Searching...
No Matches
msl::ConstIterator< T > Class Template Reference

Detailed Description

template<typename T>
class msl::ConstIterator< T >

Read-only iterator to a container.

#include <Iterator.h>

Public Member Functions

 ConstIterator (T const &container={})
 Create an iterator at the beginning of a container.
 
 ConstIterator (ConstIterator< T > const &)=default
 
 ConstIterator (ConstIterator< T > &&)=default
 
ConstIterator< T > & operator= (ConstIterator< T > const &)=default
 
ConstIterator< T > & operator= (ConstIterator< T > &&)=default
 
virtual ~ConstIterator ()=default
 
T const & container () const
 Return the container.
 
void setContainer (T const &container)
 Set the container, reset the counter.
 
std::size_t index () const
 Return the current index.
 
T::value_type const & item () const
 Return the current item.
 
std::size_t end () const
 Return the end value.
 
ConstIteratorreset ()
 Reset the iterator to the start of the container.
 
ConstIteratoroperator++ ()
 Move to the next element.
 
bool first () const
 Test if the index is 0.
 
bool last () const
 Test if the index is equal to end-1.
 
bool done () const
 Test if the index is equal to end.
 

Constructor & Destructor Documentation

◆ ConstIterator() [1/3]

template<typename T >
msl::ConstIterator< T >::ConstIterator ( T const &  container = {})
inline

Create an iterator at the beginning of a container.

◆ ConstIterator() [2/3]

template<typename T >
msl::ConstIterator< T >::ConstIterator ( ConstIterator< T > const &  )
default

◆ ConstIterator() [3/3]

template<typename T >
msl::ConstIterator< T >::ConstIterator ( ConstIterator< T > &&  )
default

◆ ~ConstIterator()

template<typename T >
virtual msl::ConstIterator< T >::~ConstIterator ( )
virtualdefault

Member Function Documentation

◆ operator=() [1/2]

template<typename T >
ConstIterator< T > & msl::ConstIterator< T >::operator= ( ConstIterator< T > const &  )
default

◆ operator=() [2/2]

template<typename T >
ConstIterator< T > & msl::ConstIterator< T >::operator= ( ConstIterator< T > &&  )
default

◆ container()

template<typename T >
T const & msl::ConstIterator< T >::container ( ) const
inline

Return the container.

◆ setContainer()

template<typename T >
void msl::ConstIterator< T >::setContainer ( T const &  container)
inline

Set the container, reset the counter.

◆ index()

template<typename T >
std::size_t msl::ConstIterator< T >::index ( ) const
inline

Return the current index.

◆ item()

template<typename T >
T::value_type const & msl::ConstIterator< T >::item ( ) const
inline

Return the current item.

◆ end()

template<typename T >
std::size_t msl::ConstIterator< T >::end ( ) const
inline

Return the end value.

◆ reset()

template<typename T >
ConstIterator & msl::ConstIterator< T >::reset ( )
inline

Reset the iterator to the start of the container.

◆ operator++()

template<typename T >
ConstIterator & msl::ConstIterator< T >::operator++ ( )
inline

Move to the next element.

Attention
No bound control is performed.

◆ first()

template<typename T >
bool msl::ConstIterator< T >::first ( ) const
inline

Test if the index is 0.

◆ last()

template<typename T >
bool msl::ConstIterator< T >::last ( ) const
inline

Test if the index is equal to end-1.

◆ done()

template<typename T >
bool msl::ConstIterator< T >::done ( ) const
inline

Test if the index is equal to end.


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