hpx/parallel/container_algorithms/starts_with.hpp#

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

namespace hpx
namespace ranges

Functions

template<typename Iter1, typename Sent1, typename Iter2, typename Sent2, typename Pred = ranges::equal_to, typename Proj1 = parallel::util::projection_identity, typename Proj2 = parallel::util::projection_identity>
bool starts_with(Iter1 first1, Sent1 last1, Iter2 first2, Sent2 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
  • Iter1 – The type of the begin source iterators used (deduced). This iterator type must meet the requirements of an input iterator.

  • Sent1 – The type of the end source iterators used(deduced). This iterator type must meet the requirements of an sentinel for Iter1.

  • Iter2 – The type of the begin destination iterators used deduced). This iterator type must meet the requirements of a input iterator.

  • Sent2 – The type of the end destination iterators used (deduced). This iterator type must meet the requirements of an sentinel for Iter2.

  • Pred – The binary predicate that compares the projected elements.

  • Proj1 – The type of an optional projection function for the source range. This defaults to util::projection_identity

  • Proj2 – The type of an optional projection function for the destination range. This defaults to util::projection_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 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 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 FwdIter1, typename Sent1, typename FwdIter2, typename Sent2, typename Pred = ranges::equal_to, typename Proj1 = parallel::util::projection_identity, typename Proj2 = parallel::util::projection_identity>
parallel::util::detail::algorithm_result<ExPolicy, bool>::type starts_with(ExPolicy &&policy, FwdIter1 first1, Sent1 last1, FwdIter2 first2, Sent2 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 with an execution policy object of type sequenced_policy execute in sequential order in the calling thread.

The assignments in the parallel starts_with 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: 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.

  • FwdIter1 – The type of the begin source iterators used (deduced). This iterator type must meet the requirements of an forward iterator.

  • Sent1 – The type of the end source iterators used(deduced). This iterator type must meet the requirements of an sentinel for Iter1.

  • FwdIter2 – The type of the begin destination iterators used deduced). This iterator type must meet the requirements of a forward iterator.

  • Sent2 – The type of the end destination iterators used (deduced). This iterator type must meet the requirements of an sentinel for Iter2.

  • Pred – The binary predicate that compares the projected elements.

  • Proj1 – The type of an optional projection function for the source range. This defaults to util::projection_identity

  • Proj2 – The type of an optional projection function for the destination range. This defaults to util::projection_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 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 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 Rng1, typename Rng2, typename Pred = ranges::equal_to, typename Proj1 = parallel::util::projection_identity, typename Proj2 = parallel::util::projection_identity>
bool starts_with(Rng1 &&rng1, Rng2 &&rng2, Pred &&pred = Pred(), Proj1 &&proj1 = Proj1(), Proj2 &&proj2 = Proj2())#

Checks whether the second range rng2 matches the prefix of the first range rng1.

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
  • Rng1 – The type of the source range used (deduced). The iterators extracted from this range type must meet the requirements of an forward iterator.

  • Rng2 – The type of the destination range used (deduced). The iterators extracted from this range type must meet the requirements of an forward iterator.

  • Pred – The binary predicate that compares the projected elements.

  • Proj1 – The type of an optional projection function for the source range. This defaults to util::projection_identity

  • Proj2 – The type of an optional projection function for the destination range. This defaults to util::projection_identity

Parameters
  • rng1 – Refers to the source range.

  • rng2 – Refers to 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 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 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 Rng1, typename Rng2, typename Pred = ranges::equal_to, typename Proj1 = parallel::util::projection_identity, typename Proj2 = parallel::util::projection_identity>
hpx::parallel::util::detail::algorithm_result<ExPolicy, bool>::type starts_with(ExPolicy &&policy, Rng1 &&rng1, Rng2 &&rng2, Pred &&pred = Pred(), Proj1 &&proj1 = Proj1(), Proj2 &&proj2 = Proj2())#

Checks whether the second range rng2 matches the prefix of the first range rng1.

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

The assignments in the parallel starts_with 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: 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.

  • Rng1 – The type of the source range used (deduced). The iterators extracted from this range type must meet the requirements of an forward iterator.

  • Rng2 – The type of the destination range used (deduced). The iterators extracted from this range type must meet the requirements of an forward iterator.

  • Pred – The binary predicate that compares the projected elements.

  • Proj1 – The type of an optional projection function for the source range. This defaults to util::projection_identity

  • Proj2 – The type of an optional projection function for the destination range. This defaults to util::projection_identity

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

  • rng1 – Refers to the source range.

  • rng2 – Refers to 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 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 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.