MCPcopy Create free account
hub / github.com/pybind/pybind11 / bind_local

Function bind_local

tests/local_bindings.h:70–74  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

68// Simple bindings (used with the above):
69template <typename T, int Adjust = 0, typename Holder = std::unique_ptr<T>, typename... Args>
70py::class_<T, Holder> bind_local(Args &&...args) {
71 return py::class_<T, Holder>(std::forward<Args>(args)...)
72 .def(py::init<int>())
73 .def("get", [](T &i) { return i.i + Adjust; });
74}
75
76// Simulate a foreign library base class (to match the example in the docs):
77namespace pets {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected