meta: add c++ wrapper of core module

This commit is contained in:
2026-02-03 17:41:25 +00:00
parent e0efbd1ec4
commit 13136ecbd6
15 changed files with 682 additions and 3 deletions

View File

@@ -0,0 +1,46 @@
#ifndef BLUE_CORE_MISC_HPP_
#define BLUE_CORE_MISC_HPP_
#define Z__B_ENUM_CLASS_BITWISE_OPS(enum_name) \
inline constexpr enum_name operator&(enum_name x, enum_name y) \
{ \
return static_cast<enum_name>( \
static_cast<int>(x) & static_cast<int>(y)); \
} \
\
inline constexpr enum_name operator|(enum_name x, enum_name y) \
{ \
return static_cast<enum_name>( \
static_cast<int>(x) | static_cast<int>(y)); \
} \
\
inline constexpr enum_name operator^(enum_name x, enum_name y) \
{ \
return static_cast<enum_name>( \
static_cast<int>(x) ^ static_cast<int>(y)); \
} \
\
inline constexpr enum_name operator~(enum_name x) \
{ \
return static_cast<enum_name>(~static_cast<int>(x)); \
} \
\
inline enum_name &operator&=(enum_name &x, enum_name y) \
{ \
x = x & y; \
return x; \
} \
\
inline enum_name &operator|=(enum_name &x, enum_name y) \
{ \
x = x | y; \
return x; \
} \
\
inline enum_name &operator^=(enum_name &x, enum_name y) \
{ \
x = x ^ y; \
return x; \
}
#endif