From 78e8f39651ace3f262d4fc58c7a120504d19c721 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Sat, 7 Sep 2024 02:24:52 -0500 Subject: [PATCH] [ox/std] Make Result copyTo and moveTo able to convert (synced from c45efa60198398190d39f2f03b50e09ecf78f6a2) --- src/ox/std/error.hpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/ox/std/error.hpp b/src/ox/std/error.hpp index 6018971d0..45d217ea1 100644 --- a/src/ox/std/error.hpp +++ b/src/ox/std/error.hpp @@ -165,21 +165,24 @@ struct [[nodiscard]] Result { return error == 0; } - constexpr Error copyTo(type &val) const& noexcept { + template + constexpr Error copyTo(U &val) const& noexcept { if (!error) [[likely]] { val = value; } return error; } - constexpr Error copyTo(type &val) && noexcept { + template + constexpr Error copyTo(U &val) && noexcept { if (!error) [[likely]] { val = std::move(value); } return error; } - constexpr Error moveTo(type &val) noexcept { + template + constexpr Error moveTo(U &val) noexcept { if (!error) [[likely]] { val = std::move(value); }