Closed tdegeus closed 3 years ago
Essentially this should be good to go. However, I had to introduce on additional check to check on rank for xtensor. In particular, I want to do this:
xtensor
static auto get(pybind11::handle src) { auto buf = pybind11::array_t<T, pybind11::array::c_style | pybind11::array::forcecast>::ensure(src); if (buf.ndim() != 2) { return false; } return buf; }
however my compiler gets (rightfully) confused:
error: 'auto' in return type deduced as 'pybind11::array_t<int, 17>' here but deduced as 'bool' in earlier return statement return buf; ^
So I worked around with the extra check. I would like to get rid of it. But I don't know what I can return instead of false that allows me to later do
false
if (!buf) { return false; }
Alternatively on could try to get rid of the check statically. But this I don't know how to do easily.
Thanks @JohanMabille ! Good to go.
Essentially this should be good to go. However, I had to introduce on additional check to check on rank for
xtensor
. In particular, I want to do this:however my compiler gets (rightfully) confused:
So I worked around with the extra check. I would like to get rid of it. But I don't know what I can return instead of
false
that allows me to later doAlternatively on could try to get rid of the check statically. But this I don't know how to do easily.