1+ #include " modules.h"
2+
3+ #if PYBIND11_VERSION_MAJOR == 2 && PYBIND11_VERSION_MINOR >= 11
14#include < pybind11/typing.h>
2- #include < pybind11/stl.h >
5+ #endif
36
4- #include " modules.h "
7+ #include < pybind11/stl.h >
58
69#include < demo/sublibA/add.h>
710
@@ -15,7 +18,7 @@ namespace {
1518 };
1619}; // namespace
1720
18- void bind_functions_module (py::module_ &&m) {
21+ void bind_functions_module (py::module &&m) {
1922 m.def (" add" , demo::sublibA::add);
2023 {
2124
@@ -35,6 +38,7 @@ void bind_functions_module(py::module_ &&m) {
3538
3639 m.def (" func_w_anon_args" , [](int x, int y, int z) {});
3740
41+ #if PYBIND11_VERSION_AT_LEAST(2, 6)
3842 m.def (
3943 " func_w_named_pos_args" ,
4044 [](int x, int y, int z) {},
@@ -61,15 +65,19 @@ void bind_functions_module(py::module_ &&m) {
6165 py::arg (" j" ),
6266 py::kw_only (),
6367 py::arg (" k" ));
64-
68+ # endif
6569 m.def (" accept_callable" , [](py::function &callable) { return callable (); });
6670 m.def (" accept_py_object" , [](py::object &object) { return py::str (object); });
6771 m.def (" accept_py_handle" , [](py::handle &handle) { return py::str (handle); });
6872
73+ #if PYBIND11_VERSION_AT_LEAST(2, 12)
6974 m.def (" accept_annotated_callable" ,
7075 [](py::typing::Callable<int (int , int )> &callable) { return callable (13 , 42 ); });
76+ #endif
7177
78+ #if PYBIND11_VERSION_AT_LEAST(2, 10)
7279 m.def (" accept_frozenset" , [](const py::frozenset &) {});
80+ #endif
7381 m.def (" accept_set" , [](const py::set &) {});
7482
7583 m.def (" default_int_arg" , [](int n) {}, py::arg (" n" ) = 5 );
0 commit comments