MCPcopy Create free account
hub / github.com/pybind/pybind11 / MoveOnlyInt

Class MoveOnlyInt

tests/test_copy_move.cpp:46–64  ·  view source on GitHub ↗

Custom type caster move/copy test classes */

Source from the content-addressed store, hash-verified

44
45/* Custom type caster move/copy test classes */
46class MoveOnlyInt {
47public:
48 MoveOnlyInt() { print_default_created(this); }
49 explicit MoveOnlyInt(int v) : value{v} { print_created(this, value); }
50 MoveOnlyInt(MoveOnlyInt &&m) noexcept {
51 print_move_created(this, m.value);
52 std::swap(value, m.value);
53 }
54 MoveOnlyInt &operator=(MoveOnlyInt &&m) noexcept {
55 print_move_assigned(this, m.value);
56 std::swap(value, m.value);
57 return *this;
58 }
59 MoveOnlyInt(const MoveOnlyInt &) = delete;
60 MoveOnlyInt &operator=(const MoveOnlyInt &) = delete;
61 ~MoveOnlyInt() { print_destroyed(this); }
62
63 int value;
64};
65class MoveOrCopyInt {
66public:
67 MoveOrCopyInt() { print_default_created(this); }

Callers 1

loadMethod · 0.85

Calls 1

print_move_assignedFunction · 0.85

Tested by 1

loadMethod · 0.68