From 823f796519616c24705ec53d89f0511a65b5d038 Mon Sep 17 00:00:00 2001 From: Patrick Urbanke Date: Wed, 11 Oct 2023 21:49:50 +0200 Subject: [PATCH] Added move constructor for different type to result --- include/rfl/Result.hpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/rfl/Result.hpp b/include/rfl/Result.hpp index 9400e20e..9e84d24f 100644 --- a/include/rfl/Result.hpp +++ b/include/rfl/Result.hpp @@ -45,6 +45,14 @@ class Result { Result(Error&& _err) noexcept : t_or_err_(std::move(_err)) {} + template , + bool>::type = true> + Result(Result&& _other) + : t_or_err_( + std::forward>(_other) + .transform([](U&& _u) { return T(std::forward(_u)); }) + .t_or_err_) {} + template , bool>::type = true> Result(const Result& _other)