Lines Matching defs:value

2     tests/test_copy_move_policies.cpp -- 'copy' and 'move' return value policies
40 MoveOnlyInt(int v) : value{std::move(v)} { print_created(this, value); }
41 MoveOnlyInt(MoveOnlyInt &&m) { print_move_created(this, m.value); std::swap(value, m.value); }
42 MoveOnlyInt &operator=(MoveOnlyInt &&m) { print_move_assigned(this, m.value); std::swap(value, m.value); return *this; }
47 int value;
52 MoveOrCopyInt(int v) : value{std::move(v)} { print_created(this, value); }
53 MoveOrCopyInt(MoveOrCopyInt &&m) { print_move_created(this, m.value); std::swap(value, m.value); }
54 MoveOrCopyInt &operator=(MoveOrCopyInt &&m) { print_move_assigned(this, m.value); std::swap(value, m.value); return *this; }
55 MoveOrCopyInt(const MoveOrCopyInt &c) { print_copy_created(this, c.value); value = c.value; }
56 MoveOrCopyInt &operator=(const MoveOrCopyInt &c) { print_copy_assigned(this, c.value); value = c.value; return *this; }
59 int value;
64 CopyOnlyInt(int v) : value{std::move(v)} { print_created(this, value); }
65 CopyOnlyInt(const CopyOnlyInt &c) { print_copy_created(this, c.value); value = c.value; }
66 CopyOnlyInt &operator=(const CopyOnlyInt &c) { print_copy_assigned(this, c.value); value = c.value; return *this; }
69 int value;
75 bool load(handle src, bool) { value = MoveOnlyInt(src.cast<int>()); return true; }
76 static handle cast(const MoveOnlyInt &m, return_value_policy r, handle p) { return pybind11::cast(m.value, r, p); }
81 bool load(handle src, bool) { value = MoveOrCopyInt(src.cast<int>()); return true; }
82 static handle cast(const MoveOrCopyInt &m, return_value_policy r, handle p) { return pybind11::cast(m.value, r, p); }
87 CopyOnlyInt value;
90 bool load(handle src, bool) { value = CopyOnlyInt(src.cast<int>()); return true; }
91 static handle cast(const CopyOnlyInt &m, return_value_policy r, handle p) { return pybind11::cast(m.value, r, p); }
96 operator CopyOnlyInt*() { return &value; }
97 operator CopyOnlyInt&() { return value; }
116 r += py::cast<MoveOrCopyInt>(o).value; /* moves */
117 r += py::cast<MoveOnlyInt>(o).value; /* moves */
118 r += py::cast<CopyOnlyInt>(o).value; /* copies */
122 r += m1.value + m2.value + m3.value;
128 m.def("move_only", [](MoveOnlyInt m) { return m.value; });
129 m.def("move_or_copy", [](MoveOrCopyInt m) { return m.value; });
130 m.def("copy_only", [](CopyOnlyInt m) { return m.value; });
132 return p.first.value + p.second.value;
135 return std::get<0>(t).value + std::get<1>(t).value + std::get<2>(t).value;
138 return std::get<0>(t).value + std::get<1>(t).value;
141 return x.first.value + std::get<0>(x.second.first).value + std::get<1>(x.second.first).value +
142 std::get<0>(std::get<2>(x.second.first)).value + x.second.second.value;
163 return o->value;
166 return o->value;
169 return o->value;
172 return std::get<0>(*x).value + std::get<1>(*x).value + std::get<2>(*x).value;
180 int value = 1;
187 py::class_<PrivateOpNew>(m, "PrivateOpNew").def_readonly("value", &PrivateOpNew::value);
202 py::class_<MoveIssue1>(m, "MoveIssue1").def(py::init<int>()).def_readwrite("value", &MoveIssue1::v);
209 py::class_<MoveIssue2>(m, "MoveIssue2").def(py::init<int>()).def_readwrite("value", &MoveIssue2::v);