Lines Matching defs:CopyOnlyInt

61 class CopyOnlyInt {
63 CopyOnlyInt() { print_default_created(this); }
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; }
67 ~CopyOnlyInt() { print_destroyed(this); }
85 template <> struct type_caster<CopyOnlyInt> {
87 CopyOnlyInt value;
89 static constexpr auto name = _("CopyOnlyInt");
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); }
92 static handle cast(const CopyOnlyInt *src, return_value_policy policy, handle parent) {
96 operator CopyOnlyInt*() { return &value; }
97 operator CopyOnlyInt&() { return value; }
118 r += py::cast<CopyOnlyInt>(o).value; /* copies */
121 CopyOnlyInt m3(py::cast<CopyOnlyInt>(o)); /* copies */
130 m.def("copy_only", [](CopyOnlyInt m) { return m.value; });
137 m.def("copy_tuple", [](std::tuple<CopyOnlyInt, CopyOnlyInt> t) {
140 m.def("move_copy_nested", [](std::pair<MoveOnlyInt, std::pair<std::tuple<MoveOrCopyInt, CopyOnlyInt, std::tuple<MoveOnlyInt>>, MoveOrCopyInt>> x) {
151 auto &co = ConstructorStats::get<CopyOnlyInt>();
156 d["CopyOnlyInt"] = py::cast(co, py::return_value_policy::reference);
168 m.def("copy_optional", [](std::optional<CopyOnlyInt> o) {
171 m.def("move_optional_tuple", [](std::optional<std::tuple<MoveOrCopyInt, MoveOnlyInt, CopyOnlyInt>> x) {