#include <block.h>
The BaseIterator internally is a pointer. So using it to iterate over an array or parts of it is as efficient as using a real pointer (for more ease of use you may want to invoke this via the C++11 range based for loop).
As already said you can use an Iterator almost like a pointer, e.g.
Please note that using a postfix operator access (*it++ or *it–) can be slower than using the prefix form or a separate assignment. E.g.
is most likely slower than
or
because *it++ requires a temporary copy of the iterator that the compiler may not be able to remove during optimization. As long as you only use the iterator's postfix operator without assignment it should be fine because the compiler will remove the temporary copy.
You can either type alias the BaseIterator (like the BaseArray does) or inherit from it.
COLLECTION | Type of the array. |
STRIDED | False for pointer-only iterator. True if the iterator has to support a variable stride offset (slower and requires another member variable). |
Classes | |
class | ResultFunctions |
Public Types | |
using | CollectionType = COLLECTION |
using | ValueType = typename InheritConst< typename COLLECTION::ValueType, COLLECTION >::type |
using | iterator_category = std::random_access_iterator_tag |
using | difference_type = Int |
using | value_type = ValueType |
using | pointer = ValueType * |
using | reference = ValueType & |
Static Public Attributes | |
static const Bool | isLinearIterator |
Protected Attributes | |
ValueType * | _data |
using CollectionType = COLLECTION |
using ValueType = typename InheritConst<typename COLLECTION::ValueType, COLLECTION>::type |
using iterator_category = std::random_access_iterator_tag |
using difference_type = Int |
using value_type = ValueType |
|
explicit |
|
explicit |
|
default |
|
default |
MAXON_ATTRIBUTE_FORCE_INLINE operator BaseIterator< typename std::add_const< COLLECTION >::type, STRIDED > & | ( | ) |
|
explicit |
MAXON_ATTRIBUTE_FORCE_INLINE ValueType* GetPtr | ( | ) | const |
MAXON_ATTRIBUTE_FORCE_INLINE ValueType& operator* | ( | ) | const |
MAXON_ATTRIBUTE_FORCE_INLINE ValueType* operator-> | ( | ) | const |
MAXON_ATTRIBUTE_FORCE_INLINE Bool operator== | ( | const BaseIterator< COLLECTION, STRIDED > & | b | ) | const |
MAXON_ATTRIBUTE_FORCE_INLINE Bool operator< | ( | const BaseIterator< COLLECTION, STRIDED > & | b | ) | const |
MAXON_OPERATOR_COMPARISON | ( | BaseIterator< COLLECTION, STRIDED > | ) |
MAXON_ATTRIBUTE_FORCE_INLINE BaseIterator& operator++ | ( | ) |
MAXON_ATTRIBUTE_FORCE_INLINE BaseIterator operator++ | ( | int | ) |
MAXON_ATTRIBUTE_FORCE_INLINE BaseIterator& operator+= | ( | Int | i | ) |
MAXON_ATTRIBUTE_FORCE_INLINE BaseIterator& operator-- | ( | ) |
MAXON_ATTRIBUTE_FORCE_INLINE BaseIterator operator-- | ( | int | ) |
MAXON_ATTRIBUTE_FORCE_INLINE BaseIterator& operator-= | ( | Int | i | ) |
MAXON_ATTRIBUTE_FORCE_INLINE BaseIterator operator+ | ( | Int | i | ) | const |
MAXON_ATTRIBUTE_FORCE_INLINE BaseIterator operator- | ( | Int | i | ) | const |
MAXON_ATTRIBUTE_FORCE_INLINE Int operator- | ( | const BaseIterator< COLLECTION, STRIDED > & | b | ) | const |
|
static |
|
protected |