diff options
Diffstat (limited to 'libk')
-rw-r--r-- | libk/result.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/libk/result.h b/libk/result.h index 8077baf..e940bd9 100644 --- a/libk/result.h +++ b/libk/result.h @@ -7,6 +7,7 @@ template <typename T, error_enum_t E> class Result { public: + constexpr Result() = default; explicit constexpr Result(T t) : is_ok(true), data{.t = t} {}; explicit constexpr Result(E e) : is_ok(false), data{.e = e} {}; @@ -15,9 +16,9 @@ public: constexpr T value() const { return is_ok ? data.t : T{}; } private: - const bool is_ok; + const bool is_ok = false; union { T t; - E e; + E e = E::NoError; } data; }; |