@@ -21,6 +21,7 @@ class ExampleMandA {
21
21
ExampleMandA () { print_default_created (this ); }
22
22
ExampleMandA (int value) : value(value) { print_created (this , value); }
23
23
ExampleMandA (const ExampleMandA &e) : value(e.value) { print_copy_created (this ); }
24
+ ExampleMandA (std::string&&) {}
24
25
ExampleMandA (ExampleMandA &&e) : value(e.value) { print_move_created (this ); }
25
26
~ExampleMandA () { print_destroyed (this ); }
26
27
@@ -43,6 +44,8 @@ class ExampleMandA {
43
44
void add9 (int *other) { value += *other; } // passing by pointer
44
45
void add10 (const int *other) { value += *other; } // passing by const pointer
45
46
47
+ void consume_str (std::string&&) {}
48
+
46
49
ExampleMandA self1 () { return *this ; } // return by value
47
50
ExampleMandA &self2 () { return *this ; } // return by reference
48
51
const ExampleMandA &self3 () { return *this ; } // return by const reference
@@ -212,6 +215,7 @@ TEST_SUBMODULE(methods_and_attributes, m) {
212
215
py::class_<ExampleMandA> emna (m, " ExampleMandA" );
213
216
emna.def (py::init<>())
214
217
.def (py::init<int >())
218
+ .def (py::init<std::string&&>())
215
219
.def (py::init<const ExampleMandA&>())
216
220
.def (" add1" , &ExampleMandA::add1)
217
221
.def (" add2" , &ExampleMandA::add2)
@@ -223,6 +227,7 @@ TEST_SUBMODULE(methods_and_attributes, m) {
223
227
.def (" add8" , &ExampleMandA::add8)
224
228
.def (" add9" , &ExampleMandA::add9)
225
229
.def (" add10" , &ExampleMandA::add10)
230
+ .def (" consume_str" , &ExampleMandA::consume_str)
226
231
.def (" self1" , &ExampleMandA::self1)
227
232
.def (" self2" , &ExampleMandA::self2)
228
233
.def (" self3" , &ExampleMandA::self3)
0 commit comments