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