Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
pybind11
Commits
bee8827a
Commit
bee8827a
authored
Feb 14, 2017
by
Sylvain Corlay
Committed by
Wenzel Jakob
Feb 14, 2017
Browse files
Template array constructor (#582)
parent
a76ed42c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
3 deletions
+4
-3
include/pybind11/numpy.h
include/pybind11/numpy.h
+4
-3
No files found.
include/pybind11/numpy.h
View file @
bee8827a
...
...
@@ -337,8 +337,9 @@ public:
array
()
:
array
(
0
,
static_cast
<
const
double
*>
(
nullptr
))
{}
array
(
const
pybind11
::
dtype
&
dt
,
const
std
::
vector
<
size_t
>
&
shape
,
const
std
::
vector
<
size_t
>
&
strides
,
const
void
*
ptr
=
nullptr
,
template
<
typename
Shape
,
typename
Strides
>
array
(
const
pybind11
::
dtype
&
dt
,
const
Shape
&
shape
,
const
Strides
&
strides
,
const
void
*
ptr
=
nullptr
,
handle
base
=
handle
())
{
auto
&
api
=
detail
::
npy_api
::
get
();
auto
ndim
=
shape
.
size
();
...
...
@@ -536,7 +537,7 @@ protected:
throw
std
::
runtime_error
(
"array is not writeable"
);
}
static
std
::
vector
<
size_t
>
default_strides
(
const
std
::
vector
<
size_t
>
&
shape
,
size_t
itemsize
)
{
template
<
typename
Shape
>
static
std
::
vector
<
size_t
>
default_strides
(
const
Shape
&
shape
,
size_t
itemsize
)
{
auto
ndim
=
shape
.
size
();
std
::
vector
<
size_t
>
strides
(
ndim
);
if
(
ndim
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment