repr 0.1
Reconstructable string representations and more
Loading...
Searching...
No Matches
reflection.h
Go to the documentation of this file.
1#pragma once
2#include <concepts>
3#include <string_view>
4
5// TODO decide whether to constrain has_custom_members to be a value list
6// #include <librepr/util/collections/list.h>
7
8namespace librepr {
9// Reflection customization traits
10
11template <typename T>
12struct Settings;
13
14template <typename T>
15concept has_custom_members = std::is_class_v<T> && requires {
16 typename Settings<T>::members;
17 //typename pack::rebox_v<T, ValueList>; // can rebox into ValueList -> members is a value list
18};
19
20template <typename T>
21concept has_is_literal = std::is_enum_v<T> && requires(T obj) {
22 { Settings<T>::is_literal } -> std::same_as<bool>;
23};
24
25template <typename T>
26concept has_name = std::is_enum_v<T> && requires(T obj) {
27 { Settings<T>::name } -> std::convertible_to<std::string_view>;
28};
29
30}
Definition reflection.h:15
Definition reflection.h:21
Definition reflection.h:26
Definition ctvi/ctvi.h:9
std::string code_for()
Definition repr:39