AIToolbox
A library that offers tools for AI problem solving.
AIToolbox::IndexMapIterator< IdsIterator, Container > Class Template Reference

This class is a simple iterator to iterate over a container with the specified ids. More...

#include <AIToolbox/Utils/IndexMap.hpp>

Public Types

using iterator_category = typename IdsIterator::iterator_category
 
using value_type = typename Container::value_type
 
using pointer = value_type *
 
using reference = value_type &
 
using difference_type = typename IdsIterator::difference_type
 

Public Member Functions

 IndexMapIterator ()
 Basic constructor to respect iterator interface. More...
 
 IndexMapIterator (IdsIterator id, Container &items)
 Basic constructor. More...
 
auto toContainerId () const
 This function returns the equivalent item id of this iterator in its container. More...
 
auto & operator* ()
 
const auto & operator* () const
 
auto operator-> ()
 
auto operator-> () const
 
bool operator== (IndexMapIterator other) const
 
bool operator!= (IndexMapIterator other) const
 
auto & operator++ ()
 
auto operator++ (int)
 
template<typename U = iterator_category, typename = std::enable_if_t<std::is_same_v<U, std::bidirectional_iterator_tag> || std::is_same_v<U, std::random_access_iterator_tag>>>
auto operator-- ()
 
template<typename U = iterator_category, typename = std::enable_if_t<std::is_same_v<U, std::bidirectional_iterator_tag> || std::is_same_v<U, std::random_access_iterator_tag>>>
auto operator-- (int)
 
template<typename U = iterator_category, typename = std::enable_if_t<std::is_same_v<U, std::random_access_iterator_tag>>>
auto operator+ (difference_type diff) const
 
template<typename U = iterator_category, typename = std::enable_if_t<std::is_same_v<U, std::random_access_iterator_tag>>>
auto operator+= (difference_type diff)
 
template<typename U = iterator_category, typename = std::enable_if_t<std::is_same_v<U, std::random_access_iterator_tag>>>
auto operator- (difference_type diff) const
 
template<typename U = iterator_category, typename = std::enable_if_t<std::is_same_v<U, std::random_access_iterator_tag>>>
auto operator-= (difference_type diff)
 
template<typename U = iterator_category, typename = std::enable_if_t<std::is_same_v<U, std::random_access_iterator_tag>>>
auto operator- (IndexMapIterator other) const
 
template<typename U = iterator_category, typename = std::enable_if_t<std::is_same_v<U, std::random_access_iterator_tag>>>
bool operator< (IndexMapIterator other) const
 
template<typename U = iterator_category, typename = std::enable_if_t<std::is_same_v<U, std::random_access_iterator_tag>>>
bool operator> (IndexMapIterator other) const
 
template<typename U = iterator_category, typename = std::enable_if_t<std::is_same_v<U, std::random_access_iterator_tag>>>
bool operator<= (IndexMapIterator other) const
 
template<typename U = iterator_category, typename = std::enable_if_t<std::is_same_v<U, std::random_access_iterator_tag>>>
bool operator>= (IndexMapIterator other) const
 
template<typename U = iterator_category, typename = std::enable_if_t<std::is_same_v<U, std::random_access_iterator_tag>>>
auto & operator[] (difference_type diff)
 
template<typename U = iterator_category, typename = std::enable_if_t<std::is_same_v<U, std::random_access_iterator_tag>>>
const auto & operator[] (difference_type diff) const
 

Detailed Description

template<typename IdsIterator, typename Container>
class AIToolbox::IndexMapIterator< IdsIterator, Container >

This class is a simple iterator to iterate over a container with the specified ids.

Member Typedef Documentation

◆ difference_type

template<typename IdsIterator , typename Container >
using AIToolbox::IndexMapIterator< IdsIterator, Container >::difference_type = typename IdsIterator::difference_type

◆ iterator_category

template<typename IdsIterator , typename Container >
using AIToolbox::IndexMapIterator< IdsIterator, Container >::iterator_category = typename IdsIterator::iterator_category

◆ pointer

template<typename IdsIterator , typename Container >
using AIToolbox::IndexMapIterator< IdsIterator, Container >::pointer = value_type *

◆ reference

template<typename IdsIterator , typename Container >
using AIToolbox::IndexMapIterator< IdsIterator, Container >::reference = value_type &

◆ value_type

template<typename IdsIterator , typename Container >
using AIToolbox::IndexMapIterator< IdsIterator, Container >::value_type = typename Container::value_type

Constructor & Destructor Documentation

◆ IndexMapIterator() [1/2]

template<typename IdsIterator , typename Container >
AIToolbox::IndexMapIterator< IdsIterator, Container >::IndexMapIterator ( )
inline

Basic constructor to respect iterator interface.

◆ IndexMapIterator() [2/2]

template<typename IdsIterator , typename Container >
AIToolbox::IndexMapIterator< IdsIterator, Container >::IndexMapIterator ( IdsIterator  id,
Container &  items 
)
inline

Basic constructor.

Parameters
idAn iterator to an index range.
itemsThe parent iterable object holding ids and values.

Member Function Documentation

◆ operator!=()

template<typename IdsIterator , typename Container >
bool AIToolbox::IndexMapIterator< IdsIterator, Container >::operator!= ( IndexMapIterator< IdsIterator, Container >  other) const
inline

◆ operator*() [1/2]

template<typename IdsIterator , typename Container >
auto& AIToolbox::IndexMapIterator< IdsIterator, Container >::operator* ( )
inline

◆ operator*() [2/2]

template<typename IdsIterator , typename Container >
const auto& AIToolbox::IndexMapIterator< IdsIterator, Container >::operator* ( ) const
inline

◆ operator+()

template<typename IdsIterator , typename Container >
template<typename U = iterator_category, typename = std::enable_if_t<std::is_same_v<U, std::random_access_iterator_tag>>>
auto AIToolbox::IndexMapIterator< IdsIterator, Container >::operator+ ( difference_type  diff) const
inline

◆ operator++() [1/2]

template<typename IdsIterator , typename Container >
auto& AIToolbox::IndexMapIterator< IdsIterator, Container >::operator++ ( )
inline

◆ operator++() [2/2]

template<typename IdsIterator , typename Container >
auto AIToolbox::IndexMapIterator< IdsIterator, Container >::operator++ ( int  )
inline

◆ operator+=()

template<typename IdsIterator , typename Container >
template<typename U = iterator_category, typename = std::enable_if_t<std::is_same_v<U, std::random_access_iterator_tag>>>
auto AIToolbox::IndexMapIterator< IdsIterator, Container >::operator+= ( difference_type  diff)
inline

◆ operator-() [1/2]

template<typename IdsIterator , typename Container >
template<typename U = iterator_category, typename = std::enable_if_t<std::is_same_v<U, std::random_access_iterator_tag>>>
auto AIToolbox::IndexMapIterator< IdsIterator, Container >::operator- ( difference_type  diff) const
inline

◆ operator-() [2/2]

template<typename IdsIterator , typename Container >
template<typename U = iterator_category, typename = std::enable_if_t<std::is_same_v<U, std::random_access_iterator_tag>>>
auto AIToolbox::IndexMapIterator< IdsIterator, Container >::operator- ( IndexMapIterator< IdsIterator, Container >  other) const
inline

◆ operator--() [1/2]

template<typename IdsIterator , typename Container >
template<typename U = iterator_category, typename = std::enable_if_t<std::is_same_v<U, std::bidirectional_iterator_tag> || std::is_same_v<U, std::random_access_iterator_tag>>>
auto AIToolbox::IndexMapIterator< IdsIterator, Container >::operator-- ( )
inline

◆ operator--() [2/2]

template<typename IdsIterator , typename Container >
template<typename U = iterator_category, typename = std::enable_if_t<std::is_same_v<U, std::bidirectional_iterator_tag> || std::is_same_v<U, std::random_access_iterator_tag>>>
auto AIToolbox::IndexMapIterator< IdsIterator, Container >::operator-- ( int  )
inline

◆ operator-=()

template<typename IdsIterator , typename Container >
template<typename U = iterator_category, typename = std::enable_if_t<std::is_same_v<U, std::random_access_iterator_tag>>>
auto AIToolbox::IndexMapIterator< IdsIterator, Container >::operator-= ( difference_type  diff)
inline

◆ operator->() [1/2]

template<typename IdsIterator , typename Container >
auto AIToolbox::IndexMapIterator< IdsIterator, Container >::operator-> ( )
inline

◆ operator->() [2/2]

template<typename IdsIterator , typename Container >
auto AIToolbox::IndexMapIterator< IdsIterator, Container >::operator-> ( ) const
inline

◆ operator<()

template<typename IdsIterator , typename Container >
template<typename U = iterator_category, typename = std::enable_if_t<std::is_same_v<U, std::random_access_iterator_tag>>>
bool AIToolbox::IndexMapIterator< IdsIterator, Container >::operator< ( IndexMapIterator< IdsIterator, Container >  other) const
inline

◆ operator<=()

template<typename IdsIterator , typename Container >
template<typename U = iterator_category, typename = std::enable_if_t<std::is_same_v<U, std::random_access_iterator_tag>>>
bool AIToolbox::IndexMapIterator< IdsIterator, Container >::operator<= ( IndexMapIterator< IdsIterator, Container >  other) const
inline

◆ operator==()

template<typename IdsIterator , typename Container >
bool AIToolbox::IndexMapIterator< IdsIterator, Container >::operator== ( IndexMapIterator< IdsIterator, Container >  other) const
inline

◆ operator>()

template<typename IdsIterator , typename Container >
template<typename U = iterator_category, typename = std::enable_if_t<std::is_same_v<U, std::random_access_iterator_tag>>>
bool AIToolbox::IndexMapIterator< IdsIterator, Container >::operator> ( IndexMapIterator< IdsIterator, Container >  other) const
inline

◆ operator>=()

template<typename IdsIterator , typename Container >
template<typename U = iterator_category, typename = std::enable_if_t<std::is_same_v<U, std::random_access_iterator_tag>>>
bool AIToolbox::IndexMapIterator< IdsIterator, Container >::operator>= ( IndexMapIterator< IdsIterator, Container >  other) const
inline

◆ operator[]() [1/2]

template<typename IdsIterator , typename Container >
template<typename U = iterator_category, typename = std::enable_if_t<std::is_same_v<U, std::random_access_iterator_tag>>>
auto& AIToolbox::IndexMapIterator< IdsIterator, Container >::operator[] ( difference_type  diff)
inline

◆ operator[]() [2/2]

template<typename IdsIterator , typename Container >
template<typename U = iterator_category, typename = std::enable_if_t<std::is_same_v<U, std::random_access_iterator_tag>>>
const auto& AIToolbox::IndexMapIterator< IdsIterator, Container >::operator[] ( difference_type  diff) const
inline

◆ toContainerId()

template<typename IdsIterator , typename Container >
auto AIToolbox::IndexMapIterator< IdsIterator, Container >::toContainerId ( ) const
inline

This function returns the equivalent item id of this iterator in its container.


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