Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
gaoqiong
pybind11
Commits
f36ec978
Commit
f36ec978
authored
Aug 13, 2016
by
Ivan Smirnov
Browse files
Fix MSVC warnings in numpy example
parent
0d7a015f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
example/example-numpy-dtypes.cpp
example/example-numpy-dtypes.cpp
+4
-4
No files found.
example/example-numpy-dtypes.cpp
View file @
f36ec978
...
...
@@ -91,7 +91,7 @@ py::array_t<S, 0> create_recarray(size_t n) {
auto
req
=
arr
.
request
();
auto
ptr
=
static_cast
<
S
*>
(
req
.
ptr
);
for
(
size_t
i
=
0
;
i
<
n
;
i
++
)
{
ptr
[
i
].
x
=
i
%
2
;
ptr
[
i
].
y
=
(
uint32_t
)
i
;
ptr
[
i
].
z
=
(
float
)
i
*
1.5
f
;
ptr
[
i
].
x
=
i
%
2
!=
0
;
ptr
[
i
].
y
=
(
uint32_t
)
i
;
ptr
[
i
].
z
=
(
float
)
i
*
1.5
f
;
}
return
arr
;
}
...
...
@@ -105,8 +105,8 @@ py::array_t<NestedStruct, 0> create_nested(size_t n) {
auto
req
=
arr
.
request
();
auto
ptr
=
static_cast
<
NestedStruct
*>
(
req
.
ptr
);
for
(
size_t
i
=
0
;
i
<
n
;
i
++
)
{
ptr
[
i
].
a
.
x
=
i
%
2
;
ptr
[
i
].
a
.
y
=
(
uint32_t
)
i
;
ptr
[
i
].
a
.
z
=
(
float
)
i
*
1.5
f
;
ptr
[
i
].
b
.
x
=
(
i
+
1
)
%
2
;
ptr
[
i
].
b
.
y
=
(
uint32_t
)
(
i
+
1
);
ptr
[
i
].
b
.
z
=
(
float
)
(
i
+
1
)
*
1.5
f
;
ptr
[
i
].
a
.
x
=
i
%
2
!=
0
;
ptr
[
i
].
a
.
y
=
(
uint32_t
)
i
;
ptr
[
i
].
a
.
z
=
(
float
)
i
*
1.5
f
;
ptr
[
i
].
b
.
x
=
(
i
+
1
)
%
2
!=
0
;
ptr
[
i
].
b
.
y
=
(
uint32_t
)
(
i
+
1
);
ptr
[
i
].
b
.
z
=
(
float
)
(
i
+
1
)
*
1.5
f
;
}
return
arr
;
}
...
...
@@ -116,7 +116,7 @@ py::array_t<PartialNestedStruct, 0> create_partial_nested(size_t n) {
auto
req
=
arr
.
request
();
auto
ptr
=
static_cast
<
PartialNestedStruct
*>
(
req
.
ptr
);
for
(
size_t
i
=
0
;
i
<
n
;
i
++
)
{
ptr
[
i
].
a
.
x
=
i
%
2
;
ptr
[
i
].
a
.
y
=
(
uint32_t
)
i
;
ptr
[
i
].
a
.
z
=
(
float
)
i
*
1.5
f
;
ptr
[
i
].
a
.
x
=
i
%
2
!=
0
;
ptr
[
i
].
a
.
y
=
(
uint32_t
)
i
;
ptr
[
i
].
a
.
z
=
(
float
)
i
*
1.5
f
;
}
return
arr
;
}
...
...
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