HPX - High Performance ParalleX

PrevUpHomeNext

Function template minmax_element

hpx::parallel::v1::minmax_element

Synopsis

// In header: <hpx/parallel/algorithms/minmax.hpp>


template<typename ExPolicy, typename FwdIter> 
  unspecified minmax_element(ExPolicy && policy, FwdIter first, FwdIter last);

Description

Finds the greatest element in the range [first, last) using the given std::less predicate.

[Note] Note

Complexity: At most max(floor(3/2*(N-1)), 0) applications of the predicate, where N = std::distance(first, last).

The comparisons in the parallel minmax_element algorithm invoked with an execution policy object of type sequential_execution_policy execute in sequential order in the calling thread.

The comparisons in the parallel minmax_element algorithm invoked with an execution policy object of type parallel_execution_policy or parallel_task_execution_policy are permitted to execute in an unordered fashion in unspecified threads, and indeterminately sequenced within each thread.

Parameters:

first

Refers to the beginning of the sequence of elements the algorithm will be applied to.

last

Refers to the end of the sequence of elements the algorithm will be applied to.

policy

The execution policy to use for the scheduling of the iterations.

Template Parameters:

ExPolicy

The type of the execution policy to use (deduced). It describes the manner in which the execution of the algorithm may be parallelized and the manner in which it executes the assignments.

FwdIter

The type of the source iterators used (deduced). This iterator type must meet the requirements of a forward iterator.

Returns:

The minmax_element algorithm returns a hpx::future<FwdIter> if the execution policy is of type sequential_task_execution_policy or parallel_task_execution_policy and returns FwdIter otherwise. The minmax_element algorithm returns a pair consisting of an iterator to the smallest element as the first element and an iterator to the greatest element as the second. Returns std::make_pair(first, first) if the range is empty. If several elements are equivalent to the smallest element, the iterator to the first such element is returned. If several elements are equivalent to the largest element, the iterator to the last such element is returned.


PrevUpHomeNext