ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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;
}

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;});

Random access:

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

A function to create sequences inferring the type:

{{cpp}
for (auto i : MakeSeq(1000000000000UL, 1000000000003UL)) {
cout << "Element " << i << endl;
}

Definition at line 55 of file TSeq.h.

Classes

class  iterator
 

Public Types

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

Public Member Functions

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

Private Member Functions

void checkIntegralType ()
 

Private Attributes

const T fBegin
 
const T fEnd
 
const T fStep
 

#include <ROOT/TSeq.h>

Member Typedef Documentation

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

Definition at line 65 of file TSeq.h.

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

Definition at line 64 of file TSeq.h.

Constructor & Destructor Documentation

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

Definition at line 67 of file TSeq.h.

template<class T>
ROOT::TSeq< T >::TSeq ( T  begin,
T  end,
T  step = 1 
)
inline

Definition at line 70 of file TSeq.h.

Member Function Documentation

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

Definition at line 116 of file TSeq.h.

Referenced by cling::printValue(), and ROOT::TSeq< T >::size().

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

Definition at line 57 of file TSeq.h.

Referenced by ROOT::TSeq< T >::TSeq().

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

Definition at line 141 of file TSeq.h.

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

Definition at line 119 of file TSeq.h.

Referenced by cling::printValue(), and ROOT::TSeq< T >::size().

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

Definition at line 125 of file TSeq.h.

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

Definition at line 129 of file TSeq.h.

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

Definition at line 133 of file TSeq.h.

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

Definition at line 137 of file TSeq.h.

Referenced by cling::printValue().

Member Data Documentation

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

Definition at line 61 of file TSeq.h.

Referenced by ROOT::TSeq< T >::empty(), and ROOT::TSeq< T >::end().

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

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