@@ -889,19 +889,32 @@ class Table {
889889 future<bool >>::value,
890890 " RowFunctor should return a future<bool>." );
891891
892+ auto on_row_ptr = std::make_shared<RowFunctor>(std::move (on_row));
893+ // NOLINTNEXTLINE(performance-unnecessary-value-param)
894+ auto on_row_fn = [on_row_ptr](Row row) {
895+ return (*on_row_ptr)(std::move (row));
896+ };
897+
898+ auto on_finish_ptr = std::make_shared<FinishFunctor>(std::move (on_finish));
899+ // NOLINTNEXTLINE(performance-unnecessary-value-param)
900+ auto on_finish_fn = [on_finish_ptr](Status status) {
901+ return (*on_finish_ptr)(std::move (status));
902+ };
903+
892904 if (connection_) {
893905 google::cloud::internal::OptionsSpan span (options_);
894- connection_->AsyncReadRows (
895- app_profile_id_, table_name_, std::move (on_row), std::move (on_finish),
896- std::move (row_set), rows_limit, std::move (filter));
906+ connection_->AsyncReadRows (app_profile_id_, table_name_,
907+ std::move (on_row_fn), std::move (on_finish_fn),
908+ std::move (row_set), rows_limit,
909+ std::move (filter));
897910 return ;
898911 }
899912
900913 bigtable_internal::LegacyAsyncRowReader::Create (
901914 background_threads_->cq (), client_, app_profile_id_, table_name_,
902- std::move (on_row ), std::move (on_finish ), std::move (row_set), rows_limit ,
903- std::move (filter), clone_rpc_retry_policy (), clone_rpc_backoff_policy (),
904- metadata_update_policy_,
915+ std::move (on_row_fn ), std::move (on_finish_fn ), std::move (row_set),
916+ rows_limit, std::move (filter), clone_rpc_retry_policy (),
917+ clone_rpc_backoff_policy (), metadata_update_policy_,
905918 absl::make_unique<bigtable::internal::ReadRowsParserFactory>());
906919 }
907920
0 commit comments