Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // <execution>
- // EXECUTION POLICIES
- namespace execution {
- class sequenced_policy {
- // indicates support for only sequential execution, and requests termination on exceptions
- public:
- using _Standard_execution_policy = int;
- static constexpr bool _Parallelize = false;
- static constexpr bool _Ivdep = false;
- };
- inline constexpr sequenced_policy seq{/* unspecified */};
- class parallel_policy {
- // indicates support by element access functions for parallel execution with parallel forward progress
- // guarantees, and requests termination on exceptions
- public:
- using _Standard_execution_policy = int;
- static constexpr bool _Parallelize = true;
- static constexpr bool _Ivdep = true;
- };
- inline constexpr parallel_policy par{/* unspecified */};
- class parallel_unsequenced_policy {
- // indicates support by element access functions for parallel execution with weakly parallel forward progress
- // guarantees, and requests termination on exceptions
- //
- // (at this time, equivalent to parallel_policy)
- public:
- using _Standard_execution_policy = int;
- static constexpr bool _Parallelize = true;
- static constexpr bool _Ivdep = true;
- };
- inline constexpr parallel_unsequenced_policy par_unseq{/* unspecified */};
- /* ... */
- }
- // main.cpp https://praktikum.yandex.ru/trainer/cpp/lesson/967eacdd-7320-4832-8f65-57ff96ec2d5a/task/e9f59bfc-56e9-4cf8-aed2-92010996a7fd/?hideTheory=1
- template <typename RandomAccessIterator, typename Value>
- RandomAccessIterator LowerBound(const execution::sequenced_policy&, RandomAccessIterator range_begin, RandomAccessIterator range_end, const Value& value) { ... }
- template <typename RandomAccessIterator, typename Value>
- RandomAccessIterator LowerBound(RandomAccessIterator range_begin, RandomAccessIterator range_end, const Value& value) { ... }
- template <typename RandomAccessIterator, typename Value>
- RandomAccessIterator LowerBound(const execution::parallel_policy&, RandomAccessIterator range_begin, RandomAccessIterator range_end, const Value& value) { ... }
- // https://en.cppreference.com/w/cpp/algorithm/transform
- template< class ExecutionPolicy, class ForwardIt1, class ForwardIt2, class UnaryOperation >
- ForwardIt2 transform( ExecutionPolicy&& policy, ForwardIt1 first1, ForwardIt1 last1,
- ForwardIt2 d_first, UnaryOperation unary_op );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement