Uploaded image for project: 'Apache Arrow'
  1. Apache Arrow
  2. ARROW-8618

[C++] ASSIGN_OR_RAISE should move its argument

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 0.17.0
    • 2.0.0
    • C++

    Description

      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:

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

      Attachments

        Issue Links

          Activity

            People

              bkietz Ben Kietzman
              bkietz Ben Kietzman
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 1.5h
                  1.5h