hpx::ranges::unique, hpx::ranges::unique_copy
hpx::ranges::unique, hpx::ranges::unique_copy#
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
-
namespace ranges
Functions
-
template<typename FwdIter, typename Sent, typename Pred = ranges::equal_to, typename Proj = hpx::identity>
subrange_t<FwdIter, Sent> unique(FwdIter first, Sent last, Pred &&pred = Pred(), Proj &&proj = Proj())# Eliminates all but the first element from every consecutive group of equivalent elements from the range [first, last) and returns a past-the-end iterator for the new logical end of the range.
The assignments in the parallel unique algorithm invoked without an execution policy object execute in sequential order in the calling thread.
Note
Complexity: Performs not more than last - first assignments, exactly last - first - 1 applications of the predicate pred and no more than twice as many applications of the projection proj.
- Template Parameters
FwdIter – The type of the source iterators used (deduced). This iterator type must meet the requirements of a forward iterator.
Sent – The type of the source sentinel (deduced). This sentinel type must be a sentinel for FwdIter.
Pred – The type of the function/function object to use (deduced). Unlike its sequential form, the parallel overload of unique requires Pred to meet the requirements of CopyConstructible. This defaults to std::equal_to<>
Proj – The type of an optional projection function. This defaults to hpx::identity
- Parameters
first – Refers to the beginning of the sequence of elements the algorithm will be applied to.
last – Refers to sentinel value denoting the end of the sequence of elements the algorithm will be applied.
pred – Specifies the function (or function object) which will be invoked for each of the elements in the sequence specified by [first, last). This is an binary predicate which returns true for the required elements. The signature of this predicate 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 FwdIter can be dereferenced and then implicitly converted to both Type1 and Type2bool pred(const Type1 &a, const Type2 &b);
proj – Specifies the function (or function object) which will be invoked for each of the elements as a projection operation before the actual predicate is invoked.
- Returns
The unique algorithm returns subrange_t<FwdIter, Sent>. The unique algorithm returns an object {ret, last}, where ret is a past-the-end iterator for a new subrange.
-
template<typename ExPolicy, typename FwdIter, typename Sent, typename Pred = ranges::equal_to, typename Proj = hpx::identity>
parallel::util::detail::algorithm_result<ExPolicy, subrange_t<FwdIter, Sent>>::type unique(ExPolicy &&policy, FwdIter first, Sent last, Pred &&pred = Pred(), Proj &&proj = Proj())# Eliminates all but the first element from every consecutive group of equivalent elements from the range [first, last) and returns a past-the-end iterator for the new logical end of the range.
The assignments in the parallel unique algorithm invoked with an execution policy object of type sequenced_policy execute in sequential order in the calling thread.
The assignments in the parallel unique 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: Performs not more than last - first assignments, exactly last - first - 1 applications of the predicate pred and no more than twice as many applications of the projection proj.
- 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 (deduced). This iterator type must meet the requirements of a forward iterator.
Sent – The type of the source sentinel (deduced). This sentinel type must be a sentinel for FwdIter.
Pred – The type of the function/function object to use (deduced). Unlike its sequential form, the parallel overload of unique requires Pred to meet the requirements of CopyConstructible. This defaults to std::equal_to<>
Proj – The type of an optional projection function. This defaults to hpx::identity
- Parameters
policy – The execution policy to use for the scheduling of the iterations.
first – Refers to the beginning of the sequence of elements the algorithm will be applied to.
last – Refers to sentinel value denoting the end of the sequence of elements the algorithm will be applied.
pred – Specifies the function (or function object) which will be invoked for each of the elements in the sequence specified by [first, last). This is an binary predicate which returns true for the required elements. The signature of this predicate 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 FwdIter can be dereferenced and then implicitly converted to both Type1 and Type2bool pred(const Type1 &a, const Type2 &b);
proj – Specifies the function (or function object) which will be invoked for each of the elements as a projection operation before the actual predicate is invoked.
- Returns
The unique algorithm returns subrange_t<FwdIter, Sent>. The unique algorithm returns an object {ret, last}, where ret is a past-the-end iterator for a new subrange.
-
template<typename Rng, typename Pred = ranges::equal_to, typename Proj = hpx::identity>
subrange_t<hpx::traits::range_iterator_t<Rng>, hpx::traits::range_iterator_t<Rng>> unique(Rng &&rng, Pred &&pred = Pred(), Proj &&proj = Proj())# Eliminates all but the first element from every consecutive group of equivalent elements from the range rng and returns a past-the-end iterator for the new logical end of the range.
The assignments in the parallel unique algorithm invoked without an execution policy object execute in sequential order in the calling thread.
Note
Complexity: Performs not more than N assignments, exactly N - 1 applications of the predicate pred and no more than twice as many applications of the projection proj, where N = std::distance(begin(rng), end(rng)).
- Template Parameters
Rng – The type of the source range used (deduced). The iterators extracted from this range type must meet the requirements of an forward iterator.
Pred – The type of the function/function object to use (deduced). Unlike its sequential form, the parallel overload of unique requires Pred to meet the requirements of CopyConstructible. This defaults to std::equal_to<>
Proj – The type of an optional projection function. This defaults to hpx::identity
- Parameters
rng – Refers to the sequence of elements the algorithm will be applied to.
pred – Specifies the function (or function object) which will be invoked for each of the elements in the sequence specified by [first, last). This is an binary predicate which returns true for the required elements. The signature of this predicate should be equivalent to:
The signature does not need to have const&, but the function must not modify the objects passed to it. The type Type must be such that an object of type FwdIter1 can be dereferenced and then implicitly converted to Type.bool pred(const Type &a, const Type &b);
proj – Specifies the function (or function object) which will be invoked for each of the elements as a projection operation before the actual predicate is invoked.
- Returns
The unique algorithm returns subrange_t<hpx::traits::range_iterator_t<Rng>, hpx::traits::range_iterator_t<Rng>>. The unique algorithm returns an object {ret, last}, where ret is a past-the-end iterator for a new subrange.
-
template<typename ExPolicy, typename Rng, typename Pred = ranges::equal_to, typename Proj = hpx::identity>
parallel::util::detail::algorithm_result<ExPolicy, subrange_t<hpx::traits::range_iterator_t<Rng>, hpx::traits::range_iterator_t<Rng>>> unique(ExPolicy &&policy, Rng &&rng, Pred &&pred = Pred(), Proj &&proj = Proj())# Eliminates all but the first element from every consecutive group of equivalent elements from the range rng and returns a past-the-end iterator for the new logical end of the range.
The assignments in the parallel unique algorithm invoked with an execution policy object of type sequenced_policy execute in sequential order in the calling thread.
The assignments in the parallel unique 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: Performs not more than N assignments, exactly N - 1 applications of the predicate pred and no more than twice as many applications of the projection proj, where N = std::distance(begin(rng), end(rng)).
- 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.
Rng – The type of the source range used (deduced). The iterators extracted from this range type must meet the requirements of an forward iterator.
Pred – The type of the function/function object to use (deduced). Unlike its sequential form, the parallel overload of unique requires Pred to meet the requirements of CopyConstructible. This defaults to std::equal_to<>
Proj – The type of an optional projection function. This defaults to hpx::identity
- Parameters
policy – The execution policy to use for the scheduling of the iterations.
rng – Refers to the sequence of elements the algorithm will be applied to.
pred – Specifies the function (or function object) which will be invoked for each of the elements in the sequence specified by [first, last). This is an binary predicate which returns true for the required elements. The signature of this predicate should be equivalent to:
The signature does not need to have const&, but the function must not modify the objects passed to it. The type Type must be such that an object of type FwdIter1 can be dereferenced and then implicitly converted to Type.bool pred(const Type &a, const Type &b);
proj – Specifies the function (or function object) which will be invoked for each of the elements as a projection operation before the actual predicate is invoked.
- Returns
The unique algorithm returns a hpx::future <subrange_t<hpx::traits::range_iterator_t<Rng>, hpx::traits::range_iterator_t<Rng>>> if the execution policy is of type sequenced_task_policy or parallel_task_policy and returns subrange_t<hpx::traits::range_iterator_t<Rng>, hpx::traits::range_iterator_t<Rng>> otherwise. The unique algorithm returns an object {ret, last}, where ret is a past-the-end iterator for a new subrange.
-
template<typename InIter, typename Sent, typename O, typename Pred = ranges::equal_to, typename Proj = hpx::identity>
unique_copy_result<InIter, O> unique_copy(InIter first, Sent last, O dest, Pred &&pred = Pred(), Proj &&proj = Proj())# Copies the elements from the range [first, last), to another range beginning at dest in such a way that there are no consecutive equal elements. Only the first element of each group of equal elements is copied.
The assignments in the parallel unique_copy algorithm invoked without an execution policy object will execute in sequential order in the calling thread.
Note
Complexity: Performs not more than last - first assignments, exactly last - first - 1 applications of the predicate pred and no more than twice as many applications of the projection proj
- Template Parameters
InIter – The type of the source iterators used (deduced). This iterator type must meet the requirements of an input iterator.
Sent – The type of the source sentinel (deduced). This sentinel type must be a sentinel for InIter.
O – The type of the iterator representing the destination range (deduced).
Pred – The type of the function/function object to use (deduced). Unlike its sequential form, the parallel overload of unique_copy requires Pred to meet the requirements of CopyConstructible. This defaults to std::equal_to<>
Proj – The type of an optional projection function. This defaults to hpx::identity
- Parameters
first – Refers to the beginning of the sequence of elements the algorithm will be applied to.
last – Refers to sentinel value denoting the end of the sequence of elements the algorithm will be applied.
dest – Refers to the beginning of the destination range.
pred – Specifies the function (or function object) which will be invoked for each of the elements in the sequence specified by [first, last). This is an binary predicate which returns true for the required elements. The signature of this predicate should be equivalent to:
The signature does not need to have const&, but the function must not modify the objects passed to it. The type Type must be such that an object of type InIter1 can be dereferenced and then implicitly converted to Type.bool pred(const Type &a, const Type &b);
proj – Specifies the function (or function object) which will be invoked for each of the elements as a projection operation before the actual predicate is invoked.
- Returns
The unique_copy algorithm returns a returns unique_copy_result<InIter, O>. The unique_copy algorithm returns an in_out_result with the source iterator to one past the last element and out containing the destination iterator to the end of the dest range.
-
template<typename ExPolicy, typename FwdIter, typename Sent, typename O, typename Pred = ranges::equal_to, typename Proj = hpx::identity>
parallel::util::detail::algorithm_result<ExPolicy, unique_copy_result<FwdIter, O>>::type unique_copy(ExPolicy &&policy, FwdIter first, Sent last, O dest, Pred &&pred = Pred(), Proj &&proj = Proj())# Copies the elements from the range [first, last), to another range beginning at dest in such a way that there are no consecutive equal elements. Only the first element of each group of equal elements is copied.
The assignments in the parallel unique_copy algorithm invoked with an execution policy object of type sequenced_policy execute in sequential order in the calling thread.
The assignments in the parallel unique_copy 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: Performs not more than last - first assignments, exactly last - first - 1 applications of the predicate pred and no more than twice as many applications of the projection proj
- 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 (deduced). This iterator type must meet the requirements of a forward iterator.
Sent – The type of the source sentinel (deduced). This sentinel type must be a sentinel for FwdIter1.
O – The type of the iterator representing the destination range (deduced).
Pred – The type of the function/function object to use (deduced). Unlike its sequential form, the parallel overload of unique_copy requires Pred to meet the requirements of CopyConstructible. This defaults to std::equal_to<>
Proj – The type of an optional projection function. This defaults to hpx::identity
- Parameters
policy – The execution policy to use for the scheduling of the iterations.
first – Refers to the beginning of the sequence of elements the algorithm will be applied to.
last – Refers to sentinel value denoting the end of the sequence of elements the algorithm will be applied.
dest – Refers to the beginning of the destination range.
pred – Specifies the function (or function object) which will be invoked for each of the elements in the sequence specified by [first, last). This is an binary predicate which returns true for the required elements. The signature of this predicate should be equivalent to:
The signature does not need to have const&, but the function must not modify the objects passed to it. The type Type must be such that an object of type FwdIter can be dereferenced and then implicitly converted to Type.bool pred(const Type &a, const Type &b);
proj – Specifies the function (or function object) which will be invoked for each of the elements as a projection operation before the actual predicate is invoked.
- Returns
The unique_copy algorithm returns returns a hpx::future< unique_copy_result<FwdIter, O>> if the execution policy is of type sequenced_task_policy or parallel_task_policy and returns unique_copy_result<FwdIter, O> otherwise. The unique_copy algorithm returns an in_out_result with the source iterator to one past the last element and out containing the destination iterator to the end of the dest range.
-
template<typename Rng, typename O, typename Pred = ranges::equal_to, typename Proj = hpx::identity>
unique_copy_result<hpx::traits::range_iterator_t<Rng>, O> unique_copy(Rng &&rng, O dest, Pred &&pred = Pred(), Proj &&proj = Proj())# Copies the elements from the range rng, to another range beginning at dest in such a way that there are no consecutive equal elements. Only the first element of each group of equal elements is copied.
The assignments in the parallel unique_copy algorithm invoked without an execution policy object will execute in sequential order in the calling thread.
Note
Complexity: Performs not more than N assignments, exactly N - 1 applications of the predicate pred, where N = std::distance(begin(rng), end(rng)).
- Template Parameters
Rng – The type of the source range used (deduced). The iterators extracted from this range type must meet the requirements of an forward iterator.
O – The type of the iterator representing the destination range (deduced). This iterator type must meet the requirements of a forward iterator.
Pred – The type of the function/function object to use (deduced). Unlike its sequential form, the parallel overload of unique_copy requires Pred to meet the requirements of CopyConstructible. This defaults to std::equal_to<>
Proj – The type of an optional projection function. This defaults to hpx::identity
- Parameters
rng – Refers to the sequence of elements the algorithm will be applied to.
dest – Refers to the beginning of the destination range.
pred – Specifies the function (or function object) which will be invoked for each of the elements in the sequence specified by the range rng. This is an binary predicate which returns true for the required elements. The signature of this predicate should be equivalent to:
The signature does not need to have const&, but the function must not modify the objects passed to it. The type Type must be such that an object of type FwdIter1 can be dereferenced and then implicitly converted to Type.bool pred(const Type &a, const Type &b);
proj – Specifies the function (or function object) which will be invoked for each of the elements as a projection operation before the actual predicate is invoked.
- Returns
The unique_copy algorithm returns unique_copy_result< hpx::traits::range_iterator_t<Rng>, O>. The unique_copy algorithm returns the pair of the source iterator to last, and the destination iterator to the end of the dest range.
-
template<typename ExPolicy, typename Rng, typename O, typename Pred = ranges::equal_to, typename Proj = hpx::identity>
parallel::util::detail::algorithm_result<ExPolicy, unique_copy_result<hpx::traits::range_iterator_t<Rng>, O>> unique_copy(ExPolicy &&policy, Rng &&rng, O dest, Pred &&pred = Pred(), Proj &&proj = Proj())# Copies the elements from the range rng, to another range beginning at dest in such a way that there are no consecutive equal elements. Only the first element of each group of equal elements is copied.
The assignments in the parallel unique_copy algorithm invoked with an execution policy object of type sequenced_policy execute in sequential order in the calling thread.
The assignments in the parallel unique_copy 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: Performs not more than N assignments, exactly N - 1 applications of the predicate pred, where N = std::distance(begin(rng), end(rng)).
- 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.
Rng – The type of the source range used (deduced). The iterators extracted from this range type must meet the requirements of an forward iterator.
O – The type of the iterator representing the destination range (deduced). This iterator type must meet the requirements of a forward iterator.
Pred – The type of the function/function object to use (deduced). Unlike its sequential form, the parallel overload of unique_copy requires Pred to meet the requirements of CopyConstructible. This defaults to std::equal_to<>
Proj – The type of an optional projection function. This defaults to hpx::identity
- Parameters
policy – The execution policy to use for the scheduling of the iterations.
rng – Refers to the sequence of elements the algorithm will be applied to.
dest – Refers to the beginning of the destination range.
pred – Specifies the function (or function object) which will be invoked for each of the elements in the sequence specified by the range rng. This is an binary predicate which returns true for the required elements. The signature of this predicate should be equivalent to:
The signature does not need to have const&, but the function must not modify the objects passed to it. The type Type must be such that an object of type FwdIter1 can be dereferenced and then implicitly converted to Type.bool pred(const Type &a, const Type &b);
proj – Specifies the function (or function object) which will be invoked for each of the elements as a projection operation before the actual predicate is invoked.
- Returns
The unique_copy algorithm returns a hpx::future<unique_copy_result< hpx::traits::range_iterator_t<Rng>, O>> if the execution policy is of type sequenced_task_policy or parallel_task_policy and returns unique_copy_result< hpx::traits::range_iterator_t<Rng>, O> otherwise. The unique_copy algorithm returns the pair of the source iterator to last, and the destination iterator to the end of the dest range.
-
template<typename FwdIter, typename Sent, typename Pred = ranges::equal_to, typename Proj = hpx::identity>
-
namespace ranges