21#ifndef RANGES_V3_ALGORITHM_SET_ALGORITHM_HPP
22#define RANGES_V3_ALGORITHM_SET_ALGORITHM_HPP
29#include <range/v3/algorithm/result_types.hpp>
39#include <range/v3/utility/static_const.hpp>
41#include <range/v3/detail/prologue.hpp>
47 RANGES_FUNC_BEGIN(includes)
60 constexpr bool RANGES_FUNC(includes)(I1 begin1,
68 for(; begin2 != end2; ++begin1)
80 template(
typename Rng1,
89 constexpr bool RANGES_FUNC(includes)(
90 Rng1 && rng1, Rng2 && rng2, C pred = C{}, P1 proj1 = P1{}, P2 proj2 = P2{})
92 return (*
this)(begin(rng1),
101 RANGES_FUNC_END(includes)
105 using ranges::includes;
108 template<
typename I1,
typename I2,
typename O>
109 using set_union_result = detail::in1_in2_out_result<I1, I2, O>;
111 RANGES_FUNC_BEGIN(set_union)
114 template(typename I1,
123 mergeable<I1, I2, O, C, P1, P2>)
124 constexpr set_union_result<I1, I2, O> RANGES_FUNC(set_union)(I1 begin1,
133 for(; begin1 != end1; ++out)
137 auto tmp = ranges::copy(begin1, end1, out);
138 return {tmp.in, begin2, tmp.out};
153 auto tmp = ranges::copy(begin2, end2, out);
154 return {begin1, tmp.in, tmp.out};
158 template(
typename Rng1,
166 constexpr set_union_result<borrowed_iterator_t<Rng1>, borrowed_iterator_t<Rng2>, O>
167 RANGES_FUNC(set_union)(Rng1 && rng1,
174 return (*
this)(begin(rng1),
184 RANGES_FUNC_END(set_union)
188 using ranges::set_union;
189 using ranges::set_union_result;
192 RANGES_FUNC_BEGIN(set_intersection)
195 template(
typename I1,
204 mergeable<I1, I2, O, C, P1, P2>)
205 constexpr O RANGES_FUNC(set_intersection)(I1 begin1,
214 while(begin1 != end1 && begin2 != end2)
233 template(
typename Rng1,
241 constexpr O RANGES_FUNC(set_intersection)(Rng1 && rng1,
248 return (*
this)(begin(rng1),
258 RANGES_FUNC_END(set_intersection)
262 using ranges::set_intersection;
265 template<
typename I,
typename O>
266 using set_difference_result = detail::in1_out_result<I, O>;
268 RANGES_FUNC_BEGIN(set_difference)
271 template(
typename I1,
280 mergeable<I1, I2, O, C, P1, P2>)
281 constexpr set_difference_result<I1, O> RANGES_FUNC(set_difference)(I1 begin1,
290 while(begin1 != end1)
294 auto tmp = ranges::copy(begin1, end1, out);
295 return {tmp.in, tmp.out};
310 return {begin1, out};
314 template(
typename Rng1,
322 constexpr set_difference_result<borrowed_iterator_t<Rng1>, O>
323 RANGES_FUNC(set_difference)(Rng1 && rng1,
330 return (*
this)(begin(rng1),
340 RANGES_FUNC_END(set_difference)
344 using ranges::set_difference;
345 using ranges::set_difference_result;
348 template<
typename I1,
typename I2,
typename O>
349 using set_symmetric_difference_result = detail::in1_in2_out_result<I1, I2, O>;
351 RANGES_FUNC_BEGIN(set_symmetric_difference)
354 template(
typename I1,
363 mergeable<I1, I2, O, C, P1, P2>)
364 constexpr set_symmetric_difference_result<I1, I2, O>
365 RANGES_FUNC(set_symmetric_difference)(I1 begin1,
374 while(begin1 != end1)
378 auto tmp = ranges::copy(begin1, end1, out);
379 return {tmp.in, begin2, tmp.out};
399 auto tmp = ranges::copy(begin2, end2, out);
400 return {begin1, tmp.in, tmp.out};
404 template(
typename Rng1,
412 constexpr set_symmetric_difference_result<borrowed_iterator_t<Rng1>,
413 borrowed_iterator_t<Rng2>,
415 RANGES_FUNC(set_symmetric_difference)(Rng1 && rng1,
422 return (*
this)(begin(rng1),
432 RANGES_FUNC_END(set_symmetric_difference)
436 using ranges::set_symmetric_difference;
437 using ranges::set_symmetric_difference_result;
442#include <range/v3/detail/epilogue.hpp>
The indirect_strict_weak_order 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
Definition adjacent_find.hpp:67
Definition identity.hpp:25
Definition comparisons.hpp:50