Ben Kietzman created ARROW-7086:

             Summary: [C++] Provide a wrapper for invoking factories to produce 
a Result
                 Key: ARROW-7086
             Project: Apache Arrow
          Issue Type: Improvement
          Components: C++
    Affects Versions: 0.15.1
            Reporter: Ben Kietzman
            Assignee: Ben Kietzman
             Fix For: 1.0.0

There is a proliferation of code like:

Result<int> SafeAdd(int a, int b) {
  int out;
  RETURN_NOT_OK(DoSafeAdd(a, b, &out));
  return out;

Ideally, this should be resolved by moving the implementation of SafeAdd into 
the Result returning function 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 ResultInvoke(DoSafeAdd, a, b);

This message was sent by Atlassian Jira

Reply via email to