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:
Dean Moldovan
2017-03-13 19:17:18 +01:00
committed by GitHub
parent dc5ce5930f
commit 16afbcef46
4 changed files with 25 additions and 5 deletions

View File

@@ -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...));