template<class T>
class ROOT::TSeq< T >
A pseudo container class which is a generator of indices.
- Template Parameters
-
T | Type 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
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:
for (
auto i :
MakeSeq(1000000000000UL, 1000000000003UL)) {
cout << "Element " << i << endl;
}
Definition at line 66 of file TSeq.hxx.