Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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:

for(auto bcl : TRangeStaticCast<TBaseClass>( *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*
}
#define a(i)
Definition RSha256.hxx:99
TRangeStaticCast is an adaptater class that allows the typed iteration through a TCollection.
Each class (see TClass) has a linked list of its base class(es).
Definition TBaseClass.h:33

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.

  • core/cont/inc/TCollection.h