hpx::find

Contents

hpx::find#

Defined in header hpx/algorithm.hpp.

See Public API for a list of names and headers that are part of the public HPX API.

See also:

template<typename ExPolicy, typename FwdIter, typename T>
util::detail::algorithm_result_t<ExPolicy, FwdIter> hpx::find(ExPolicy &&policy, FwdIter first, FwdIter last, T const &val)#

Returns the first element in the range [first, last) that is equal to value. Executed according to the policy.

The comparison operations in the parallel find algorithm invoked with an execution policy object of type sequenced_policy execute in sequential order in the calling thread.

The comparison operations in the parallel find algorithm invoked with an execution policy object of type parallel_policy or parallel_task_policy are permitted to execute in an unordered fashion in unspecified threads, and indeterminately sequenced within each thread.

Note

Complexity: At most last - first applications of the operator==().

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 for the first range (deduced). This iterator type must meet the requirements of an forward iterator.

  • T – The type of the value to find (deduced).

Parameters:
  • policy – The execution policy to use for the scheduling of the iterations.

  • first – Refers to the beginning of the sequence of elements of the first range the algorithm will be applied to.

  • last – Refers to the end of the sequence of elements of the first range the algorithm will be applied to.

  • val – the value to compare the elements to

Returns:

The find algorithm returns a hpx::future<FwdIter> if the execution policy is of type sequenced_task_policy or parallel_task_policy and returns FwdIter otherwise. The find algorithm returns the first element in the range [first,last) that is equal to val. If no such element in the range of [first,last) is equal to val, then the algorithm returns last.

template<typename InIter, typename T>
InIter hpx::find(InIter first, InIter last, T const &val)#

Returns the first element in the range [first, last) that is equal to value. Executed according to the policy.

Note

Complexity: At most last - first applications of the operator==().

Template Parameters:
  • InIter – The type of the source iterators used for the first range (deduced). This iterator type must meet the requirements of an input iterator.

  • T – The type of the value to find (deduced).

Parameters:
  • first – Refers to the beginning of the sequence of elements of the first range the algorithm will be applied to.

  • last – Refers to the end of the sequence of elements of the first range the algorithm will be applied to.

  • val – the value to compare the elements to

Returns:

The find algorithm returns a InIter. The find algorithm returns the first element in the range [first,last) that is equal to val. If no such element in the range of [first,last) is equal to val, then the algorithm returns last.