21#ifndef RANGES_V3_ALGORITHM_PARTITION_HPP
22#define RANGES_V3_ALGORITHM_PARTITION_HPP
37#include <range/v3/utility/static_const.hpp>
40#include <range/v3/detail/prologue.hpp>
50 template<
typename I,
typename S,
typename C,
typename P>
51 constexpr I partition_impl(I first, S last, C pred, P proj, std::forward_iterator_tag)
61 for(I p = first; ++p != last;)
65 ranges::iter_swap(first, p);
72 template<
typename I,
typename S,
typename C,
typename P>
73 constexpr I partition_impl(I first, S end_, C pred, P proj, std::bidirectional_iterator_tag)
75 I last = ranges::next(first, end_);
91 ranges::iter_swap(first, last);
98 RANGES_FUNC_BEGIN(partition)
101 template(
typename I,
typename S,
typename C,
typename P =
identity)(
104 constexpr I RANGES_FUNC(partition)(I
first, S last, C pred, P proj = P{})
106 return detail::partition_impl(std::move(first),
110 iterator_tag_of<I>());
114 template(
typename Rng,
typename C,
typename P =
identity)(
117 constexpr borrowed_iterator_t<Rng> RANGES_FUNC(partition)(Rng && rng, C pred, P proj = P{})
119 return detail::partition_impl(begin(rng),
126 RANGES_FUNC_END(partition)
130 using ranges::partition;
135#include <range/v3/detail/epilogue.hpp>
The forward_range concept.
The indirect_unary_predicate concept.
The sentinel_for concept.
decltype(begin(declval(Rng &))) iterator_t
Definition access.hpp:698
typename Fn::template invoke< Args... > invoke
Evaluate the invocable Fn with the arguments Args.
Definition meta.hpp:541
front< Pair > first
Retrieve the first element of the pair Pair.
Definition meta.hpp:2251
Definition adjacent_find.hpp:67
Definition identity.hpp:25