mirror of
https://github.com/arcan1s/result.git
synced 2025-04-28 01:07:20 +00:00
return result on recover
This commit is contained in:
parent
f1247cd010
commit
b2f6093076
@ -219,9 +219,9 @@ public:
|
|||||||
* otherwise
|
* otherwise
|
||||||
*/
|
*/
|
||||||
template <typename UnaryFunctionError>
|
template <typename UnaryFunctionError>
|
||||||
T recover(UnaryFunctionError apply_error) const
|
Result<T, ErrorEnum> recover(UnaryFunctionError apply_error) const
|
||||||
{
|
{
|
||||||
T val;
|
Result<T, ErrorEnum> val;
|
||||||
match([&val](T value) { val = value; },
|
match([&val](T value) { val = value; },
|
||||||
[&val, &apply_error](Error<ErrorEnum> error) {
|
[&val, &apply_error](Error<ErrorEnum> error) {
|
||||||
val = apply_error(error);
|
val = apply_error(error);
|
||||||
|
Loading…
Reference in New Issue
Block a user