MySQL 9.6.0
Source Code Documentation
interval_set_meta.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_INTERVAL_SET_META_H
25#define MYSQL_SETS_INTERVAL_SET_META_H
26
27/// @file
28/// Experimental API header
29///
30/// - Is_interval_set<T>: true if T is an interval set:
31/// essentially has the members defined by std::view_interface, with value
32/// type Interval, and has the member function boundaries() which returns the
33/// underlying boundary set.
34///
35/// - Is_interval_container<T>: true if T is an interval container:
36/// this is an interval set with additional members assign, clear, insert,
37/// remove, inplace_union, inplace_subtract, inplace_intersect
38
39#include "mysql/sets/boundary_set_meta.h" // Is_boundary_container_ref
40#include "mysql/sets/interval_set_category.h" // Interval_set_category_tag
41#include "mysql/sets/meta.h" // Enable_donate_set
43#include "mysql/sets/set_traits.h" // Has_set_traits
44
45/// @addtogroup GroupLibsMysqlSets
46/// @{
47///
48/// This file defines the category tag class and the type traits (concepts)
49/// related to boundary sets.
50///
51/// The main traits are the following:
52///
53/// - Is_interval_set<T>: true if T is an interval set: essentially has the
54/// members defined by std::view_interface, with Interval as the iterator
55/// value type, and a `boundaries()` member function that returns the
56/// underlying boundary set.
57///
58/// - Is_interval_container<T>: true if T is an interval container: this is an
59/// interval set with additional members clear, assign, insert, remove,
60/// inplace_union, inplace_subtract, inplace_intersection, requiring that
61/// boundaries() returns a boundary container.
62
63namespace mysql::sets {
64
65// ==== Is_interval_set ====
66
67// Forward declaration.
68template <Is_bounded_set_traits Set_traits_tp>
69class Interval;
70
71// True if Test is an interval set, i.e., provides a view over Interval
72// objects and has the member function boundaries() which returns the underlying
73// boundary set.
74template <class Test>
78 std::same_as<typename Test::Element_t,
79 typename Test::Set_traits_t::Element_t> &&
82 requires(Test t) {
83 {
84 t.boundaries()
86 };
87
88// True if Test is an interval set over the given Set traits.
89template <class Test, class Set_traits_t>
93
94// True if std::remove_cvref_t<Test> is an interval set over the given Set
95// traits.
96template <class Test, class Set_traits_t>
99
100// ==== Is_interval_container ====
101
102/// True if `Test` is an Interval_container.
103template <class Test>
107 Test, typename Test::Set_traits_t::Element_t,
109 requires(Test t) {
110 { t.boundaries() } -> Is_boundary_container_ref;
111 {
112 t.boundaries()
114 };
115
116/// The type of the Boundary Set for a given Interval Set.
117template <Is_interval_container Interval_container_t>
118using Interval_set_boundary_set_type = std::remove_cvref_t<
119 decltype(std::declval<Interval_container_t>().boundaries())>;
120
121// ==== Enable_donate_set[_elements] ====
122
123namespace detail {
124
125/// Helper concept to define the condition when Enable_donate_set shall be
126/// defined for Interval Container types.
127template <class Source_t, class Target_t>
132 Interval_set_boundary_set_type<Target_t>>;
133
134/// Helper concept to define the condition when Enable_donate_set_elements shall
135/// be defined for Interval Container types.
136template <class Source_t, class Target_t>
140 Interval_set_boundary_set_type<Source_t>,
141 Interval_set_boundary_set_type<Target_t>>;
142
143} // namespace detail
144
145/// Declare that move-semantics is supported for full-set-copy operations on
146/// compatible Interval Set container types, whenever the boundary types support
147/// it.
148template <class Source_t, class Target_t>
150 Target_t>
151struct Enable_donate_set<Source_t, Target_t> : public std::true_type {};
152
153/// Declare that move-semantics is supported for element operations on
154/// compatible Interval Set container types, whenever the boundary type supports
155/// it, and full-set-copy is enabled.
156template <Is_interval_container Source_t, Is_interval_container Target_t>
158 Source_t, Target_t>
159struct Enable_donate_set_elements<Source_t, Target_t> : public std::true_type {
160};
161
162} // namespace mysql::sets
163
164// addtogroup GroupLibsMysqlSets
165/// @}
166
167#endif // ifndef MYSQL_SETS_INTERVAL_SET_META_H
Experimental API header.
True if Test models Is_collection, with Value_t as its value type.
Definition: meta.h:131
True if move-semantics has been declared as enabled for inplace_union/inplace_intersect/inplace_subtr...
Definition: meta.h:107
True if move-semantics has been declared as enabled for full-set-copy operations for the given operan...
Definition: meta.h:83
True if Test has a member Set_category_t satisfying Is_set_category.
Definition: set_categories.h:55
True if Test has a member Set_traits_t.
Definition: set_traits.h:59
True if Test is a reference to a Boundary_container.
Definition: boundary_set_meta.h:450
True if Test is a reference to a boundary set.
Definition: boundary_set_meta.h:232
True if Test is a "bounded" Set traits class.
Definition: set_traits.h:105
True if Set1_t and Set2_t have the same Set_category_t and Set_traits_t.
Definition: set_categories_and_traits.h:77
True if Test is an Interval_container.
Definition: interval_set_meta.h:104
Definition: interval_set_meta.h:90
Definition: interval_set_meta.h:75
True if Test is a set.
Definition: set_categories_and_traits.h:62
Helper to implement Is_boundary_container and Is_interval_container.
Definition: boundary_set_meta.h:395
Helper concept to define the condition when Enable_donate_set_elements shall be defined for Interval ...
Definition: interval_set_meta.h:137
Helper concept to define the condition when Enable_donate_set shall be defined for Interval Container...
Definition: interval_set_meta.h:128
Experimental API header.
Experimental API header.
Definition: fts0fts.cc:236
Definition: gtid_set.h:183
std::remove_cvref_t< decltype(std::declval< Interval_container_t >().boundaries())> Interval_set_boundary_set_type
The type of the Boundary Set for a given Interval Set.
Definition: interval_set_meta.h:119
Experimental API header.
Experimental API header.
Struct representing a duration.
Definition: my_time.h:219
Customization point that set container types can use to indicate that they support noexcept move-sema...
Definition: meta.h:101
Customization point that set container types can use to indicate that they support noexcept move-sema...
Definition: meta.h:74