Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
ROOT::TSeq< T > Class Template Reference

template<class T>
class ROOT::TSeq< T >

A pseudo container class which is a generator of indices.

Template Parameters
TType of the numerical sequence.

A pseudo container class which is a generator of indices. The model is the xrange built-in function of Python. Possible usages: Loop on a sequence of integers

for (auto i : TSeqI(10)) {
cout << "Element " << i << endl;
}
A pseudo container class which is a generator of indices.
Definition TSeq.hxx:67

Loop on a sequence of integers in steps

for (auto i : TSeqI(-5, 29, 6)) {
cout << "Element " << i << endl;
}

Loop backwards on a sequence of integers

for (auto i : TSeqI(50, 30, -3)) {
cout << "Element " << i << endl;
}

Use an stl algorithm, for_each

TSeqUL ulSeq(2,30,3);
std::for_each(std::begin(ulSeq),std::end(ulSeq),[](ULong_t i){cout << "For each: " << i <<endl;});
unsigned long ULong_t
Definition RtypesCore.h:55

Random access:

cout << "Random access: 3rd element is " << ulSeq[2] << endl;

A function to create sequences inferring the type:

for (auto i : MakeSeq(1000000000000UL, 1000000000003UL)) {
cout << "Element " << i << endl;
}
TSeq< T > MakeSeq(T end)
Definition TSeq.hxx:209

Definition at line 67 of file TSeq.hxx.

Classes

class  iterator
 

Public Types

using difference_type = typename std::make_signed< T >::type
 
using value_type = T
 

Public Member Functions

 TSeq (T theBegin, T theEnd, T theStep=1)
 
 TSeq (T theEnd)
 
iterator begin () const
 
bool empty () const
 
iterator end () const
 
T const & front () const
 
operator[] (T s) const
 
std::size_t size () const
 
step () const
 

Private Member Functions

void checkIntegralType ()
 

Private Attributes

const T fBegin
 
const T fEnd
 
const T fStep
 

#include <ROOT/TSeq.hxx>

Member Typedef Documentation

◆ difference_type

template<class T >
using ROOT::TSeq< T >::difference_type = typename std::make_signed<T>::type

Definition at line 77 of file TSeq.hxx.

◆ value_type

template<class T >
using ROOT::TSeq< T >::value_type = T

Definition at line 76 of file TSeq.hxx.

Constructor & Destructor Documentation

◆ TSeq() [1/2]

template<class T >
ROOT::TSeq< T >::TSeq ( theEnd)
inline

Definition at line 79 of file TSeq.hxx.

◆ TSeq() [2/2]

template<class T >
ROOT::TSeq< T >::TSeq ( theBegin,
theEnd,
theStep = 1 
)
inline

Definition at line 82 of file TSeq.hxx.

Member Function Documentation

◆ begin()

template<class T >
iterator ROOT::TSeq< T >::begin ( ) const
inline

Definition at line 172 of file TSeq.hxx.

◆ checkIntegralType()

template<class T >
void ROOT::TSeq< T >::checkIntegralType ( )
inlineprivate

Definition at line 69 of file TSeq.hxx.

◆ empty()

template<class T >
bool ROOT::TSeq< T >::empty ( ) const
inline

Definition at line 197 of file TSeq.hxx.

◆ end()

template<class T >
iterator ROOT::TSeq< T >::end ( ) const
inline

Definition at line 175 of file TSeq.hxx.

◆ front()

template<class T >
T const & ROOT::TSeq< T >::front ( ) const
inline

Definition at line 181 of file TSeq.hxx.

◆ operator[]()

template<class T >
T ROOT::TSeq< T >::operator[] ( s) const
inline

Definition at line 185 of file TSeq.hxx.

◆ size()

template<class T >
std::size_t ROOT::TSeq< T >::size ( ) const
inline

Definition at line 189 of file TSeq.hxx.

◆ step()

template<class T >
T ROOT::TSeq< T >::step ( ) const
inline

Definition at line 193 of file TSeq.hxx.

Member Data Documentation

◆ fBegin

template<class T >
const T ROOT::TSeq< T >::fBegin
private

Definition at line 72 of file TSeq.hxx.

◆ fEnd

template<class T >
const T ROOT::TSeq< T >::fEnd
private

Definition at line 73 of file TSeq.hxx.

◆ fStep

template<class T >
const T ROOT::TSeq< T >::fStep
private

Definition at line 74 of file TSeq.hxx.

  • core/cont/inc/ROOT/TSeq.hxx