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)(
102 requires permutable<I> AND sentinel_for<S, I> AND
103 indirect_unary_predicate<C, projected<I, P>>)
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)(
115 requires forward_range<Rng> AND permutable<iterator_t<Rng>> AND
116 indirect_unary_predicate<C, projected<iterator_t<Rng>, P>>)
117 constexpr borrowed_iterator_t<Rng> RANGES_FUNC(partition)(Rng && rng, C pred, P proj = P{})
119 return detail::partition_impl(begin(rng),
123 iterator_tag_of<iterator_t<Rng>>());
126 RANGES_FUNC_END(partition)
130 using ranges::partition;
135#include <range/v3/detail/epilogue.hpp>
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