diff options
author | Steven Le Rouzic <steven.lerouzic@gmail.com> | 2025-01-05 18:53:16 +0100 |
---|---|---|
committer | Steven Le Rouzic <steven.lerouzic@gmail.com> | 2025-01-05 18:53:16 +0100 |
commit | e65fe1b93684f9517599be695eb40aa4537fc6c7 (patch) | |
tree | 7b3c429e20574c9c0a66d1302a978d1b39379397 /asl/status.hpp | |
parent | 11894bef04095c37196af5ae1bfed885775d49eb (diff) |
Add status_or
Diffstat (limited to 'asl/status.hpp')
-rw-r--r-- | asl/status.hpp | 5 |
1 files changed, 3 insertions, 2 deletions
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; } |