You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@arrow.apache.org by "Ben Kietzman (Jira)" <ji...@apache.org> on 2020/04/28 17:30:00 UTC

[jira] [Created] (ARROW-8618) [C++] ASSIGN_OR_RAISE should move its argument

Ben Kietzman created ARROW-8618:
-----------------------------------

             Summary: [C++] ASSIGN_OR_RAISE should move its argument
                 Key: ARROW-8618
                 URL: https://issues.apache.org/jira/browse/ARROW-8618
             Project: Apache Arrow
          Issue Type: Improvement
          Components: C++
    Affects Versions: 0.17.0
            Reporter: Ben Kietzman
            Assignee: Ben Kietzman
             Fix For: 1.0.0


Since {{ASSIGN_OR_RAISE}} consumes its {{Result}} argument anyway, there's no reason not to cast that argument to an rvalue reference whenever possible. This will decrease boilerplate when handling non-temporary {{Result}}s, for example when yielding from an iterator:

{code:diff}
 for (auto maybe_batch : scan_task->Execute()) {
-  ASSIGN_OR_RAISE(auto batch, std::move(maybe_batch));
+  ASSIGN_OR_RAISE(auto batch, maybe_batch);
 }
{code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)