MySQL 9.6.0
Source Code Documentation
base_const_views.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_BASE_CONST_VIEWS_H
25#define MYSQL_SETS_BASE_CONST_VIEWS_H
26
27/// @file
28/// Experimental API header
29
30#include <ranges> // enable_view
31#include "mysql/sets/set_categories.h" // Is_set_category
33#include "mysql/sets/set_traits.h" // Is_bounded_set_traits
34
35/// @addtogroup GroupLibsMysqlSets
36/// @{
37
38namespace mysql::sets {
39
40// ==== Empty sets ====
41
42/// Forward declaration of primary template for views over empty sets.
43///
44/// This may be specialized to set categories for which we need it.
45template <Is_set_category, Is_set_traits>
47
48/// Return a reference to a singleton object representing the view containing
49/// the empty set, for the given Set category and Set traits.
50template <Is_set_category Set_category_t, Is_set_traits Set_traits_t>
51[[nodiscard]] auto &make_empty_set_view() {
53 return ret;
54}
55
56/// Return the result of make_empty_set_view for the set category and set traits
57/// of the given set type.
58template <Is_set Set_t>
59[[nodiscard]] auto &make_empty_set_view_like() {
60 return make_empty_set_view<typename Set_t::Set_category_t,
61 typename Set_t::Set_traits_t>();
62}
63
64// ==== Full sets ====
65
66/// Forward declaration of primary template for views over "full" sets, i.e.,
67/// the complement of the empty set.
68///
69/// This may be specialized to set categories for which we need it. Note that
70/// not all set categories can have "full sets".
71template <Is_set_category, Is_set_traits>
73
74/// Return a reference to a singleton object representing the view containing
75/// the empty set, for the given Set category and Set traits.
76template <Is_set_category Set_category_t, Is_bounded_set_traits Set_traits_t>
77[[nodiscard]] auto &make_full_set_view() {
79 return ret;
80}
81
82/// Return the result of make_full_set_view for the set category and set traits
83/// of the given set type.
84template <Is_set Set_t>
85[[nodiscard]] auto &make_full_set_view_like() {
86 return make_full_set_view<typename Set_t::Set_category_t,
87 typename Set_t::Set_traits_t>();
88}
89
90} // namespace mysql::sets
91
92// ==== Declarations of view ====
93
94/// @cond DOXYGEN_DOES_NOT_UNDERSTAND_THIS
95/// Declare that Empty_view is a view.
96template <class Set_category_t, class Set_traits_t>
97constexpr bool std::ranges::enable_view<
99
100/// Declare that Full_view is a view.
101template <class Set_category_t, class Set_traits_t>
102constexpr bool std::ranges::enable_view<
104/// @endcond
105
106// addtogroup GroupLibsMysqlSets
107/// @}
108
109#endif // ifndef MYSQL_SETS_BASE_CONST_VIEWS_H
Forward declaration of primary template for views over empty sets.
Definition: base_const_views.h:46
Forward declaration of primary template for views over "full" sets, i.e., the complement of the empty...
Definition: base_const_views.h:72
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
auto & make_empty_set_view_like()
Return the result of make_empty_set_view for the set category and set traits of the given set type.
Definition: base_const_views.h:59
auto & make_full_set_view_like()
Return the result of make_full_set_view for the set category and set traits of the given set type.
Definition: base_const_views.h:85
auto & make_empty_set_view()
Return a reference to a singleton object representing the view containing the empty set,...
Definition: base_const_views.h:51
Experimental API header.
Experimental API header.
Experimental API header.