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
ea2755cc
Commit
ea2755cc
authored
Jun 19, 2016
by
Ivan Smirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use a macro for numpy API definitions
parent
f7143dc5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
5 deletions
+7
-5
include/pybind11/numpy.h
+7
-5
No files found.
include/pybind11/numpy.h
View file @
ea2755cc
...
...
@@ -55,11 +55,13 @@ public:
void
**
api_ptr
=
(
void
**
)
(
c
?
PyCObject_AsVoidPtr
(
c
.
ptr
())
:
nullptr
);
#endif
API
api
;
api
.
PyArray_Type_
=
(
decltype
(
api
.
PyArray_Type_
))
api_ptr
[
API_PyArray_Type
];
api
.
PyArray_DescrFromType_
=
(
decltype
(
api
.
PyArray_DescrFromType_
))
api_ptr
[
API_PyArray_DescrFromType
];
api
.
PyArray_FromAny_
=
(
decltype
(
api
.
PyArray_FromAny_
))
api_ptr
[
API_PyArray_FromAny
];
api
.
PyArray_NewCopy_
=
(
decltype
(
api
.
PyArray_NewCopy_
))
api_ptr
[
API_PyArray_NewCopy
];
api
.
PyArray_NewFromDescr_
=
(
decltype
(
api
.
PyArray_NewFromDescr_
))
api_ptr
[
API_PyArray_NewFromDescr
];
#define DECL_NPY_API(Func) api.Func##_ = (decltype(api.Func##_)) api_ptr[API_##Func];
DECL_NPY_API
(
PyArray_Type
);
DECL_NPY_API
(
PyArray_DescrFromType
);
DECL_NPY_API
(
PyArray_FromAny
);
DECL_NPY_API
(
PyArray_NewCopy
);
DECL_NPY_API
(
PyArray_NewFromDescr
);
#undef DECL_NPY_API
return
api
;
}
...
...
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