Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
cnt001_basictseq.C
Go to the documentation of this file.
1/// \file
2/// \ingroup tutorial_cont
3/// \notebook -nodraw
4/// Example showing possible usages of the TSeq class.
5///
6/// \macro_code
7/// \macro_output
8///
9/// \author Danilo Piparo
10
11using namespace ROOT;
12
13void cnt001_basictseq()
14{
15 cout << "Loop on sequence of integers from 0 to 10" << endl;
16 for (auto i : TSeqI(10)) {
17 cout << "Element " << i << endl;
18 }
19 //
20 cout << "Loop on sequence of integers from -5 to 29 in steps of 6" << endl;
21 for (auto i : TSeqI(-5, 29, 6)) {
22 cout << "Element " << i << endl;
23 }
24 //
25 cout << "Loop backwards on sequence of integers from 50 to 30 in steps of 3" << endl;
26 for (auto i : TSeqI(50, 30, -3)) {
27 cout << "Element " << i << endl;
28 }
29 //
30 cout << "stl algorithm, for_each" << endl;
31 TSeqUL ulSeq(2,30,3);
32 std::for_each(std::begin(ulSeq),std::end(ulSeq),[](ULong_t i){cout << "For each: " << i <<endl;});
33
34 cout << "Random access: 3rd element is " << ulSeq[2] << endl;
35 //
36 cout << "Loop using MakeSeq" << endl;
37 for (auto i : MakeSeq(1000000000000UL, 1000000000003UL)) {
38 cout << "Element " << i << endl;
39 }
40}
41
unsigned long ULong_t
Definition RtypesCore.h:55
A pseudo container class which is a generator of indices.
Definition TSeq.hxx:66
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
TSeq< T > MakeSeq(T end)
Definition TSeq.hxx:207