[
https://issues.apache.org/jira/browse/ARROW-8618?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
ASF GitHub Bot updated ARROW-8618:
----------------------------------
Labels: pull-request-available (was: )
> [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
> Labels: pull-request-available
> Fix For: 2.0.0
>
> Time Spent: 10m
> Remaining Estimate: 0h
>
> 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)