19 lines
567 B
C++
19 lines
567 B
C++
#ifndef jk_MUTILS_HPP
|
|
#define jk_MUTILS_HPP
|
|
|
|
#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} {} \
|
|
}
|
|
|
|
#endif
|