repr 0.1
Reconstructable string representations and more
Loading...
Searching...
No Matches
customization/enum.h
Go to the documentation of this file.
1#pragma once
2#include <concepts>
3#include <type_traits>
4
5namespace librepr {
6// Enum customization traits
7
8template <typename T>
9struct Settings;
10
11template <typename T>
12concept has_search_range = std::is_enum_v<T> && requires(T obj) {
13 { Settings<T>::search_range::min };
14 { Settings<T>::search_range::max };
15};
16
17template <typename T>
18concept has_is_flag = std::is_enum_v<T> && requires(T obj) {
19 { Settings<T>::is_flag } -> std::same_as<bool>;
20};
21
22template <typename T>
23concept has_fast_search = std::is_enum_v<T> && requires(T obj) {
24 { Settings<T>::fast_search } -> std::same_as<bool>;
25};
26
27template <typename T>
28concept has_enumerators = std::is_enum_v<T> && requires(T obj) { typename Settings<T>::enumerators; };
29
30} // namespace librepr
Definition customization/enum.h:28
Definition customization/enum.h:23
Definition customization/enum.h:18
Definition customization/enum.h:12
Definition ctvi/ctvi.h:9
std::string code_for()
Definition repr:39