wren
Vulkan-based game engine
Loading...
Searching...
No Matches
enums.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <boost/describe.hpp>
4#include <string>
5
6template <class E>
7auto enum_to_string(E e) -> std::string {
8 std::string r = "(unamed)";
9 boost::mp11::mp_for_each<boost::describe::describe_enumerators<E>>(
10 [&](auto D) {
11 if (e == D.value) r = std::string(D.name);
12 });
13 return r;
14}
15
16// NOLINTNEXTLINE
17#define DESCRIBED_ENUM(E, ...) \
18 enum class E { __VA_ARGS__ }; \
19 BOOST_DESCRIBE_ENUM(E, __VA_ARGS__)
auto enum_to_string(E e) -> std::string
Definition enums.hpp:7