@@ -17,14 +17,14 @@ struct atyp { // Short for "any type".
17
17
atyp (atyp &&other) { mtxt = other.mtxt + " _MvCtor" ; }
18
18
};
19
19
20
- struct uconsumer { // unique_ptr consumer
20
+ struct uconsumer { // unique_ptr consumer
21
21
std::unique_ptr<atyp> held;
22
22
bool valid () const { return static_cast <bool >(held); }
23
23
24
24
void pass_valu (std::unique_ptr<atyp> obj) { held = std::move (obj); }
25
25
void pass_rref (std::unique_ptr<atyp> &&obj) { held = std::move (obj); }
26
26
std::unique_ptr<atyp> rtrn_valu () { return std::move (held); }
27
- std::unique_ptr<atyp>& rtrn_lref () { return held; }
27
+ std::unique_ptr<atyp> & rtrn_lref () { return held; }
28
28
const std::unique_ptr<atyp> &rtrn_cref () { return held; }
29
29
};
30
30
@@ -71,7 +71,9 @@ std::string get_mtxt(atyp const &obj) { return obj.mtxt; }
71
71
std::ptrdiff_t get_ptr (atyp const &obj) { return reinterpret_cast <std::ptrdiff_t >(&obj); }
72
72
73
73
std::unique_ptr<atyp> unique_ptr_roundtrip (std::unique_ptr<atyp> obj) { return obj; }
74
- const std::unique_ptr<atyp>& unique_ptr_cref_roundtrip (const std::unique_ptr<atyp>& obj) { return obj; }
74
+ const std::unique_ptr<atyp> &unique_ptr_cref_roundtrip (const std::unique_ptr<atyp> &obj) {
75
+ return obj;
76
+ }
75
77
76
78
struct SharedPtrStash {
77
79
std::vector<std::shared_ptr<const atyp>> stash;
@@ -139,8 +141,8 @@ TEST_SUBMODULE(class_sh_basic, m) {
139
141
140
142
// Helpers for testing.
141
143
// These require selected functions above to work first, as indicated:
142
- m.def (" get_mtxt" , get_mtxt); // pass_cref
143
- m.def (" get_ptr" , get_ptr); // pass_cref
144
+ m.def (" get_mtxt" , get_mtxt); // pass_cref
145
+ m.def (" get_ptr" , get_ptr); // pass_cref
144
146
145
147
m.def (" unique_ptr_roundtrip" , unique_ptr_roundtrip); // pass_uqmp, rtrn_uqmp
146
148
m.def (" unique_ptr_cref_roundtrip" , unique_ptr_cref_roundtrip);
0 commit comments