diff options
author | Claudius 'keldu' Holeksa <mail@keldu.de> | 2024-09-17 11:41:12 +0200 |
---|---|---|
committer | Claudius 'keldu' Holeksa <mail@keldu.de> | 2024-09-17 11:41:12 +0200 |
commit | a3ae458a06f43e9c3e0e346d178c91f46094f990 (patch) | |
tree | 8d36b6eb3d6cca94734264d825f19f583a0ffe74 /modules/core | |
parent | 1d578450dc82843bd4b24f3a6aad2c1a82bbda5e (diff) |
wip
Diffstat (limited to 'modules/core')
-rw-r--r-- | modules/core/c++/error.hpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/modules/core/c++/error.hpp b/modules/core/c++/error.hpp index ac45fbc..32b67a0 100644 --- a/modules/core/c++/error.hpp +++ b/modules/core/c++/error.hpp @@ -270,33 +270,33 @@ private: "Don't use internal private types"); public: - error_or():value_or_error_{make_error<err::invalid_state>("Default assignement for error_or constructor.")}{} - error_or(const fix_void<T> &value) : value_or_error_{value} {} + constexpr error_or():value_or_error_{make_error<err::invalid_state>("Default assignement for error_or constructor.")}{} + constexpr error_or(const fix_void<T> &value) : value_or_error_{value} {} - error_or(fix_void<T> &&value) : value_or_error_{std::move(value)} {} + constexpr error_or(fix_void<T> &&value) : value_or_error_{std::move(value)} {} - error_or(const error &error) : value_or_error_{error} {} - error_or(error &&error) : value_or_error_{std::move(error)} {} + constexpr error_or(const error &error) : value_or_error_{error} {} + constexpr error_or(error &&error) : value_or_error_{std::move(error)} {} - bool is_value() const { + constexpr bool is_value() const { return std::holds_alternative<fix_void<T>>(value_or_error_); } - bool is_error() const { + constexpr bool is_error() const { return std::holds_alternative<class error>(value_or_error_); } - class error &get_error() { + constexpr class error &get_error() { return std::get<class error>(value_or_error_); } - const class error &get_error() const { + constexpr const class error &get_error() const { return std::get<class error>(value_or_error_); } - fix_void<T> &get_value() { return std::get<fix_void<T>>(value_or_error_); } + constexpr fix_void<T> &get_value() { return std::get<fix_void<T>>(value_or_error_); } - const fix_void<T> &get_value() const { + constexpr const fix_void<T> &get_value() const { return std::get<fix_void<T>>(value_or_error_); } }; |