13 #ifndef RANGES_V3_ALGORITHM_UNIQUE_COPY_HPP
14 #define RANGES_V3_ALGORITHM_UNIQUE_COPY_HPP
20 #include <range/v3/algorithm/result_types.hpp>
30 #include <range/v3/utility/static_const.hpp>
32 #include <range/v3/detail/prologue.hpp>
39 template<
typename I,
typename O>
40 using unique_copy_result = detail::in_out_result<I, O>;
45 template<
typename I,
typename S,
typename O,
typename C,
typename P>
46 constexpr unique_copy_result<I, O> unique_copy_impl(I
first,
51 std::input_iterator_tag,
58 iter_value_t<I> value =
62 while(++
first != last)
67 value = (decltype(x) &&)x;
76 template<
typename I,
typename S,
typename O,
typename C,
typename P>
77 constexpr unique_copy_result<I, O> unique_copy_impl(I
first,
82 std::forward_iterator_tag,
90 while(++
first != last)
95 *out = (decltype(x) &&)x;
104 template<
typename I,
typename S,
typename O,
typename C,
typename P>
105 constexpr unique_copy_result<I, O> unique_copy_impl(I
first,
110 std::input_iterator_tag, std::true_type)
115 while(++
first != last)
119 *++out = (decltype(x) &&)x;
128 RANGES_FUNC_BEGIN(unique_copy)
141 typename P = identity)(
142 requires input_iterator<I> AND sentinel_for<S, I> AND
144 indirectly_copyable<I, O> AND
145 (forward_iterator<I> || forward_iterator<O> ||
146 indirectly_copyable_storable<I, O>))
147 constexpr unique_copy_result<I, O> RANGES_FUNC(unique_copy)(
148 I
first, S last, O out, C pred = C{}, P proj = P{})
150 return detail::unique_copy_impl(std::move(
first),
155 iterator_tag_of<I>(),
160 template(
typename Rng,
typename O,
typename C =
equal_to,
typename P = identity)(
161 requires input_range<Rng> AND
166 constexpr unique_copy_result<borrowed_iterator_t<Rng>, O>
167 RANGES_FUNC(unique_copy)(Rng && rng, O out, C pred = C{}, P proj = P{})
169 return detail::unique_copy_impl(begin(rng),
174 iterator_tag_of<iterator_t<Rng>>(),
178 RANGES_FUNC_END(unique_copy)
182 using ranges::unique_copy;
183 using ranges::unique_copy_result;
188 #include <range/v3/detail/epilogue.hpp>
CPP_concept indirect_relation
\concept indirect_relation
Definition: concepts.hpp:670
CPP_concept forward_iterator
\concept forward_iterator
Definition: concepts.hpp:370
CPP_concept indirectly_copyable_storable
\concept indirectly_copyable_storable
Definition: concepts.hpp:798
CPP_concept indirectly_copyable
\concept indirectly_copyable
Definition: concepts.hpp:782
std::integral_constant< bool, B > bool_
An integral constant wrapper for bool.
Definition: meta.hpp:168
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
bool_< T::type::value==U::type::value > equal_to
A Boolean integral constant wrapper around the result of comparing T::type::value and U::type::value ...
Definition: meta.hpp:237