@@ -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
@@ -150,6 +153,7 @@ TEST_SUBMODULE(methods_and_attributes, m) {
150
153
py::class_<ExampleMandA> emna (m, " ExampleMandA" );
151
154
emna.def (py::init<>())
152
155
.def (py::init<int >())
156
+ .def (py::init<std::string&&>())
153
157
.def (py::init<const ExampleMandA&>())
154
158
.def (" add1" , &ExampleMandA::add1)
155
159
.def (" add2" , &ExampleMandA::add2)
@@ -161,6 +165,7 @@ TEST_SUBMODULE(methods_and_attributes, m) {
161
165
.def (" add8" , &ExampleMandA::add8)
162
166
.def (" add9" , &ExampleMandA::add9)
163
167
.def (" add10" , &ExampleMandA::add10)
168
+ .def (" consume_str" , &ExampleMandA::consume_str)
164
169
.def (" self1" , &ExampleMandA::self1)
165
170
.def (" self2" , &ExampleMandA::self2)
166
171
.def (" self3" , &ExampleMandA::self3)
0 commit comments