MySQL 9.6.0
Source Code Documentation
boundary_set_complement_view.h
Go to the documentation of this file.
1// Copyright (c) 2025, Oracle and/or its affiliates.
2//
3// This program is free software; you can redistribute it and/or modify
4// it under the terms of the GNU General Public License, version 2.0,
5// as published by the Free Software Foundation.
6//
7// This program is designed to work with certain software (including
8// but not limited to OpenSSL) that is licensed under separate terms,
9// as designated in a particular file or component or in included license
10// documentation. The authors of MySQL hereby grant you an additional
11// permission to link the program and your derivative works with the
12// separately licensed software that they have either included with
13// the program or referenced in the documentation.
14//
15// This program is distributed in the hope that it will be useful,
16// but WITHOUT ANY WARRANTY; without even the implied warranty of
17// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18// GNU General Public License, version 2.0, for more details.
19//
20// You should have received a copy of the GNU General Public License
21// along with this program; if not, write to the Free Software
22// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23
24#ifndef MYSQL_SETS_BOUNDARY_SET_COMPLEMENT_VIEW_H
25#define MYSQL_SETS_BOUNDARY_SET_COMPLEMENT_VIEW_H
26
27/// @file
28/// Experimental API header
29
30#include "mysql/sets/base_binary_operation_views.h" // Subtraction_view
31#include "mysql/sets/base_complement_view.h" // Complement_view
32#include "mysql/sets/boundary_set_category.h" // Boundary_set_category_tag
33#include "mysql/sets/boundary_set_const_views.h" // Full_set_view
34#include "mysql/sets/boundary_set_meta.h" // Is_boundary_set
35#include "mysql/sets/common_predicates.h" // operator==(Boundary_set,Boundary_set)
36
37/// @addtogroup GroupLibsMysqlSets
38/// @{
39
40namespace mysql::sets {
41
42/// Specialization of Complement_view for boundary sets, providing a
43/// view over the complement of another boundary set.
44///
45/// This provides forward iterators.
46///
47/// @tparam Source_tp Type the source boundary set.
48template <Is_boundary_set Source_tp>
49class Complement_view<Source_tp>
50 : public Subtraction_view<Full_set_view<Boundary_set_category_tag,
51 typename Source_tp::Set_traits_t>,
52 Source_tp> {
53 public:
54 using Source_t = Source_tp;
55 using Set_traits_t = typename Source_t::Set_traits_t;
59
60 Complement_view() = default;
61
62 /// Construct the complement view over the given source.
65 source) {}
66
67 // This can be faster than the implementation inherited from Subtraction_view.
68 [[nodiscard]] bool empty() const {
69 return source() ==
70 make_full_set_view<Boundary_set_category_tag, Set_traits_t>();
71 }
72
73 /// Return the source boundary set, that this is the complement of.
74 [[nodiscard]] const Source_t &source() const { return *this->source2(); }
75}; // class Complement_view over boundary set
76
77} // namespace mysql::sets
78
79// addtogroup GroupLibsMysqlSets
80/// @}
81
82#endif // ifndef MYSQL_SETS_BOUNDARY_SET_COMPLEMENT_VIEW_H
Experimental API header.
Experimental API header.
Experimental API header.
Experimental API header.
Experimental API header.
CRTP base class to provide members of a collection based on an implementation that provides begin/end...
Definition: collection_interface.h:90
typename Source_t::Set_traits_t Set_traits_t
Definition: boundary_set_complement_view.h:55
Complement_view(const Source_t &source)
Construct the complement view over the given source.
Definition: boundary_set_complement_view.h:63
const Source_t & source() const
Return the source boundary set, that this is the complement of.
Definition: boundary_set_complement_view.h:74
Source_tp Source_t
Definition: boundary_set_complement_view.h:54
bool empty() const
Definition: boundary_set_complement_view.h:68
This can be specialized to specific set categories, e.g.
Definition: base_complement_view.h:43
Forward declaration of primary template for views over "full" sets, i.e., the complement of the empty...
Definition: base_const_views.h:72
Primary template for views over subtractions of two sets operations.
Definition: base_binary_operation_views.h:68
Experimental API header.
Definition: gtid_set.h:183
auto & make_full_set_view()
Return a reference to a singleton object representing the view containing the empty set,...
Definition: base_const_views.h:77
repeated Source source
Definition: replication_asynchronous_connection_failover.proto:42
Tag to identify a class as a Boundary set.
Definition: boundary_set_category.h:41