3#include <arrow/buffer.h>
17 "Buffer::FromVector can only wrap vectors of trivial objects"
21 return std::make_shared<arrow::Buffer>(
nullptr, 0);
24 auto* data =
reinterpret_cast<uint8_t*
>(vec.data());
25 auto size_in_bytes =
static_cast<int64_t
>(vec.size() *
sizeof(T));
26 return std::shared_ptr<arrow::Buffer>{
27 new arrow::Buffer{data, size_in_bytes},
29 [vec = std::move(vec)](arrow::Buffer* buffer) {
delete buffer; }};
All Rerun C++ types and functions are in the rerun namespace or one of its nested namespaces.
Definition rerun.hpp:22
std::shared_ptr< arrow::Buffer > arrow_buffer_from_vector(std::vector< T > vec)
Creates an arrow buffer from a vector without allocating new memory.
Definition arrow_utils.hpp:14