hpx/parallel/algorithms/search.hpp
hpx/parallel/algorithms/search.hpp#
See Public API for a list of names and headers that are part of the public HPX API.
-
namespace hpx
Functions
-
template<typename FwdIter, typename FwdIter2, typename Pred = detail::equal_to>
FwdIter search(FwdIter first, FwdIter last, FwdIter2 s_first, FwdIter2 s_last, Pred &&op = Pred())# Searches the range [first, last) for any elements in the range [s_first, s_last). Uses a provided predicate to compare elements.
The comparison operations in the parallel search algorithm execute in sequential order in the calling thread.
Note
Complexity: at most (S*N) comparisons where S = distance(s_first, s_last) and N = distance(first, last).
- Template Parameters
FwdIter – 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 adjacent_find requires Pred to meet the requirements of CopyConstructible. This defaults to std::equal_to<>
- 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.
s_first – Refers to the beginning of the sequence of elements the algorithm will be searching for.
s_last – Refers to the end of the sequence of elements of the algorithm will be searching for.
op – Refers to the binary predicate which returns true if the elements should be treated as equal. the signature of the function should be equivalent to
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 respectivelybool pred(const Type1 &a, const Type2 &b);
- Returns
The search algorithm returns a hpx::future<FwdIter> if the execution policy is of type task_execution_policy and returns FwdIter otherwise. The search algorithm returns an iterator to the beginning of the first subsequence [s_first, s_last) in range [first, last). If the length of the subsequence [s_first, s_last) is greater than the length of the range [first, last), last is returned. Additionally if the size of the subsequence is empty first is returned. If no subsequence is found, last is returned.
-
template<typename ExPolicy, typename FwdIter, typename FwdIter2, typename Pred = detail::equal_to>
util::detail::algorithm_result<ExPolicy, FwdIter>::type search(ExPolicy &&policy, FwdIter first, FwdIter last, FwdIter2 s_first, FwdIter2 s_last, Pred &&op = Pred())# Searches the range [first, last) for any elements in the range [s_first, s_last). Uses a provided predicate to compare elements.
The comparison operations in the parallel search 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 search 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) comparisons where S = distance(s_first, s_last) and N = distance(first, last).
- 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.
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 adjacent_find 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.
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.
s_first – Refers to the beginning of the sequence of elements the algorithm will be searching for.
s_last – Refers to the end of the sequence of elements of the algorithm will be searching for.
op – Refers to the binary predicate which returns true if the elements should be treated as equal. the signature of the function should be equivalent to
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 respectivelybool pred(const Type1 &a, const Type2 &b);
- Returns
The search algorithm returns a hpx::future<FwdIter> if the execution policy is of type task_execution_policy and returns FwdIter otherwise. The search algorithm returns an iterator to the beginning of the first subsequence [s_first, s_last) in range [first, last). If the length of the subsequence [s_first, s_last) is greater than the length of the range [first, last), last is returned. Additionally if the size of the subsequence is empty first is returned. If no subsequence is found, last is returned.
-
template<typename FwdIter, typename FwdIter2, typename Pred = detail::equal_to>
FwdIter search_n(FwdIter first, std::size_t count, FwdIter2 s_first, FwdIter2 s_last, Pred &&op = Pred())# Searches the range [first, last) for any elements in the range [s_first, s_last). Uses a provided predicate to compare elements.
The comparison operations in the parallel search_n algorithm execute in sequential order in the calling thread.
Note
Complexity: at most (S*N) comparisons where S = distance(s_first, s_last) and N = count.
- Template Parameters
FwdIter – 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 adjacent_find requires Pred to meet the requirements of CopyConstructible. This defaults to std::equal_to<>
- Parameters
first – Refers to the beginning of the sequence of elements of the first range the algorithm will be applied to.
count – Refers to the range of elements of the first range the algorithm will be applied to.
s_first – Refers to the beginning of the sequence of elements the algorithm will be searching for.
s_last – Refers to the end of the sequence of elements of the algorithm will be searching for.
op – Refers to the binary predicate which returns true if the elements should be treated as equal. the signature of the function should be equivalent to
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 respectivelybool pred(const Type1 &a, const Type2 &b);
- Returns
The search_n algorithm returns FwdIter. The search_n algorithm returns an iterator to the beginning of the last subsequence [s_first, s_last) in range [first, first+count). If the length of the subsequence [s_first, s_last) is greater than the length of the range [first, first+count), first is returned. Additionally if the size of the subsequence is empty or no subsequence is found, first is also returned.
-
template<typename ExPolicy, typename FwdIter, typename FwdIter2, typename Pred = detail::equal_to>
util::detail::algorithm_result<ExPolicy, FwdIter>::type search_n(ExPolicy &&policy, FwdIter first, std::size_t count, FwdIter2 s_first, FwdIter2 s_last, Pred &&op = Pred())# Searches the range [first, last) for any elements in the range [s_first, s_last). Uses a provided predicate to compare elements.
The comparison operations in the parallel search_n 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 search_n 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) comparisons where S = distance(s_first, s_last) and N = count.
- 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.
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 adjacent_find 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.
first – Refers to the beginning of the sequence of elements of the first range the algorithm will be applied to.
count – Refers to the range of elements of the first range the algorithm will be applied to.
s_first – Refers to the beginning of the sequence of elements the algorithm will be searching for.
s_last – Refers to the end of the sequence of elements of the algorithm will be searching for.
op – Refers to the binary predicate which returns true if the elements should be treated as equal. the signature of the function should be equivalent to
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 respectivelybool pred(const Type1 &a, const Type2 &b);
- Returns
The search_n algorithm returns a hpx::future<FwdIter> if the execution policy is of type task_execution_policy and returns FwdIter otherwise. The search_n algorithm returns an iterator to the beginning of the last subsequence [s_first, s_last) in range [first, first+count). If the length of the subsequence [s_first, s_last) is greater than the length of the range [first, first+count), first is returned. Additionally if the size of the subsequence is empty or no subsequence is found, first is also returned.
-
template<typename FwdIter, typename FwdIter2, typename Pred = detail::equal_to>