10template <std::ranges::input_range R1, std::ranges::input_range R2,
11 class Comp = std::ranges::less,
class Proj1 = std::identity,
12 class Proj2 = std::identity>
13 requires(std::ranges::view<R1> && std::ranges::view<R2>)
15 : std::ranges::view_interface<
27 Proj1 &&proj1, Proj2 &&proj2)
28 : range1{std::forward<R1>(range1)}, range2{std::forward<R2>(range2)},
29 comp{std::forward<Comp>(comp)}, proj1{std::forward<Proj1>(proj1)},
30 proj2{std::forward<Proj2>(proj2)} {}
33 template <std::input_iterator I1, std::sentinel_for<I1> S1,
34 std::input_iterator I2, std::sentinel_for<I2> S2>
38 iter_t(I1 first1, S1 last1, I2 first2, S2 last2, Comp comp, Proj1 proj1,
40 : first1{std::move(first1)}, last1{std::move(last1)},
41 first2{std::move(first2)}, last2{std::move(last2)},
42 comp{std::move(comp)}, proj1{std::move(proj1)}, proj2{std::move(
53 using value_type = std::tuple<
decltype(*first1),
decltype(*first2)>;
56 return first1 != last1 && first2 != last2;
76 if (std::invoke(comp, std::invoke(proj1, *first1),
77 std::invoke(proj2, *first2)))
79 else if (std::invoke(comp, std::invoke(proj2, *first2),
80 std::invoke(proj1, *first1)))
89 template <
class I1,
class S1,
class I2,
class S2>
92 return {first1, last1, first2, last2, comp, proj1, proj2};
96 auto begin() const -> std::input_or_output_iterator auto{
97 auto it = iter(std::ranges::begin(range1), std::ranges::end(range1),
98 std::ranges::begin(range2), std::ranges::end(range2));
109template <std::ranges::viewable_range R1, std::ranges::viewable_range R2,
110 class Comp = std::ranges::less,
class Proj1 = std::identity,
111 class Proj2 = std::identity>
112set_intersection_iterable<std::ranges::views::all_t<R1>,
113 std::ranges::views::all_t<R2>, Comp, Proj1, Proj2>
117 requires(set_intersection_iterable<std::ranges::views::all_t<R1>,
118 std::ranges::views::all_t<R2>, Comp,
121 { s.end() } -> std::sentinel_for<
decltype(s.begin())>;
124 std::forward<R1>(r1), std::forward<R2>(r2), std::move(comp),
125 std::move(proj1), std::move(proj2),
set_intersection_iterable< std::ranges::views::all_t< R1 >, std::ranges::views::all_t< R2 >, Comp, Proj1, Proj2 > iter_set_intersection(R1 &&r1, R2 &&r2, Comp comp={}, Proj1 proj1={}, Proj2 proj2={})
std::tuple< decltype(*first1), decltype(*first2)> value_type
bool operator!=(sentinel_t) const
iter_t(I1 first1, S1 last1, I2 first2, S2 last2, Comp comp, Proj1 proj1, Proj2 proj2)
friend bool operator==(sentinel_t s, const iter_t &i)
friend bool operator!=(sentinel_t s, const iter_t &i)
value_type operator*() const
std::ptrdiff_t difference_type
bool operator==(sentinel_t s) const
set_intersection_iterable(R1 &&range1, R2 &&range2, Comp &&comp, Proj1 &&proj1, Proj2 &&proj2)
set_intersection_iterable()=default
auto begin() const -> std::input_or_output_iterator auto
iter_t< I1, S1, I2, S2 > iter(I1 first1, S1 last1, I2 first2, S2 last2) const