mirror of
https://github.com/pybind/pybind11.git
synced 2025-01-19 17:32:37 +00:00
Also add the new ctors to py::array_t
This commit is contained in:
parent
6bb0ee1186
commit
6636ae9d4e
@ -276,8 +276,21 @@ protected:
|
|||||||
template <typename T, int ExtraFlags = array::forcecast> class array_t : public array {
|
template <typename T, int ExtraFlags = array::forcecast> class array_t : public array {
|
||||||
public:
|
public:
|
||||||
PYBIND11_OBJECT_CVT(array_t, array, is_non_null, m_ptr = ensure(m_ptr));
|
PYBIND11_OBJECT_CVT(array_t, array, is_non_null, m_ptr = ensure(m_ptr));
|
||||||
|
|
||||||
array_t() : array() { }
|
array_t() : array() { }
|
||||||
|
|
||||||
array_t(const buffer_info& info) : array(info) { }
|
array_t(const buffer_info& info) : array(info) { }
|
||||||
|
|
||||||
|
array_t(const std::vector<size_t>& shape,
|
||||||
|
T* ptr, const std::vector<size_t>& strides)
|
||||||
|
: array(shape, ptr, strides) { }
|
||||||
|
|
||||||
|
array_t(const std::vector<size_t>& shape, T* ptr)
|
||||||
|
: array(shape, ptr) { }
|
||||||
|
|
||||||
|
array_t(size_t size, T* ptr)
|
||||||
|
: array(size, ptr) { }
|
||||||
|
|
||||||
static bool is_non_null(PyObject *ptr) { return ptr != nullptr; }
|
static bool is_non_null(PyObject *ptr) { return ptr != nullptr; }
|
||||||
static PyObject *ensure(PyObject *ptr) {
|
static PyObject *ensure(PyObject *ptr) {
|
||||||
if (ptr == nullptr)
|
if (ptr == nullptr)
|
||||||
|
Loading…
Reference in New Issue
Block a user