void addArrayAccessor2Scalar(py::module m, const char* name) { py::class_<ArrayAccessor2<T>>(m, name, py::buffer_protocol()) .def_buffer([](ArrayAccessor2<T>& m) -> py::buffer_info { return py::buffer_info(m.data(), sizeof(T), py::format_descriptor<T>::format(), 2, {m.height(), m.width()}, {sizeof(T) * m.width(), sizeof(T)}); }); };
void addArrayAccessor1Vector(py::module m, const char* name) { py::class_<ArrayAccessor1<Vector<T, N>>>(m, name, py::buffer_protocol()) .def_buffer([](ArrayAccessor1<Vector<T, N>>& m) -> py::buffer_info { return py::buffer_info(m.data(), sizeof(T), py::format_descriptor<T>::format(), 2, {m.size(), N}, {sizeof(T) * N, sizeof(T)}); }); };