mirror of
https://github.com/pybind/pybind11.git
synced 2026-03-14 20:27:47 +00:00
Improve py::array_t scalar type information (#724)
* Add value_type member alias to py::array_t (resolve #632) * Use numpy scalar name in py::array_t function signatures (e.g. float32/64 instead of just float)
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
|
||||
using arr = py::array;
|
||||
using arr_t = py::array_t<uint16_t, 0>;
|
||||
static_assert(std::is_same<arr_t::value_type, uint16_t>::value, "");
|
||||
|
||||
template<typename... Ix> arr data(const arr& a, Ix... index) {
|
||||
return arr(a.nbytes() - a.offset_at(index...), (const uint8_t *) a.data(index...));
|
||||
|
||||
Reference in New Issue
Block a user