Result: Add try_set_value_with_specific_error()
This commit is contained in:
parent
b01878cd3c
commit
730d0682ee
@ -90,6 +90,13 @@ template <typename T> class Result
|
||||
return m_value.try_set_value(ref);
|
||||
}
|
||||
|
||||
Result<bool> try_set_value_with_specific_error(T& ref, int error)
|
||||
{
|
||||
if (has_error() && m_error != error) return release_error();
|
||||
|
||||
return m_value.try_set_value(ref);
|
||||
}
|
||||
|
||||
T release_value()
|
||||
{
|
||||
expect(has_value(), "Result::release_value() called on a Result that holds an error");
|
||||
|
Loading…
Reference in New Issue
Block a user