hpx::starts_with
hpx::starts_with#
Defined in header hpx/algorithm.hpp.
See Public API for a list of names and headers that are part of the public HPX API.
-
namespace hpx
Functions
-
template<typename InIter1, typename InIter2, typename Pred = hpx::parallel::detail::equal_to, typename Proj1 = hpx::identity, typename Proj2 = hpx::identity>
bool starts_with(InIter1 first1, InIter1 last1, InIter2 first2, InIter2 last2, Pred &&pred = Pred(), Proj1 &&proj1 = Proj1(), Proj2 &&proj2 = Proj2())# Checks whether the second range defined by [first1, last1) matches the prefix of the first range defined by [first2, last2)
The assignments in the parallel starts_with algorithm invoked without an execution policy object execute in sequential order in the calling thread.
Note
Complexity: Linear: at most min(N1, N2) applications of the predicate and both projections.
- Template Parameters
InIter1 – The type of the source iterators used (deduced). This iterator type must meet the requirements of an input iterator.
InIter2 – The type of the destination iterators used (deduced). This iterator type must meet the requirements of an input iterator.
Pred – The binary predicate that compares the projected elements. This defaults to hpx::parallel::detail::equal_to.
Proj1 – The type of an optional projection function for the source range. This defaults to hpx::identity.
Proj2 – The type of an optional projection function for the destination range. This defaults to hpx::identity.
- Parameters
first1 – Refers to the beginning of the source range.
last1 – Sentinel value referring to the end of the source range.
first2 – Refers to the beginning of the destination range.
last2 – Sentinel value referring to the end of the destination range.
pred – Specifies the binary predicate function (or function object) which will be invoked for comparison of the elements in the in two ranges projected by proj1 and proj2 respectively.
proj1 – Specifies the function (or function object) which will be invoked for each of the elements in the source range as a projection operation before the actual predicate pred is invoked.
proj2 – Specifies the function (or function object) which will be invoked for each of the elements in the destination range as a projection operation before the actual predicate pred is invoked.
- Returns
The starts_with algorithm returns bool. The starts_with algorithm returns a boolean with the value true if the second range matches the prefix of the first range, false otherwise.
-
template<typename ExPolicy, typename InIter1, typename InIter2, typename Pred = hpx::parallel::detail::equal_to, typename Proj1 = hpx::identity, typename Proj2 = hpx::identity>
hpx::parallel::util::detail::algorithm_result_t<ExPolicy, bool> starts_with(ExPolicy &&policy, InIter1 first1, InIter1 last1, InIter2 first2, InIter2 last2, Pred &&pred = Pred(), Proj1 &&proj1 = Proj1(), Proj2 &&proj2 = Proj2())# Checks whether the second range defined by [first1, last1) matches the prefix of the first range defined by [first2, last2). Executed according to the policy.
The assignments in the parallel starts_with algorithm invoked without an execution policy object execute in sequential order in the calling thread.
Note
Complexity: Linear: at most min(N1, N2) applications of the predicate and both projections.
- 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.
InIter1 – The type of the source iterators used (deduced). This iterator type must meet the requirements of an input iterator.
InIter2 – The type of the destination iterators used (deduced). This iterator type must meet the requirements of an input iterator.
Pred – The binary predicate that compares the projected elements. This defaults to hpx::parallel::detail::equal_to.
Proj1 – The type of an optional projection function for the source range. This defaults to hpx::identity.
Proj2 – The type of an optional projection function for the destination range. This defaults to hpx::identity.
- Parameters
policy – The execution policy to use for the scheduling of the iterations.
first1 – Refers to the beginning of the source range.
last1 – Sentinel value referring to the end of the source range.
first2 – Refers to the beginning of the destination range.
last2 – Sentinel value referring to the end of the destination range.
pred – Specifies the binary predicate function (or function object) which will be invoked for comparison of the elements in the in two ranges projected by proj1 and proj2 respectively.
proj1 – Specifies the function (or function object) which will be invoked for each of the elements in the source range as a projection operation before the actual predicate pred is invoked.
proj2 – Specifies the function (or function object) which will be invoked for each of the elements in the destination range as a projection operation before the actual predicate pred is invoked.
- Returns
The starts_with algorithm returns a hpx::future<bool> if the execution policy is of type sequenced_task_policy or parallel_task_policy and returns bool otherwise. The starts_with algorithm returns a boolean with the value true if the second range matches the prefix of the first range, false otherwise.
-
template<typename InIter1, typename InIter2, typename Pred = hpx::parallel::detail::equal_to, typename Proj1 = hpx::identity, typename Proj2 = hpx::identity>