summaryrefslogtreecommitdiff
path: root/AK/EnumBits.h
diff options
context:
space:
mode:
authorAnotherTest <ali.mpfard@gmail.com>2021-04-10 18:29:06 +0430
committerAndreas Kling <kling@serenityos.org>2021-04-10 21:01:31 +0200
commita6e448208052c2d03fca53a4061a367b33167d37 (patch)
tree0d6f84d1257e2af57d28a3102d0622fcf716782b /AK/EnumBits.h
parentd8d16dea957f15f07ebb08d1578e21d97fc163bc (diff)
downloadserenity-a6e448208052c2d03fca53a4061a367b33167d37.zip
AK+Everywhere: Make StdLibExtras templates less wrapper-y
This commit makes the user-facing StdLibExtras templates and utilities arguably more nice-looking by removing the need to reach into the wrapper structs generated by them to get the value/type needed. The C++ standard library had to invent `_v` and `_t` variants (likely because of backwards compat), but we don't need to cater to any codebase except our own, so might as well have good things for free. :^)
Diffstat (limited to 'AK/EnumBits.h')
-rw-r--r--AK/EnumBits.h16
1 files changed, 8 insertions, 8 deletions
diff --git a/AK/EnumBits.h b/AK/EnumBits.h
index 57dea9b6b5..2be7226993 100644
--- a/AK/EnumBits.h
+++ b/AK/EnumBits.h
@@ -44,35 +44,35 @@
\
[[nodiscard]] Prefix constexpr inline Enum operator|(Enum lhs, Enum rhs) \
{ \
- using Type = UnderlyingType<Enum>::Type; \
+ using Type = UnderlyingType<Enum>; \
return static_cast<Enum>( \
static_cast<Type>(lhs) | static_cast<Type>(rhs)); \
} \
\
[[nodiscard]] Prefix constexpr inline Enum operator&(Enum lhs, Enum rhs) \
{ \
- using Type = UnderlyingType<Enum>::Type; \
+ using Type = UnderlyingType<Enum>; \
return static_cast<Enum>( \
static_cast<Type>(lhs) & static_cast<Type>(rhs)); \
} \
\
[[nodiscard]] Prefix constexpr inline Enum operator^(Enum lhs, Enum rhs) \
{ \
- using Type = UnderlyingType<Enum>::Type; \
+ using Type = UnderlyingType<Enum>; \
return static_cast<Enum>( \
static_cast<Type>(lhs) ^ static_cast<Type>(rhs)); \
} \
\
[[nodiscard]] Prefix constexpr inline Enum operator~(Enum rhs) \
{ \
- using Type = UnderlyingType<Enum>::Type; \
+ using Type = UnderlyingType<Enum>; \
return static_cast<Enum>( \
~static_cast<Type>(rhs)); \
} \
\
Prefix constexpr inline Enum& operator|=(Enum& lhs, Enum rhs) \
{ \
- using Type = UnderlyingType<Enum>::Type; \
+ using Type = UnderlyingType<Enum>; \
lhs = static_cast<Enum>( \
static_cast<Type>(lhs) | static_cast<Type>(rhs)); \
return lhs; \
@@ -80,7 +80,7 @@
\
Prefix constexpr inline Enum& operator&=(Enum& lhs, Enum rhs) \
{ \
- using Type = UnderlyingType<Enum>::Type; \
+ using Type = UnderlyingType<Enum>; \
lhs = static_cast<Enum>( \
static_cast<Type>(lhs) & static_cast<Type>(rhs)); \
return lhs; \
@@ -88,7 +88,7 @@
\
Prefix constexpr inline Enum& operator^=(Enum& lhs, Enum rhs) \
{ \
- using Type = UnderlyingType<Enum>::Type; \
+ using Type = UnderlyingType<Enum>; \
lhs = static_cast<Enum>( \
static_cast<Type>(lhs) ^ static_cast<Type>(rhs)); \
return lhs; \
@@ -96,6 +96,6 @@
\
Prefix constexpr inline bool has_flag(Enum value, Enum mask) \
{ \
- using Type = UnderlyingType<Enum>::Type; \
+ using Type = UnderlyingType<Enum>; \
return static_cast<Type>(value & mask) != 0; \
}