Logo ROOT  
Reference Guide
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*
}
void Class()
Definition: Class.C:29
Each class (see TClass) has a linked list of its base class(es).
Definition: TBaseClass.h:33
TString as(SEXP s)
Definition: RExports.h:71
auto * a
Definition: textangle.C:12

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.


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