24#ifndef MYSQL_SETS_NESTED_SET_INTERSECTION_VIEW_H
25#define MYSQL_SETS_NESTED_SET_INTERSECTION_VIEW_H
45template <Is_nested_set Source1_tp, Is_nested_set Source2_tp>
46 requires Is_compatible_set<Source1_tp, Source2_tp>
47class Intersection_view<Source1_tp, Source2_tp>
48 :
public detail::Nested_set_binary_operation_view_interface<
49 Intersection_view<Source1_tp, Source2_tp>, Source1_tp, Source2_tp,
50 Binary_operation::op_intersection> {
54 using Base_t::m_source1;
55 using Base_t::m_source2;
56 using Base_t::make_iterator;
59 using typename Base_t::Iterator_t;
60 using typename Base_t::Key_t;
61 using typename Base_t::Source1_t;
62 using typename Base_t::Source2_t;
73 :
Base_t(source1, source2) {}
84 :
Base_t(source1, source2) {}
88 auto it1 = this->m_source1.begin();
89 if (it1 == this->m_source1.end())
return end();
90 return make_iterator(it1, this->m_source2.begin());
95 return make_iterator(this->m_source1.end(), this->m_source2.end());
100 auto it1 = this->m_source1.find(
key);
101 if (it1 == this->m_source1.end())
return end();
102 auto it2 = this->m_source2.find(
key);
103 if (it2 == this->m_source2.end())
return end();
104 if (
is_disjoint(it1->second, it2->second))
return end();
105 return make_iterator(it1, it2);
119 auto it1 = this->m_source1.find(cursor.iterator1(),
key);
120 if (it1 == this->m_source1.end())
return end();
121 auto it2 = this->m_source2.find(cursor.iterator2(),
key);
122 if (it2 == this->m_source2.end())
return end();
123 if (
is_disjoint(it1->second, it2->second))
return end();
124 return make_iterator(it1, it2);
CRTP base class to provide members of a collection based on an implementation that provides begin/end...
Definition: collection_interface.h:90
Self_tp Self_t
Definition: collection_interface.h:91
View over the intersection of two boundary sets.
Definition: boundary_set_intersection_view.h:51
auto find(Iterator_t &cursor, const Key_t &key) const noexcept
Return iterator to the given key, or end() if not found, using the given iterator cursor as a hint.
Definition: nested_set_intersection_view.h:118
auto find(const Key_t &key) const noexcept
Return iterator to the given key, or end() if not found.
Definition: nested_set_intersection_view.h:99
Intersection_view(const Source1_t *source1, const Source2_t *source2) noexcept
Construct a new Intersection_view over the given sources.
Definition: nested_set_intersection_view.h:83
auto begin() const noexcept
Definition: nested_set_intersection_view.h:87
auto end() const noexcept
Definition: nested_set_intersection_view.h:94
Intersection_view() noexcept=default
Primary template for views over intersections of two sets operations.
Definition: base_binary_operation_views.h:61
Source1_tp Source1_t
Definition: boundary_set_binary_operation_view_base.h:64
Source2_tp Source2_t
Definition: boundary_set_binary_operation_view_base.h:65
Iterator_tp Iterator_t
Definition: boundary_set_interface.h:75
Common base class for all the view classes.
Definition: nested_set_binary_operation_view_interface.h:86
typename Key_traits_t::Element_t Key_t
Definition: nested_set_interface.h:71
Definition: gtid_set.h:183
constexpr bool is_disjoint(const auto &lhs, const auto &rhs)
Return true if the two objects are disjoint (have nothing in common).
Definition: common_predicates.h:119
noexcept
The return type for any call_and_catch(f, args...) call where f(args...) returns Type.
Definition: call_and_catch.h:76
required string key
Definition: replication_asynchronous_connection_failover.proto:60