From b3206b138f660dd0df817ee31d61f055d713c49b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Thu, 25 Jul 2019 20:44:32 +0200 Subject: [PATCH] python/corrade: implicit conversion of np.array to (Strided)ArrayView. --- src/python/corrade/containers.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/python/corrade/containers.cpp b/src/python/corrade/containers.cpp index 4967c64..0048184 100644 --- a/src/python/corrade/containers.cpp +++ b/src/python/corrade/containers.cpp @@ -99,6 +99,8 @@ template bool arrayViewBufferProtocol(T& self, Py_buffer& buffer, int f template void arrayView(py::class_>& c) { /* Implicitly convertible from a buffer */ py::implicitly_convertible>(); + /* This is needed for implicit conversion from np.array */ + py::implicitly_convertible>(); c /* Constructor */ @@ -296,6 +298,11 @@ inline std::size_t largerStride(std::size_t a, std::size_t b) { } template void stridedArrayView(py::class_>& c) { + /* Implicitly convertible from a buffer */ + py::implicitly_convertible>(); + /* This is needed for implicit conversion from np.array */ + py::implicitly_convertible>(); + c /* Constructor */ .def(py::init(), "Default constructor")