Lines Matching refs:def

55     m.def("cast_vector", []() { return std::vector<int>{1}; });
56 m.def("load_vector", [](const std::vector<int> &v) { return v.at(0) == 1 && v.at(1) == 2; });
58 m.def("cast_bool_vector", []() { return std::vector<bool>{true, false}; });
59 m.def("load_bool_vector", [](const std::vector<bool> &v) {
64 m.def("cast_ptr_vector", []() { return &lvv; });
67 m.def("cast_deque", []() { return std::deque<int>{1}; });
68 m.def("load_deque", [](const std::deque<int> &v) { return v.at(0) == 1 && v.at(1) == 2; });
71 m.def("cast_array", []() { return std::array<int, 2> {{1 , 2}}; });
72 m.def("load_array", [](const std::array<int, 2> &a) { return a[0] == 1 && a[1] == 2; });
75 m.def("cast_valarray", []() { return std::valarray<int>{1, 4, 9}; });
76 m.def("load_valarray", [](const std::valarray<int>& v) {
81 m.def("cast_map", []() { return std::map<std::string, std::string>{{"key", "value"}}; });
82 m.def("load_map", [](const std::map<std::string, std::string> &map) {
87 m.def("cast_set", []() { return std::set<std::string>{"key1", "key2"}; });
88 m.def("load_set", [](const std::set<std::string> &set) {
93 m.def("cast_rv_vector", []() { return std::vector<RValueCaster>{2}; });
94 m.def("cast_rv_array", []() { return std::array<RValueCaster, 3>(); });
98 m.def("cast_rv_map", []() { return std::unordered_map<std::string, RValueCaster>{{"a", RValueCaster{}}}; });
99 m.def("cast_rv_nested", []() {
119 m.def("cast_lv_vector", []() -> const decltype(lvv) & { return lvv; });
120 m.def("cast_lv_array", []() -> const decltype(lva) & { return lva; });
121 m.def("cast_lv_map", []() -> const decltype(lvm) & { return lvm; });
122 m.def("cast_lv_nested", []() -> const decltype(lvn) & { return lvn; });
124 m.def("cast_unique_ptr_vector", []() {
139 .def(py::init<>())
154 .def(py::init<>())
155 .def(py::init<int>());
163 m.def("double_or_zero", [](const opt_int& x) -> int {
166 m.def("half_or_none", [](int x) -> opt_int {
169 m.def("test_nullopt", [](opt_int x) {
172 m.def("test_no_assign", [](const opt_no_assign &x) {
176 m.def("nodefer_none_optional", [](std::optional<int>) { return true; });
177 m.def("nodefer_none_optional", [](py::none) { return false; });
186 m.def("double_or_zero_exp", [](const exp_opt_int& x) -> int {
189 m.def("half_or_none_exp", [](int x) -> exp_opt_int {
192 m.def("test_nullopt_exp", [](exp_opt_int x) {
195 m.def("test_no_assign_exp", [](const exp_opt_no_assign &x) {
214 m.def("load_variant", [](variant<int, std::string, double, std::nullptr_t> v) {
217 m.def("load_variant_2pass", [](variant<double, int> v) {
220 m.def("cast_variant", []() {
228 m.def("tpl_ctor_vector", [](std::vector<TplCtorClass> &) {});
229 m.def("tpl_ctor_map", [](std::unordered_map<TplCtorClass, TplCtorClass> &) {});
230 m.def("tpl_ctor_set", [](std::unordered_set<TplCtorClass> &) {});
232 m.def("tpl_constr_optional", [](std::optional<TplCtorClass> &) {});
234 m.def("tpl_constr_optional", [](std::experimental::optional<TplCtorClass> &) {});
239 m.def("return_vec_of_reference_wrapper", [](std::reference_wrapper<UserType> p4) {
247 m.def("stl_pass_by_pointer", [](std::vector<int>* v) { return *v; }, "v"_a=nullptr);
250 m.def("func_with_string_or_vector_string_arg_overload", [](std::vector<std::string>) { return 1; });
251 m.def("func_with_string_or_vector_string_arg_overload", [](std::list<std::string>) { return 2; });
252 m.def("func_with_string_or_vector_string_arg_overload", [](std::string) { return 3; });
263 m.def("test_stl_ownership",
271 m.def("array_cast_sequence", [](std::array<int, 3> x) { return x; });
278 .def(py::init<std::string>())
282 .def(py::init<>())