[ox/std] Make Result copyTo and moveTo able to convert
This commit is contained in:
parent
66a559d48e
commit
2e585beb87
9
deps/nostalgia/deps/ox/src/ox/std/error.hpp
vendored
9
deps/nostalgia/deps/ox/src/ox/std/error.hpp
vendored
@ -165,21 +165,24 @@ struct [[nodiscard]] Result {
|
||||
return error == 0;
|
||||
}
|
||||
|
||||
constexpr Error copyTo(type &val) const& noexcept {
|
||||
template<typename U>
|
||||
constexpr Error copyTo(U &val) const& noexcept {
|
||||
if (!error) [[likely]] {
|
||||
val = value;
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
||||
constexpr Error copyTo(type &val) && noexcept {
|
||||
template<typename U>
|
||||
constexpr Error copyTo(U &val) && noexcept {
|
||||
if (!error) [[likely]] {
|
||||
val = std::move(value);
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
||||
constexpr Error moveTo(type &val) noexcept {
|
||||
template<typename U>
|
||||
constexpr Error moveTo(U &val) noexcept {
|
||||
if (!error) [[likely]] {
|
||||
val = std::move(value);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user