hpx::find_end#
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 FwdIter1, typename FwdIter2, typename Pred = detail::equal_to>
util::detail::algorithm_result_t<ExPolicy, FwdIter1> hpx::find_end(ExPolicy &&policy, FwdIter1 first1, FwdIter1 last1, FwdIter2 first2, FwdIter2 last2, Pred &&op = Pred())# Returns the last subsequence of elements [first2, last2) found in the range [first, last) using the given predicate op to compare elements. Executed according to the policy.
The comparison operations in the parallel find_end 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_end 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.
This overload of find_end is available if the user decides to provide the algorithm their own predicate op.
Note
Complexity: at most S*(N-S+1) comparisons where S = distance(first2, last2) and N = distance(first1, last1).
- 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.
FwdIter1 – The type of the source iterators used for the first range (deduced). This iterator type must meet the requirements of an forward iterator.
FwdIter2 – The type of the source iterators used for the second range (deduced). This iterator type must meet the requirements of an forward iterator.
Pred – The type of an optional function/function object to use. Unlike its sequential form, the parallel overload of replace requires Pred to meet the requirements of CopyConstructible. This defaults to std::equal_to<>
- Parameters:
policy – The execution policy to use for the scheduling of the iterations.
first1 – Refers to the beginning of the sequence of elements of the first range the algorithm will be applied to.
last1 – Refers to the end of the sequence of elements of the first range the algorithm will be applied to.
first2 – Refers to the beginning of the sequence of elements the algorithm will be searching for.
last2 – Refers to the end of the sequence of elements of the algorithm will be searching for.
op – The binary predicate which returns true if the elements should be treated as equal. The signature should be equivalent to the following:
The signature does not need to have const &, but the function must not modify the objects passed to it. The types Type1 and Type2 must be such that objects of types FwdIter1 and FwdIter2 can be dereferenced and then implicitly converted to Type1 and Type2 respectively.bool pred(const Type1 &a, const Type2 &b);
- Returns:
The find_end 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_end algorithm returns an iterator to the beginning of the last subsequence [first2, last2) in range [first, last). If the length of the subsequence [first2, last2) is greater than the length of the range [first1, last1), last1 is returned. Additionally if the size of the subsequence is empty or no subsequence is found, last1 is also returned.
-
template<typename ExPolicy, typename FwdIter1, typename FwdIter2>
util::detail::algorithm_result_t<ExPolicy, FwdIter1> hpx::find_end(ExPolicy &&policy, FwdIter1 first1, FwdIter1 last1, FwdIter2 first2, FwdIter2 last2)# Returns the last subsequence of elements [first2, last2) found in the range [first, last). Elements are compared using operator==. Executed according to the policy.
The comparison operations in the parallel find_end 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_end 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 S*(N-S+1) comparisons where S = distance(first2, last2) and N = distance(first1, last1).
- 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.
FwdIter1 – The type of the source iterators used for the first range (deduced). This iterator type must meet the requirements of an forward iterator.
FwdIter2 – The type of the source iterators used for the second range (deduced). This iterator type must meet the requirements of an forward iterator.
- Parameters:
policy – The execution policy to use for the scheduling of the iterations.
first1 – Refers to the beginning of the sequence of elements of the first range the algorithm will be applied to.
last1 – Refers to the end of the sequence of elements of the first range the algorithm will be applied to.
first2 – Refers to the beginning of the sequence of elements the algorithm will be searching for.
last2 – Refers to the end of the sequence of elements of the algorithm will be searching for.
- Returns:
The find_end 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_end algorithm returns an iterator to the beginning of the last subsequence [first2, last2) in range [first, last). If the length of the subsequence [first2, last2) is greater than the length of the range [first1, last1), last1 is returned. Additionally if the size of the subsequence is empty or no subsequence is found, last1 is also returned.
-
template<typename FwdIter1, typename FwdIter2, typename Pred = detail::equal_to>
FwdIter1 hpx::find_end(FwdIter1 first1, FwdIter1 last1, FwdIter2 first2, FwdIter2 last2, Pred &&op = Pred())# Returns the last subsequence of elements [first2, last2) found in the range [first, last) using the given predicate op to compare elements.
This overload of find_end is available if the user decides to provide the algorithm their own predicate op.
Note
Complexity: at most S*(N-S+1) comparisons where S = distance(first2, last2) and N = distance(first1, last1).
- Template Parameters:
FwdIter1 – The type of the source iterators used for the first range (deduced). This iterator type must meet the requirements of an forward iterator.
FwdIter2 – The type of the source iterators used for the second range (deduced). This iterator type must meet the requirements of an forward iterator.
Pred – The type of an optional function/function object to use. Unlike its sequential form, the parallel overload of replace requires Pred to meet the requirements of CopyConstructible. This defaults to std::equal_to<>
- Parameters:
first1 – Refers to the beginning of the sequence of elements of the first range the algorithm will be applied to.
last1 – Refers to the end of the sequence of elements of the first range the algorithm will be applied to.
first2 – Refers to the beginning of the sequence of elements the algorithm will be searching for.
last2 – Refers to the end of the sequence of elements of the algorithm will be searching for.
op – The binary predicate which returns true if the elements should be treated as equal. The signature should be equivalent to the following:
The signature does not need to have const &, but the function must not modify the objects passed to it. The types Type1 and Type2 must be such that objects of types FwdIter1 and FwdIter2 can be dereferenced and then implicitly converted to Type1 and Type2 respectively.bool pred(const Type1 &a, const Type2 &b);
- Returns:
The find_end algorithm returns a FwdIter1. The find_end algorithm returns an iterator to the beginning of the last subsequence [first2, last2) in range [first, last). If the length of the subsequence [first2, last2) is greater than the length of the range [first1, last1), last1 is returned. Additionally if the size of the subsequence is empty or no subsequence is found, last1 is also returned.
-
template<typename FwdIter1, typename FwdIter2>
FwdIter1 hpx::find_end(FwdIter1 first1, FwdIter1 last1, FwdIter2 first2, FwdIter2 last2)# Returns the last subsequence of elements [first2, last2) found in the range [first, last). Elements are compared using operator==.
Note
Complexity: at most S*(N-S+1) comparisons where S = distance(first2, last2) and N = distance(first1, last1).
- Template Parameters:
FwdIter1 – The type of the source iterators used for the first range (deduced). This iterator type must meet the requirements of an forward iterator.
FwdIter2 – The type of the source iterators used for the second range (deduced). This iterator type must meet the requirements of an forward iterator.
- Parameters:
first1 – Refers to the beginning of the sequence of elements of the first range the algorithm will be applied to.
last1 – Refers to the end of the sequence of elements of the first range the algorithm will be applied to.
first2 – Refers to the beginning of the sequence of elements the algorithm will be searching for.
last2 – Refers to the end of the sequence of elements of the algorithm will be searching for.
- Returns:
The find_end algorithm returns a FwdIter1. The find_end algorithm returns an iterator to the beginning of the last subsequence [first2, last2) in range [first, last). If the length of the subsequence [first2, last2) is greater than the length of the range [first1, last1), last1 is returned. Additionally if the size of the subsequence is empty or no subsequence is found, last1 is also returned.