#pragma once #include template pybind11::array_t py_array_from_vector(std::vector&& original_vec) { auto v = new std::vector(std::move(original_vec)); pybind11::capsule cap(v, [](void* p) { delete (std::vector*) p; }); return pybind11::array_t(v->size(), v->data(), cap); }