return result on recover

This commit is contained in:
Evgenii Alekseev 2018-12-12 02:20:39 +03:00
parent f1247cd010
commit b2f6093076

View File

@ -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);