Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Won't Fix
-
0.15.1
-
None
Description
There is a proliferation of code like:
Result<int> SafeAdd(int a, int b) { int out; RETURN_NOT_OK(SafeAdd(a, b, &out)); return out; }
Ideally, this should be resolved by moving the implementation of SafeAdd into the Result returning overload then using Result::Value in the Status returning function. In cases where this is inconvenient, it'd be helpful to have an adapter for doing this more efficiently:
Result<int> SafeAdd(int a, int b) { return RESULT_INVOKE(SafeAdd, a, b); }
This will probably have to be a macro; otherwise the return type can be inferred but only when the function is not overloaded