mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-22 05:05:11 +00:00
convenience function to create a pybind::handle<> to the python version of a C++ type
This commit is contained in:
parent
6918922332
commit
6a32620db3
@ -404,5 +404,13 @@ inline handle get_object_handle(const void *ptr) {
|
|||||||
return it->second;
|
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(detail)
|
||||||
NAMESPACE_END(pybind)
|
NAMESPACE_END(pybind)
|
||||||
|
Loading…
Reference in New Issue
Block a user