aboutsummaryrefslogtreecommitdiff
path: root/libk/types.h
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2021-03-12 16:44:02 +0200
committerAqua-sama <aqua@iserlohn-fortress.net>2021-03-12 16:44:02 +0200
commitb7f5d7565a19efbfebd72f2877444c552e4230c8 (patch)
treee17ec2edc3be86672442ca1ab854f21cb566b598 /libk/types.h
parentvmm: map multiboot structs (diff)
downloadkernel.cpp-b7f5d7565a19efbfebd72f2877444c552e4230c8.tar.xz
libk: add Result<T, E> class
Diffstat (limited to 'libk/types.h')
-rw-r--r--libk/types.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/libk/types.h b/libk/types.h
index 7f16206..3e728fb 100644
--- a/libk/types.h
+++ b/libk/types.h
@@ -35,7 +35,7 @@ typedef long long int int64_t;
constexpr int64_t int64_t_max = uint64_t_max / 2;
constexpr int64_t int64_t_min = -int64_t_max - 1;
-// Type Traits
+/* Type Traits */
template <class T, T v>
struct integral_constant {
@@ -54,3 +54,7 @@ struct is_same<T, T> : integral_constant<bool, true> {};
/* is_unsigned */
template <typename T>
struct is_unsigned : integral_constant<bool, (T{0} < static_cast<T>(-1))> {};
+
+/* error enum concept */
+template <typename T>
+concept error_enum_t = (__is_enum(T) && requires { T::NoError; });