You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@arrow.apache.org by "Wes McKinney (Jira)" <ji...@apache.org> on 2020/06/15 16:47:00 UTC

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

     [ https://issues.apache.org/jira/browse/ARROW-8618?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Wes McKinney updated ARROW-8618:
--------------------------------
    Fix Version/s:     (was: 1.0.0)
                   2.0.0

> [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
>            Priority: Major
>             Fix For: 2.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}
>  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)