23 lines
912 B
C++
23 lines
912 B
C++
//
|
|
// Created by erki on 15.07.22.
|
|
//
|
|
|
|
#ifndef SKULLC_UTILITY_ENUM_HELPERS_HPP_
|
|
#define SKULLC_UTILITY_ENUM_HELPERS_HPP_
|
|
|
|
#include <type_traits>
|
|
|
|
#define SKULLC_ENUM_DECLARE_BITFLAG_OPERATORS(E) \
|
|
inline E operator|(const E& lhs, const E& rhs) \
|
|
{ \
|
|
using T = std::underlying_type_t<E>; \
|
|
return static_cast<E>(static_cast<T>(lhs) | static_cast<T>(rhs)); \
|
|
} \
|
|
inline E operator&(const E& lhs, const E& rhs) \
|
|
{ \
|
|
using T = std::underlying_type_t<E>; \
|
|
return static_cast<E>(static_cast<T>(lhs) & static_cast<T>(rhs)); \
|
|
}
|
|
|
|
#endif//SKULLC_UTILITY_ENUM_HELPERS_HPP_
|