13 using namespace ROOT::VecOps;
15 void vo004_SortAndSelect()
19 RVec<double> v1{6., 4., 5.};
21 std::sort(v2.begin(), v2.end());
22 std::cout <<
"Sort vector " << v1 <<
": " << v2 << std::endl;
27 std::cout <<
"Sort vector " << v1 <<
": " << v3 << std::endl;
30 auto v4 = Reverse(v1);
31 std::cout <<
"Reverse vector " << v1 <<
": " << v4 << std::endl;
36 std::cout <<
"Indices that sort the vector " << v1 <<
": " << i << std::endl;
38 RVec<double> v5{9., 7., 8.};
39 auto v6 = Take(v5, i);
40 std::cout <<
"Sort vector " << v5 <<
" respective to the previously"
41 <<
" determined indices: " << v6 << std::endl;
44 auto v7 = Take(v1, 2);
45 auto v8 = Take(v1, -2);
46 std::cout <<
"Take the two first and last elements of vector " << v1
47 <<
": " << v7 <<
", " << v8 << std::endl;
51 auto v9 = Reverse(Take(Sort(v1), -2));
52 std::cout <<
"Sort the vector " << v1 <<
", take the two last elements and "
53 <<
"reverse the selection: " << v9 << std::endl;