From a89e72929ed047344e221f65542e763e3f6ac3de Mon Sep 17 00:00:00 2001 From: Steven Le Rouzic Date: Fri, 31 Jan 2025 00:30:08 +0100 Subject: Add try macro for status & status_or --- asl/status_or.hpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'asl/status_or.hpp') diff --git a/asl/status_or.hpp b/asl/status_or.hpp index cb65147..ec76e47 100644 --- a/asl/status_or.hpp +++ b/asl/status_or.hpp @@ -127,6 +127,8 @@ public: constexpr string_view message() const { return m_status.message(); } + constexpr status&& throw_status() && { return ASL_MOVE(m_status); } + // @Todo(C++23) Deducing this constexpr const T& value() const& { @@ -160,6 +162,11 @@ public: return ok() ? ASL_MOVE(value()) : static_cast(ASL_FWD(other_value)); } + friend void AslFormat(Formatter& f, const status_or& status) + { + AslFormat(f, status.m_status); + } + template requires hashable friend H AslHashValue(H h, const status_or& s) -- cgit