1#ifndef ENTT_CORE_ENUM_HPP
2#define ENTT_CORE_ENUM_HPP
12template<
typename Type,
typename =
void>
16template<
typename Type>
23template<
typename Type>
36template<
typename Type>
37[[nodiscard]]
constexpr std::enable_if_t<entt::enum_as_bitmask_v<Type>, Type>
38operator|(
const Type lhs,
const Type rhs)
noexcept {
39 return static_cast<Type
>(
static_cast<std::underlying_type_t<Type>
>(lhs) |
static_cast<std::underlying_type_t<Type>
>(rhs));
43template<
typename Type>
44[[nodiscard]]
constexpr std::enable_if_t<entt::enum_as_bitmask_v<Type>, Type>
45operator&(
const Type lhs,
const Type rhs)
noexcept {
46 return static_cast<Type
>(
static_cast<std::underlying_type_t<Type>
>(lhs) &
static_cast<std::underlying_type_t<Type>
>(rhs));
50template<
typename Type>
51[[nodiscard]]
constexpr std::enable_if_t<entt::enum_as_bitmask_v<Type>, Type>
52operator^(
const Type lhs,
const Type rhs)
noexcept {
53 return static_cast<Type
>(
static_cast<std::underlying_type_t<Type>
>(lhs) ^
static_cast<std::underlying_type_t<Type>
>(rhs));
63template<
typename Type>
64[[nodiscard]]
constexpr std::enable_if_t<entt::enum_as_bitmask_v<Type>, Type>
65operator~(
const Type value)
noexcept {
66 return static_cast<Type
>(~static_cast<std::underlying_type_t<Type>>(value));
70template<
typename Type>
71[[nodiscard]]
constexpr std::enable_if_t<entt::enum_as_bitmask_v<Type>,
bool>
72operator!(
const Type value)
noexcept {
73 return !
static_cast<std::underlying_type_t<Type>
>(value);
77template<
typename Type>
78constexpr std::enable_if_t<entt::enum_as_bitmask_v<Type>, Type &>
79operator|=(Type &lhs,
const Type rhs)
noexcept {
80 return (lhs = (lhs | rhs));
84template<
typename Type>
85constexpr std::enable_if_t<entt::enum_as_bitmask_v<Type>, Type &>
86operator&=(Type &lhs,
const Type rhs)
noexcept {
87 return (lhs = (lhs & rhs));
91template<
typename Type>
92constexpr std::enable_if_t<entt::enum_as_bitmask_v<Type>, Type &>
93operator^=(Type &lhs,
const Type rhs)
noexcept {
94 return (lhs = (lhs ^ rhs));
constexpr Type make_obj_using_allocator(const Allocator &allocator, Args &&...args)
Uses-allocator construction utility (waiting for C++20).
constexpr bool enum_as_bitmask_v
Helper variable template.
Enable bitmask support for enum classes.