This repository has been archived on 2023-09-10. You can view files and clone it, but cannot push or open issues/pull-requests.
joko/lib/mutils.hpp

19 lines
567 B
C++
Raw Normal View History

2023-09-09 11:02:52 +00:00
#ifndef jk_MUTILS_HPP
#define jk_MUTILS_HPP
2023-09-09 13:09:43 +00:00
#include <stdexcept>
#define ENUM_ENUM(X) X
#define ENUM_STRING(X) #X
#define JK_ENUM(PREFIX, DECL) \
enum PREFIX ## Type { DECL(ENUM_ENUM) }; \
constexpr char const* PREFIX ## TypeStr [] { DECL(ENUM_STRING) }
#define JK_ERROR(NAME) \
struct NAME : public std::runtime_error { \
NAME (std::string const& what): std::runtime_error {what} {} \
}
2023-09-09 11:02:52 +00:00
#endif