The conversion happens in Allocate() over the whole chunked array, so a slice can't reuse it: convert an empty slice / the slice itself on its own instead. Non-empty slices always go through ConvertSlice() below.
| 1289 | // can't reuse it: convert an empty slice / the slice itself on its own instead. |
| 1290 | // Non-empty slices always go through ConvertSlice() below. |
| 1291 | SEXP AllocateSlice(R_xlen_t n) const { |
| 1292 | if (n != 0) { |
| 1293 | cpp11::stop("Cannot allocate a non-empty slice of an extension array"); |
| 1294 | } |
| 1295 | return Converter::Convert(chunked_array_->Slice(0, 0), false); |
| 1296 | } |
| 1297 | |
| 1298 | SEXP ConvertSlice(const std::shared_ptr<Array>& slice, size_t chunk_index) const { |
| 1299 | return Converter::Convert(slice); |