MySQL 9.6.0
Source Code Documentation
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_META_H
25#define MYSQL_SETS_META_H
26
27/// @file
28/// Experimental API header
29
30#include <type_traits> // false_type
31
32/// @addtogroup GroupLibsMysqlSets
33/// @{
34
35namespace mysql::sets::detail {
36
37/// Helper to implement Has_fast_size. This is true if Set_t::disable_fast_size
38/// is a constexpr bool member with value true; false if the member is absent or
39/// false.
40template <class Set_t>
41concept Has_disabled_fast_size = Set_t::disable_fast_size;
42
43} // namespace mysql::sets::detail
44
45namespace mysql::sets {
46
47/// Determines if the given type has "fast" size computations.
48///
49/// Set types can declare themselves as having "slow" size computations by
50/// defining a constexpr bool member variable named `disable_fast_size` and
51/// having the value `true`.
52///
53/// Typically, containers that store the size explicitly should *not* define
54/// disable_fast_size, whereas views over set operations, which may compute the
55/// size by iterating over the set, *should* define disable_fast_size.
56///
57/// For sets that *have* fast size operations, operations such as set equality
58/// can implement optimizations, by comparing the size first, and compare the
59/// full set element-by-element only for same-sized sets.
60template <class Set_t>
62
63} // namespace mysql::sets
64
65namespace mysql::sets {
66
67/// Customization point that set container types can use to indicate that they
68/// support noexcept move-semantics for full-set-copy operations between the
69/// given types. Note that this can be defined for different, compatible types.
70/// This will be invoked with cvref-removed `Source_t` and `Target_t`, and
71/// should indicate if move-semantics is enabled for `Source_t&&` and
72/// `Target_t`.
73template <class Source_t, class Target_t>
74struct Enable_donate_set : public std::false_type {};
75
76/// Enable move-semantics when moving one set to itself.
77template <class Set_t>
78struct Enable_donate_set<Set_t, Set_t> : public std::true_type {};
79
80/// True if move-semantics has been declared as enabled for full-set-copy
81/// operations for the given operand types, with cvref removed from `Source_t`.
82template <class Source_t, class Target_t>
84 Enable_donate_set<std::remove_cvref_t<Source_t>, Target_t>::value;
85
86/// True if move-semantics has been declared as enabled for full-set-copy
87/// operations for the given operand types, and `Source_t` is an rvalue
88/// reference type.
89template <class Source_t, class Target_t>
91 std::is_rvalue_reference_v<Source_t>;
92
93/// Customization point that set container types can use to indicate that they
94/// support noexcept move-semantics to copy parts of a set during
95/// inplace_union/inplace_intersect/inplace_subtract operations between the
96/// given types. Note that this can be defined for different, compatible types.
97/// This will be invoked with cvref-removed `Source_t` and `Target_t`, and
98/// should indicate if move-semantics is enabled for `Source_t&&` and
99/// `Target_t`.
100template <class Source_t, class Target_t>
101struct Enable_donate_set_elements : public std::false_type {};
102
103/// True if move-semantics has been declared as enabled for
104/// inplace_union/inplace_intersect/inplace_subtract operations for the given
105/// operand types, with cvref removed from `Source_t`.
106template <class Source_t, class Target_t>
108 Enable_donate_set_elements<std::remove_cvref_t<Source_t>, Target_t>::value;
109
110/// True if move-semantics has been declared as enabled for
111/// inplace_union/inplace_intersect/inplace_subtract operations for the given
112/// operand types, and `Source_t` is an rvalue reference type.
113template <class Source_t, class Target_t>
116 std::is_rvalue_reference_v<Source_t>;
117
118} // namespace mysql::sets
119
120// addtogroup GroupLibsMysqlSets
121/// @}
122
123#endif // ifndef MYSQL_SETS_META_H
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 inplace_union/inplace_intersect/inplace_subtr...
Definition: meta.h:114
True if move-semantics has been declared as enabled for full-set-copy operations for the given operan...
Definition: meta.h:83
True if move-semantics has been declared as enabled for full-set-copy operations for the given operan...
Definition: meta.h:90
Determines if the given type has "fast" size computations.
Definition: meta.h:61
Helper to implement Has_fast_size.
Definition: meta.h:41
ValueType value(const std::optional< ValueType > &v)
Definition: gtid.h:83
Definition: aliases.h:97
Definition: gtid_set.h:183
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