24#ifndef MYSQL_UTILS_ENUMERATION_UTILS_INCLUDED
25#define MYSQL_UTILS_ENUMERATION_UTILS_INCLUDED
43template <
typename Enum_type>
46 std::is_enum<Enum_type>::value,
47 "to_underlying conversion function called with non-enumeration argument");
48 using EnumValueType = std::underlying_type_t<Enum_type>;
49 return static_cast<EnumValueType
>(enum_value);
57template <
typename Enum_type>
66template <
typename Enum_type,
typename Integral_type>
68 Integral_type value) {
69 static_assert(std::is_enum_v<Enum_type>,
70 "to_enumeration conversion requested for non-enumeration type");
71 static_assert(std::is_integral_v<Integral_type>,
72 "to_enumeration conversion requested from non-integral type");
Definition: gtid_format.h:46
constexpr std::pair< Enum_type, Return_status > to_enumeration(Integral_type value)
Helper function that converts value of enumeration underlying type into enumeration type constant.
Definition: enumeration_utils.h:67
constexpr Enum_type enum_max()
Template function that returns maximum valid constant that can appear in the enumeration type.
constexpr decltype(auto) to_underlying(Enum_type enum_value)
Helper function that converts enum type to underlying integer type.
Definition: enumeration_utils.h:44
Enum_type
Definition: parse_tree_column_attrs.h:836