In C++, STL Standard Template Library has many algorithms for some operations like searching, counting, and manipulation of ranges and their elements. C++17 has a new feature that you can sort vectors with Parallel STL Algorithm.
In C++ Builder, Vectors can be used and sorted by Parallel STL Algorithm as below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
#include <vcl.h> #include <stdio.h> #include <vector> #include <algorithm> int _tmain(int argc, _TCHAR* argv[]) { std::vector<int> vec{ 36, 11, 9, 5, 15, 45, 5, 3 , 98, 23, 65}; for (auto i: vec) std::cout << i << ','; std::cout << '\n'; std::sort(std::execution::par, vec.begin(), vec.end()); for (auto i: vec) std::cout << i << ','; std::cout << '\n'; getchar(); return 0; } |
Reduce development time and get to market faster with RAD Studio, Delphi, or C++Builder.
Design. Code. Compile. Deploy.
Start Free Trial
Free C++Builder Community Edition
Design. Code. Compile. Deploy.
Start Free Trial
Free C++Builder Community Edition