We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 44c5c18 commit fb35a82Copy full SHA for fb35a82
test/data_members.cpp
@@ -21,6 +21,7 @@ struct Y : test_class<1>
21
{
22
Y(int v) : test_class<1>(v) {}
23
Y& operator=(Y const& rhs) { x = rhs.x; return *this; }
24
+ bool q;
25
};
26
27
double get_fair_value(X const& x) { return x.value(); }
@@ -96,6 +97,7 @@ BOOST_PYTHON_MODULE(data_members_ext)
96
97
.def("value", &Y::value)
98
.def("set", &Y::set)
99
.def_readwrite("x", &Y::x)
100
+ .def_readwrite("q", &Y::q)
101
;
102
103
class_<Var>("Var", init<std::string>())
test/data_members.py
@@ -42,6 +42,15 @@
42
>>> v.rw2b.x
43
777
44
>>> Var.rw2b = Y(888)
45
+
46
+>>> y = Y(99)
47
+>>> y.q = True
48
+>>> y.q
49
+True
50
+>>> y.q = False
51
52
+False
53
54
>>> Var.ro2a.x
55
888
56
>>> Var.ro2b.x
0 commit comments