24#ifndef MYSQL_SETS_NESTED_SET_SUBTRACTION_VIEW_H
25#define MYSQL_SETS_NESTED_SET_SUBTRACTION_VIEW_H
45template <Is_nested_set Source1_tp, Is_nested_set Source2_tp>
46 requires Is_compatible_set<Source1_tp, Source2_tp>
47class Subtraction_view<Source1_tp, Source2_tp>
48 :
public detail::Nested_set_binary_operation_view_interface<
49 Subtraction_view<Source1_tp, Source2_tp>, Source1_tp, Source2_tp,
50 Binary_operation::op_subtraction> {
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 return make_iterator(this->m_source1.begin(), this->m_source2.begin());
93 return make_iterator(this->m_source1.end(), this->m_source2.end());
98 auto it1 = this->m_source1.find(
key);
99 if (it1 == this->m_source1.end())
return end();
100 auto it2 = this->m_source2.find(
key);
101 if (it2 != this->m_source2.end() &&
is_subset(it1->second, it2->second))
103 return make_iterator(it1, it2);
117 auto it1 = this->m_source1.find(cursor.iterator1(),
key);
118 if (it1 == this->m_source1.end())
return end();
119 auto it2 = this->m_source2.find(cursor.iterator2(),
key);
120 if (it2 != this->m_source2.end() &&
is_subset(it1->second, it2->second))
122 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 one set minus another other set.
Definition: boundary_set_subtraction_view.h:51
Subtraction_view(const Source1_t *source1, const Source2_t *source2) noexcept
Construct a new Subtraction_view over the given sources.
Definition: nested_set_subtraction_view.h:83
auto end() const noexcept
Definition: nested_set_subtraction_view.h:92
auto begin() const noexcept
Definition: nested_set_subtraction_view.h:87
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_subtraction_view.h:116
Subtraction_view() noexcept=default
auto find(const Key_t &key) const noexcept
Return iterator to the given key, or end() if not found.
Definition: nested_set_subtraction_view.h:97
Primary template for views over subtractions of two sets operations.
Definition: base_binary_operation_views.h:68
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_subset(const Interval< Set_traits_t > &interval1, const Is_boundary_set_over_traits< Set_traits_t > auto &set2)
Return true if the left Interval is a subset of or equal to the right Boundary_set.
Definition: boundary_set_predicates.h:58
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