24#ifndef MYSQL_SETS_NESTED_SET_PREDICATES_H
25#define MYSQL_SETS_NESTED_SET_PREDICATES_H
47template <
class Key_t, Is_set Mapped1_t, Is_set Mapped2_t>
48 requires(Is_compatible_set<Mapped1_t, Mapped2_t> &&
49 !std::same_as<Mapped1_t, Mapped2_t>)
50[[nodiscard]]
constexpr bool operator==(
51 const std::pair<const Key_t, Mapped1_t> &
left,
52 const std::pair<const Key_t, Mapped2_t> &
right) {
57template <Is_nested_set Nested_set_t>
59 const Nested_set_t &
set,
const typename Nested_set_t::Key_t &
key,
60 const auto &...mapped) {
62 if (it ==
set.end())
return false;
68template <Is_nested_set Nested_set1_t, Is_nested_set Nested_set2_t>
69 requires Is_compatible_set<Nested_set1_t, Nested_set2_t>
70[[nodiscard]]
constexpr bool is_subset(
const Nested_set1_t &set1,
71 const Nested_set2_t &set2) {
73 if (set1.size() > set2.size())
return false;
75 for (
auto &&[
key, mapped1] : set1) {
76 auto it2 = set2.find(
key);
77 if (it2 == set2.end())
return false;
78 if (!
is_subset(mapped1, it2->second))
return false;
84template <Is_nested_set Nested_set1_t, Is_nested_set Nested_set2_t>
85 requires Is_compatible_set<Nested_set1_t, Nested_set2_t>
87 const Nested_set2_t &set2) {
88 auto cursor1 = set1.begin();
89 auto cursor2 = set2.begin();
90 while (cursor1 != set1.end()) {
93 auto it2 = set2.find(cursor2, cursor1->first);
94 if (it2 != set2.end()) {
97 if (cursor2 == set2.end())
return false;
100 auto it1 = set1.find(cursor1, cursor2->first);
101 if (it1 != set1.end()) {
Determines if the given type has "fast" size computations.
Definition: meta.h:61
void right(std::string *to_trim)
Definition: trim.h:41
void left(std::string *to_trim)
Definition: trim.h:35
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
bool contains_element(const mysql::gtids::Is_gtid_set auto >id_set, const mysql::gtids::Is_gtid auto >id) noexcept
contains_element for Gtid_sets, accepting a Gtid for the element.
Definition: gtid_set.h:186
constexpr bool is_intersecting(const Interval< Set_traits_t > &interval, const Is_boundary_set_over_traits< Set_traits_t > auto &set)
Return true if the left Interval and the right Boundary set intersect (overlap).
Definition: boundary_set_predicates.h:121
std::set< Key, Compare, ut::allocator< Key > > set
Specialization of set which uses ut_allocator.
Definition: ut0new.h:2888
required string key
Definition: replication_asynchronous_connection_failover.proto:60