![]() |
ImFusion SDK 4.3
|
#include <ImFusion/Base/Utils/Iterators.h>
Typed convenience iterator for quick integration into custom containers, especially if traversal requires on-the-fly evaluations. More...
Typed convenience iterator for quick integration into custom containers, especially if traversal requires on-the-fly evaluations.
Note that operator* only returns T and not T&. For the same reason, there is no operator->. This supports pure rvalue expressions on regular dereferencing if you choose non-reference types for T.
For instance, TrackingSequence::matrix(int index) computes the matrix product registration*m_matrix[i]*calibration, so there is no container for direct traversal. Hence, a naive implementation of TrackingSequence::begin() and TrackingSequence::end() could look like this:
This allows:
Public Types | |
using | iterator_category = std::random_access_iterator_tag |
using | value_type = T |
using | difference_type = ptrdiff_t |
using | pointer = T* |
using | reference = T& |
using | LinIt = LinearIterator<T> |
Public Member Functions | |
LinearIterator (int pos, std::function< T(int)> func) | |
LinearIterator (const LinIt &)=default | |
int | index () const |
LinIt & | operator= (const LinIt &)=default |
T | operator* () const |
LinIt & | operator++ () |
LinIt | operator++ (int) |
LinIt & | operator-- () |
LinIt | operator-- (int) |
LinIt & | operator+= (int rhs) |
LinIt & | operator-= (int rhs) |
LinIt | operator+ (const LinIt &rhs) |
LinIt | operator+ (int rhs) |
std::ptrdiff_t | operator- (const LinIt &rhs) |
bool | operator== (const LinIt &rhs) |
bool | operator!= (const LinIt &rhs) |
Protected Attributes | |
int | m_pos |
std::function< T(int)> | m_func |