ndarray from_data_impl(void * data, dtype const & dt, Container shape, Container strides, python::object const & owner, bool writeable, typename boost::enable_if< boost::is_integral<typename Container::value_type> >::type * enabled = NULL) { std::vector<Py_intptr_t> shape_(shape.begin(),shape.end()); std::vector<Py_intptr_t> strides_(strides.begin(), strides.end()); return from_data_impl(data, dt, shape_, strides_, owner, writeable); }
ndarray from_data_impl(void * data, dtype const & dt, python::object const & shape, python::object const & strides, python::object const & owner, bool writeable) { std::vector<Py_intptr_t> shape_(len(shape)); std::vector<Py_intptr_t> strides_(len(strides)); if (shape_.size() != strides_.size()) { PyErr_SetString(PyExc_ValueError, "Length of shape and strides arrays do not match."); python::throw_error_already_set(); } for (std::size_t i = 0; i < shape_.size(); ++i) { shape_[i] = python::extract<Py_intptr_t>(shape[i]); strides_[i] = python::extract<Py_intptr_t>(strides[i]); } return from_data_impl(data, dt, shape_, strides_, owner, writeable); }