[ox] Cleanup
This commit is contained in:
16
deps/ox/src/ox/std/error.hpp
vendored
16
deps/ox/src/ox/std/error.hpp
vendored
@ -234,6 +234,22 @@ struct [[nodiscard]] Result {
|
||||
return value;
|
||||
}
|
||||
|
||||
template<typename U = T>
|
||||
constexpr ox::Result<U> to() & noexcept {
|
||||
if (error) [[unlikely]] {
|
||||
return error;
|
||||
}
|
||||
return U(value);
|
||||
}
|
||||
|
||||
template<typename U = T>
|
||||
constexpr ox::Result<U> to() && noexcept {
|
||||
if (error) [[unlikely]] {
|
||||
return error;
|
||||
}
|
||||
return U(std::move(value));
|
||||
}
|
||||
|
||||
template<typename U = T>
|
||||
constexpr ox::Result<U> to(auto const&f) & noexcept {
|
||||
if (error) [[unlikely]] {
|
||||
|
Reference in New Issue
Block a user