| 45 | // Adds a static method to an existing class |
| 46 | template<class T, class Func, class... Extra> |
| 47 | void DefClassStaticMethod(const char *name, Func &&f, const Extra &...extra) |
| 48 | { |
| 49 | py::type class_ = py::type::of<T>(); |
| 50 | |
| 51 | // got from pt::class_<...>::def |
| 52 | py::cpp_function cf(std::forward<Func>(f), py::name(name), py::scope(class_), |
| 53 | py::sibling(py::getattr(class_, name, py::none())), extra...); |
| 54 | class_.attr(cf.name()) = py::staticmethod(cf); |
| 55 | } |
| 56 | |
| 57 | void RegisterCleanup(py::module &m, std::function<void()> fn); |
| 58 |
nothing calls this directly
no outgoing calls
no test coverage detected