Commit 6a32620d by Wenzel Jakob

convenience function to create a pybind::handle<> to the python version of a C++ type

parent 69189223
......@@ -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)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment