From b55dd0e6968b51090daf18722a0d2d74e7fe87f5 Mon Sep 17 00:00:00 2001 From: Weston Pace Date: Thu, 12 Jan 2023 17:51:50 -0800 Subject: [PATCH] GH-33643: [C++] Remove implicit = capture of this which is not valid in c++20 (#33644) * Closes: #33643 Authored-by: Weston Pace Signed-off-by: Weston Pace --- cpp/src/arrow/compute/exec/source_node.cc | 34 ++++++++++++----------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/cpp/src/arrow/compute/exec/source_node.cc b/cpp/src/arrow/compute/exec/source_node.cc index 9a96ddf285360..76c222f5b762a 100644 --- a/cpp/src/arrow/compute/exec/source_node.cc +++ b/cpp/src/arrow/compute/exec/source_node.cc @@ -136,22 +136,24 @@ struct SourceNode : ExecNode { bit_util::CeilDiv(morsel_length, ExecPlan::kMaxBatchSize)); batch_count_ += num_batches; } - RETURN_NOT_OK(plan_->query_context()->ScheduleTask([=]() { - int64_t offset = 0; - do { - int64_t batch_size = std::min( - morsel_length - offset, ExecPlan::kMaxBatchSize); - // In order for the legacy batching model to work we must - // not slice batches from the source - if (use_legacy_batching) { - batch_size = morsel_length; - } - ExecBatch batch = morsel.Slice(offset, batch_size); - offset += batch_size; - outputs_[0]->InputReceived(this, std::move(batch)); - } while (offset < morsel.length); - return Status::OK(); - })); + RETURN_NOT_OK(plan_->query_context()->ScheduleTask( + [this, morsel = std::move(morsel), morsel_length, + use_legacy_batching]() { + int64_t offset = 0; + do { + int64_t batch_size = std::min( + morsel_length - offset, ExecPlan::kMaxBatchSize); + // In order for the legacy batching model to work we must + // not slice batches from the source + if (use_legacy_batching) { + batch_size = morsel_length; + } + ExecBatch batch = morsel.Slice(offset, batch_size); + offset += batch_size; + outputs_[0]->InputReceived(this, std::move(batch)); + } while (offset < morsel.length); + return Status::OK(); + })); lock.lock(); if (!backpressure_future_.is_finished()) { EVENT(span_, "Source paused due to backpressure");