28 m.def(
"local_value", [](
LocalType &l) {
return l.
i; });
33 bind_local<NonLocalType, 0>(
m,
"NonLocalType")
43 m.def(
"register_local_external", [
m]() {
44 auto main = py::module_::import(
"pybind11_tests");
46 bind_local<LocalExternal, 7>(
m,
"LocalExternal", py::module_local());
48 else throw std::runtime_error(
"test_class not enabled");
53 py::bind_vector<LocalVec>(
m,
"LocalVec");
54 py::bind_map<LocalMap>(
m,
"LocalMap");
56 py::bind_vector<NonLocalVec>(
m,
"NonLocalVec");
57 py::bind_map<NonLocalMap>(
m,
"NonLocalMap");
61 bind_local<NonLocal2, 10>(
m,
"NonLocal2");
62 py::bind_vector<LocalVec2>(
m,
"LocalVec2", py::module_local());
63 py::bind_map<NonLocalMap2>(
m,
"NonLocalMap2", py::module_local(
false));
68 m.def(
"register_mixed_global", [
m]() {
69 bind_local<MixedGlobalLocal, 100>(
m,
"MixedGlobalLocal", py::module_local(
false));
71 m.def(
"register_mixed_local", [
m]() {
72 bind_local<MixedLocalGlobal, 1000>(
m,
"MixedLocalGlobal", py::module_local());
81 m.def(
"load_vector_via_caster", [](std::vector<int> v) {
82 return std::accumulate(v.begin(), v.end(), 0);
86 m.def(
"return_self", [](
LocalVec *v) {
return v; });
90 py::class_<pets::Pet>(
m,
"Pet", py::module_local())
93 py::class_<Cat, pets::Pet>(
m,
"Cat")
94 .def(py::init<std::string>());
97 py::class_<MixGL>(
m,
"MixGL").def(py::init<int>());
98 m.def(
"get_gl_value", [](
MixGL &o) {
return o.
i + 10; });
100 py::class_<MixGL2>(
m,
"MixGL2").def(py::init<int>());