 |
Belle II Software
release-05-02-19
|
25 template <
class ArrayType,
class ValueType>
class ObjArrayIterator:
public std::iterator<std::forward_iterator_tag, ValueType> {
45 m_array = array->GetObjectRef() + (end ? array->GetEntriesFast() : 0);
67 ValueType&
operator*()
const {
return *
static_cast<ValueType*
>(*m_array); }
87 template <
class ArrayType,
class ValueType>
88 class ArrayIterator :
public std::iterator<std::forward_iterator_tag, ValueType> {
bool operator==(const ObjArrayIterator< ArrayType, ValueType > &rhs) const
check equality.
ObjArrayIterator(ArrayType const *const *array, bool end=false)
Convenience constructor because we usually have a TClonesArray** member so this takes cares of the ch...
static ValueType & deref_if_needed(ValueType *t)
dereference if argument is a pointer to ValueType.
ArrayIterator< ArrayType, ValueType > & operator++()
prefix increment.
bool operator!=(const ObjArrayIterator< ArrayType, ValueType > &rhs) const
check inequality.
ObjArrayIterator()=default
default constructor
ArrayIterator()
Default constructor (not that you can dereference these).
TObject ** m_array
pointer to the fCont member of the TObjArray
Optimizes class to iterate over TObjArray and classes inheriting from it.
Generic iterator class for arrays, allowing use of STL algorithms, range-based for etc.
static ValueType & deref_if_needed(ValueType &t)
dereference if argument is a pointer to ValueType.
ValueType * operator->() const
dereference.
ObjArrayIterator< ArrayType, ValueType > operator++(int)
postfix increment
ArrayIterator(const ArrayType *array, int index)
Constructor.
ValueType & operator*() const
dereference.
Abstract base class for different kinds of events.
int m_index
Current index.
const ArrayType * m_array
Array to iterate over.
ObjArrayIterator(ArrayType const *array, bool end=false)
Convenience constructor in case of a TClonesArray pointer.
bool operator!=(const ArrayIterator< ArrayType, ValueType > &rhs) const
check inequality.
ValueType * operator->() const
dereference.
ValueType & operator*() const
dereference.
bool operator==(const ArrayIterator< ArrayType, ValueType > &rhs) const
check equality.
ObjArrayIterator(ArrayType &array, size_t index)
real constructor
ArrayIterator< ArrayType, ValueType > operator++(int)
postfix increment.
ObjArrayIterator< ArrayType, ValueType > & operator++()
prefix increment