Logo ROOT   6.16/01
Reference Guide
List of all members | Public Member Functions | Private Attributes | List of all members
ROOT::Detail::TRangeStaticCast< T > Class Template Reference

template<class T>
class ROOT::Detail::TRangeStaticCast< T >

TRangeStaticCast is an adaptater class that allows the typed iteration through a TCollection.

This requires the collection to contains element of the type requested (or a derived class). Any deviation from this expectation will only be caught/reported by an assert in debug builds.

This is best used with a TClonesArray, for other cases prefered TRangeDynCast.

The typical use is: ~~~ {.cpp} for(auto bcl : TRangeStaticCast<TBaseClass>( <em>tbaseClassClonesArrayPtr )) { assert(bcl && bcl->IsA()->InheritsFrom(TBaseClass::Class())); ... use bcl as a TBaseClass } for(auto bcl : TRangeStaticCast<TBaseClass>( tbaseClassClonesArrayPtr )) { assert(bcl && bcl->IsA()->InheritsFrom(TBaseClass::Class())); ... use bcl as a TBaseClass* } ~~~ {.cpp}

Definition at line 382 of file TCollection.h.

Public Member Functions

 TRangeStaticCast (const TCollection &col)
 
 TRangeStaticCast (const TCollection *col)
 
TTypedIter< T > begin () const
 
TTypedIter< T > end () const
 

Private Attributes

const TCollectionfCollection
 

#include <TCollection.h>

Constructor & Destructor Documentation

◆ TRangeStaticCast() [1/2]

template<class T >
ROOT::Detail::TRangeStaticCast< T >::TRangeStaticCast ( const TCollection col)
inline

Definition at line 386 of file TCollection.h.

◆ TRangeStaticCast() [2/2]

template<class T >
ROOT::Detail::TRangeStaticCast< T >::TRangeStaticCast ( const TCollection col)
inline

Definition at line 387 of file TCollection.h.

Member Function Documentation

◆ begin()

template<class T >
TTypedIter< T > ROOT::Detail::TRangeStaticCast< T >::begin ( ) const
inline

Definition at line 389 of file TCollection.h.

◆ end()

template<class T >
TTypedIter< T > ROOT::Detail::TRangeStaticCast< T >::end ( ) const
inline

Definition at line 390 of file TCollection.h.

Member Data Documentation

◆ fCollection

template<class T >
const TCollection& ROOT::Detail::TRangeStaticCast< T >::fCollection
private

Definition at line 383 of file TCollection.h.

Libraries for ROOT::Detail::TRangeStaticCast< T >:
[legend]

The documentation for this class was generated from the following file: