Skip to content

Commit

Permalink
Merge pull request #3811 from jbmohler/array_view_ctor
Browse files Browse the repository at this point in the history
copy all array_view members in copy constructor
  • Loading branch information
mdboom committed Nov 18, 2014
2 parents f05182d + bbff731 commit d045fef
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/numpy_cpp.h
Expand Up @@ -367,17 +367,19 @@ class array_view : public detail::array_view_accessors<array_view, T, ND>
}
}

array_view(const array_view &other, bool contiguous = false) : m_arr(NULL), m_data(NULL)
array_view(const array_view &other) : m_arr(NULL), m_data(NULL)
{
if (!set((PyObject *)other.m_arr)) {
throw py::exception();
}
m_arr = other.m_arr;
Py_XINCREF(m_arr);
m_data = other.m_data;
m_shape = other.m_shape;
m_strides = other.m_strides;
}

array_view(PyArrayObject *arr, char *data, npy_intp *shape, npy_intp *strides)
{
m_arr = arr;
Py_INCREF(arr);
Py_XINCREF(arr);
m_data = data;
m_shape = shape;
m_strides = strides;
Expand Down

0 comments on commit d045fef

Please sign in to comment.