Simox  2.3.74.0
simox::iterator::XYIndexRangeIterator< IndexType > Class Template Reference
Inheritance diagram for simox::iterator::XYIndexRangeIterator< IndexType >:

Public Member Functions

 XYIndexRangeIterator (const IndexType &min_xy_index, const IndexType &max_xy_index)
 
 XYIndexRangeIterator (const IndexType &cell_limits)
 
XYIndexRangeIteratoroperator++ ()
 
IndexType & operator* ()
 
bool operator== (const XYIndexRangeIterator &other) const
 
bool operator!= (const XYIndexRangeIterator &other) const
 
XYIndexRangeIterator begin () const
 
XYIndexRangeIterator end () const
 

Detailed Description

template<typename IndexType = Point>
class simox::iterator::XYIndexRangeIterator< IndexType >

The XYIndexRangeIterator class.

The aim of this class is to provide a convenient way to iterate over 2D arrays This class provides a 2D iterator that returns all indices to the 2D array, e.g.

My2DArray arr(10, 20); for(auto [x,y] : XYIndexRangeIterator(arr)){ auto val = arr.at(x,y); // do the magic }

This is hightly inspired by cartographer::mapping::XYIndexRangeIterator see: https://github.com/cartographer-project/cartographer/blob/master/cartographer/mapping/2d/xy_index.h

Constructor & Destructor Documentation

◆ XYIndexRangeIterator() [1/2]

template<typename IndexType = Point>
simox::iterator::XYIndexRangeIterator< IndexType >::XYIndexRangeIterator ( const IndexType &  min_xy_index,
const IndexType &  max_xy_index 
)
inline

◆ XYIndexRangeIterator() [2/2]

template<typename IndexType = Point>
simox::iterator::XYIndexRangeIterator< IndexType >::XYIndexRangeIterator ( const IndexType &  cell_limits)
inlineexplicit

Member Function Documentation

◆ begin()

template<typename IndexType = Point>
XYIndexRangeIterator simox::iterator::XYIndexRangeIterator< IndexType >::begin ( ) const
inline

◆ end()

template<typename IndexType = Point>
XYIndexRangeIterator simox::iterator::XYIndexRangeIterator< IndexType >::end ( ) const
inline

◆ operator!=()

template<typename IndexType = Point>
bool simox::iterator::XYIndexRangeIterator< IndexType >::operator!= ( const XYIndexRangeIterator< IndexType > &  other) const
inline

◆ operator*()

template<typename IndexType = Point>
IndexType& simox::iterator::XYIndexRangeIterator< IndexType >::operator* ( )
inline

◆ operator++()

template<typename IndexType = Point>
XYIndexRangeIterator& simox::iterator::XYIndexRangeIterator< IndexType >::operator++ ( )
inline

◆ operator==()

template<typename IndexType = Point>
bool simox::iterator::XYIndexRangeIterator< IndexType >::operator== ( const XYIndexRangeIterator< IndexType > &  other) const
inline