From e65fe1b93684f9517599be695eb40aa4537fc6c7 Mon Sep 17 00:00:00 2001 From: Steven Le Rouzic Date: Sun, 5 Jan 2025 18:53:16 +0100 Subject: Add status_or --- asl/status.hpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'asl/status.hpp') diff --git a/asl/status.hpp b/asl/status.hpp index 0d1175e..aa64e4e 100644 --- a/asl/status.hpp +++ b/asl/status.hpp @@ -75,7 +75,7 @@ public: } constexpr status(status&& other) - : m_payload{exchange(other.m_payload, nullptr)} + : m_payload{exchange(other.m_payload, status_to_payload(other.code()))} {} constexpr status& operator=(const status& other) @@ -93,7 +93,8 @@ public: { if (&other != this) { - swap(m_payload, other.m_payload); + if (!is_inline()) { unref(); } + m_payload = exchange(other.m_payload, status_to_payload(other.code())); } return *this; } -- cgit