Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
pybind11
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open
pybind11
Commits
5412a05c
Commit
5412a05c
authored
Jul 02, 2016
by
Ivan Smirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename PYBIND11_DTYPE to PYBIND11_NUMPY_DTYPE
parent
5afe9df3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
7 deletions
+7
-7
docs/advanced.rst
+3
-3
example/example20.cpp
+3
-3
include/pybind11/numpy.h
+1
-1
No files found.
docs/advanced.rst
View file @
5412a05c
...
@@ -1362,7 +1362,7 @@ NumPy structured types
...
@@ -1362,7 +1362,7 @@ NumPy structured types
======================
======================
In order for ``py::array_t`` to work with structured (record) types, we first need
In order for ``py::array_t`` to work with structured (record) types, we first need
to register the memory layout of the type. This can be done via ``PYBIND11_DTYPE``
to register the memory layout of the type. This can be done via ``PYBIND11_
NUMPY_
DTYPE``
macro which expects the type followed by field names:
macro which expects the type followed by field names:
.. code-block:: cpp
.. code-block:: cpp
...
@@ -1377,8 +1377,8 @@ macro which expects the type followed by field names:
...
@@ -1377,8 +1377,8 @@ macro which expects the type followed by field names:
A a;
A a;
};
};
PYBIND11_DTYPE(A, x, y);
PYBIND11_
NUMPY_
DTYPE(A, x, y);
PYBIND11_DTYPE(B, z, a);
PYBIND11_
NUMPY_
DTYPE(B, z, a);
/* now both A and B can be used as template arguments to py::array_t */
/* now both A and B can be used as template arguments to py::array_t */
...
...
example/example20.cpp
View file @
5412a05c
...
@@ -101,9 +101,9 @@ void print_dtypes() {
...
@@ -101,9 +101,9 @@ void print_dtypes() {
}
}
void
init_ex20
(
py
::
module
&
m
)
{
void
init_ex20
(
py
::
module
&
m
)
{
PYBIND11_DTYPE
(
SimpleStruct
,
x
,
y
,
z
);
PYBIND11_
NUMPY_
DTYPE
(
SimpleStruct
,
x
,
y
,
z
);
PYBIND11_DTYPE
(
PackedStruct
,
x
,
y
,
z
);
PYBIND11_
NUMPY_
DTYPE
(
PackedStruct
,
x
,
y
,
z
);
PYBIND11_DTYPE
(
NestedStruct
,
a
,
b
);
PYBIND11_
NUMPY_
DTYPE
(
NestedStruct
,
a
,
b
);
m
.
def
(
"create_rec_simple"
,
&
create_recarray
<
SimpleStruct
>
);
m
.
def
(
"create_rec_simple"
,
&
create_recarray
<
SimpleStruct
>
);
m
.
def
(
"create_rec_packed"
,
&
create_recarray
<
PackedStruct
>
);
m
.
def
(
"create_rec_packed"
,
&
create_recarray
<
PackedStruct
>
);
...
...
include/pybind11/numpy.h
View file @
5412a05c
...
@@ -327,7 +327,7 @@ private:
...
@@ -327,7 +327,7 @@ private:
#define PYBIND11_MAP_LIST(f, t, ...) \
#define PYBIND11_MAP_LIST(f, t, ...) \
PYBIND11_EVAL (PYBIND11_MAP_LIST1 (f, t, __VA_ARGS__, (), 0))
PYBIND11_EVAL (PYBIND11_MAP_LIST1 (f, t, __VA_ARGS__, (), 0))
#define PYBIND11_DTYPE(Type, ...) \
#define PYBIND11_
NUMPY_
DTYPE(Type, ...) \
::pybind11::detail::npy_format_descriptor<Type>::register_dtype \
::pybind11::detail::npy_format_descriptor<Type>::register_dtype \
({PYBIND11_MAP_LIST (PYBIND11_FIELD_DESCRIPTOR, Type, __VA_ARGS__)})
({PYBIND11_MAP_LIST (PYBIND11_FIELD_DESCRIPTOR, Type, __VA_ARGS__)})
...
...
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