【发布时间】:2022-12-27 12:41:38
【问题描述】:
I wish to pass a Python numpy array to this C++ function:
int data(std::span<int> x) { return x.size(); }
Is it possible to write a custom type caster for pybind11 that supports this signature?
pybind already has good support for vector<int>, but I would like to add support for a zero-copy version of vector, i.e. pass by reference.
It looks like there are some clues on how to do this here.
【问题讨论】: