repr 0.1
Reconstructable string representations and more
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages Concepts
enum/reflect.h
Go to the documentation of this file.
#pragma once
#include <type_traits>
#include <string_view>
#if USING(REPR_USE_MAGIC_ENUM)
#if __has_include(<magic_enum.hpp>)
// include name used when pulling in magic_enum through conan
#include <magic_enum.hpp>
#elif __has_include(<magic_enum/magic_enum.hpp>)
// compiler explorer uses this include name
#include <magic_enum/magic_enum.hpp>
#else
#error "Configured to use magic_enum but could not find magic_enum"
#endif
#else
#include "search.h"
#endif
namespace librepr {
template <typename T>
requires std::is_enum_v<T>
[[nodiscard]] constexpr auto enum_names() noexcept{
#if USING(REPR_USE_MAGIC_ENUM)
return magic_enum::enum_names<T>();
#else
#endif
}
template <typename T>
requires std::is_enum_v<T>
[[nodiscard]] constexpr auto enum_name(T value) noexcept{
#if USING(REPR_USE_MAGIC_ENUM)
return magic_enum::enum_name(value);
#else
#endif
}
template <auto V>
requires std::is_enum_v<decltype(V)>
[[nodiscard]] constexpr std::string_view enum_name() noexcept{
#if USING(REPR_USE_MAGIC_ENUM)
return magic_enum::enum_name<V>();
#else
// TODO
return ctei::enum_name<decltype(V), V>.data();
#endif
}
}