7 class U = std::underlying_type_t<E>>
14 static_assert(std::is_enum_v<E>,
"Enum<E, ...> must be an enum");
15 static_assert(std::is_integral_v<U>,
"Enum<..., U> must be an integral");
17 constexpr
Enum() noexcept = default;
18 constexpr
Enum(const
Enum&) noexcept = default;
23 _impl(static_cast<U>(a_rhs.
get()))
26 constexpr
Enum(E a_value) noexcept :
27 _impl(
static_cast<U
>(a_value))
32 constexpr
Enum& operator=(const
Enum&) noexcept = default;
33 constexpr
Enum& operator=(
Enum&&) noexcept = default;
36 constexpr
Enum& operator=(
Enum<E, U2> a_rhs) noexcept
38 _impl =
static_cast<U
>(a_rhs.get());
43 _impl =
static_cast<U
>(a_value);
48 [[nodiscard]]
explicit constexpr
operator bool() const noexcept {
return _impl !=
static_cast<U
>(0); }
50 [[nodiscard]] constexpr E
operator*() const noexcept {
return get(); }
51 [[nodiscard]] constexpr E
get() const noexcept {
return static_cast<E
>(_impl); }
52 [[nodiscard]] constexpr U
underlying() const noexcept {
return _impl; }
55 friend constexpr
bool operator==(
Enum a_lhs,
Enum a_rhs) noexcept {
return a_lhs.underlying() == a_rhs.underlying(); }
56 friend constexpr
bool operator==(
Enum a_lhs, E a_rhs) noexcept {
return a_lhs.underlying() ==
static_cast<U
>(a_rhs); }
57 friend constexpr
bool operator==(E a_lhs,
Enum a_rhs) noexcept {
return static_cast<U
>(a_lhs) == a_rhs.underlying(); }
63 template <
class... Args>
65 std::common_type_t<Args...>,
66 std::underlying_type_t<
67 std::common_type_t<Args...>>>;
constexpr Enum() noexcept=default
constexpr friend bool operator==(Enum a_lhs, E a_rhs) noexcept
Definition: Enum.h:56
constexpr friend bool operator==(E a_lhs, Enum a_rhs) noexcept
Definition: Enum.h:57
constexpr E get() const noexcept
Definition: Enum.h:51
constexpr friend bool operator==(Enum a_lhs, Enum a_rhs) noexcept
Definition: Enum.h:55
constexpr Enum & operator=(E a_value) noexcept
Definition: Enum.h:41
constexpr E operator*() const noexcept
Definition: Enum.h:50
constexpr U underlying() const noexcept
Definition: Enum.h:52
U underlying_type
Definition: Enum.h:12
constexpr Enum(E a_value) noexcept
Definition: Enum.h:26
E enum_type
Definition: Enum.h:11
Definition: BSDirectInputManager.h:8
Enum(Args...) -> Enum< std::common_type_t< Args... >, std::underlying_type_t< std::common_type_t< Args... >>>