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
6a32620d
Commit
6a32620d
authored
Oct 02, 2015
by
Wenzel Jakob
Browse files
convenience function to create a pybind::handle<> to the python version of a C++ type
parent
69189223
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
0 deletions
+8
-0
include/pybind/pytypes.h
include/pybind/pytypes.h
+8
-0
No files found.
include/pybind/pytypes.h
View file @
6a32620d
...
...
@@ -404,5 +404,13 @@ inline handle get_object_handle(const void *ptr) {
return
it
->
second
;
}
inline
handle
get_type_handle
(
const
std
::
type_info
&
tp
)
{
auto
instances
=
get_internals
().
registered_types
;
auto
it
=
instances
.
find
(
&
tp
);
if
(
it
==
instances
.
end
())
return
handle
();
return
handle
((
PyObject
*
)
it
->
second
.
type
);
}
NAMESPACE_END
(
detail
)
NAMESPACE_END
(
pybind
)
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