MCPcopy Create free account
hub / github.com/CVCUDA/CV-CUDA / DefClassStaticMethod

Function DefClassStaticMethod

python/common/PyUtil.hpp:47–55  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45// Adds a static method to an existing class
46template<class T, class Func, class... Extra>
47void 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
57void RegisterCleanup(py::module &m, std::function<void()> fn);
58

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected