Logo ROOT   6.18/05
Reference Guide
List of all members | Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
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;
}
TSeq< int > TSeqI
Definition: TSeq.hxx:194

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:51
TSeq< unsigned long > TSeqUL
Definition: TSeq.hxx:197

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:200

Definition at line 66 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 76 of file TSeq.hxx.

◆ value_type

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

Definition at line 75 of file TSeq.hxx.

Constructor & Destructor Documentation

◆ TSeq() [1/2]

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

Definition at line 78 of file TSeq.hxx.

◆ TSeq() [2/2]

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

Definition at line 81 of file TSeq.hxx.

Member Function Documentation

◆ begin()

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

Definition at line 163 of file TSeq.hxx.

◆ checkIntegralType()

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

Definition at line 68 of file TSeq.hxx.

◆ empty()

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

Definition at line 188 of file TSeq.hxx.

◆ end()

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

Definition at line 166 of file TSeq.hxx.

◆ front()

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

Definition at line 172 of file TSeq.hxx.

◆ operator[]()

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

Definition at line 176 of file TSeq.hxx.

◆ size()

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

Definition at line 180 of file TSeq.hxx.

◆ step()

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

Definition at line 184 of file TSeq.hxx.

Member Data Documentation

◆ fBegin

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

Definition at line 71 of file TSeq.hxx.

◆ fEnd

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

Definition at line 72 of file TSeq.hxx.

◆ fStep

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

Definition at line 73 of file TSeq.hxx.


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