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

19 lines
569 B
C++

#ifndef sk_MUTILS_HPP
#define sk_MUTILS_HPP
#include <stdexcept>
#define ENUM_ENUM(X) X
#define ENUM_STRING(X) #X
#define SK_ENUM(PREFIX, ENUM) \
enum PREFIX ## Type { ENUM(ENUM_ENUM) }; \
constexpr char const* PREFIX ## TypeStr [] = { ENUM(ENUM_STRING) }
#define SK_ERROR(NAME) \
struct NAME : public std::runtime_error { \
NAME (std::string const& what) : std::runtime_error(what) {} \
}
#endif