HPX - High Performance ParalleX

PrevUpHomeNext

Function template max_element

hpx::parallel::v1::max_element

Synopsis

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


template<typename ExPolicy, typename FwdIter> 
  unspecified max_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: Exactly max(N-1, 0) comparisons, where N = std::distance(first, last).

The comparisons in the parallel max_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 max_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 max_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 max_element algorithm returns the iterator to the smallest element in the range [first, last). If several elements in the range are equivalent to the smallest element, returns the iterator to the first such element. Returns last if the range is empty.


PrevUpHomeNext