arrow-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Caleb Epstein <caleb.epst...@gmail.com>
Subject Row-Wise Tutorial: UB?
Date Tue, 09 Oct 2018 00:07:13 GMT
Re: https://arrow.apache.org/docs/cpp/md_tutorials_row_wise_conversion.html

The example code suggests you do the following (eliding some lines for
brevity):

std::unique_ptr<DoubleBuilder> components_values_builder(new
DoubleBuilder(pool));
ListBuilder components_builder(pool, std::move(components_values_builder));

But then:

for (const data_row& row : rows) {
[...]
ARROW_RETURN_NOT_OK(components_values_builder->Append(
row.cost_components.data(), row.cost_components.size(),
nullptr);
}



Given that components_values_builder has been moved-from above, won't this
be UB, likely crashing your app? Is there a more correct way to write this?

Mime
View raw message