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

Class MoveOrCopyInt

tests/test_copy_move.cpp:65–91  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63 int value;
64};
65class MoveOrCopyInt {
66public:
67 MoveOrCopyInt() { print_default_created(this); }
68 explicit MoveOrCopyInt(int v) : value{v} { print_created(this, value); }
69 MoveOrCopyInt(MoveOrCopyInt &&m) noexcept {
70 print_move_created(this, m.value);
71 std::swap(value, m.value);
72 }
73 MoveOrCopyInt &operator=(MoveOrCopyInt &&m) noexcept {
74 print_move_assigned(this, m.value);
75 std::swap(value, m.value);
76 return *this;
77 }
78 MoveOrCopyInt(const MoveOrCopyInt &c) {
79 print_copy_created(this, c.value);
80 // NOLINTNEXTLINE(cppcoreguidelines-prefer-member-initializer)
81 value = c.value;
82 }
83 MoveOrCopyInt &operator=(const MoveOrCopyInt &c) {
84 print_copy_assigned(this, c.value);
85 value = c.value;
86 return *this;
87 }
88 ~MoveOrCopyInt() { print_destroyed(this); }
89
90 int value;
91};
92class CopyOnlyInt {
93public:
94 CopyOnlyInt() { print_default_created(this); }

Callers 1

loadMethod · 0.85

Calls 2

print_move_assignedFunction · 0.85
print_copy_assignedFunction · 0.85

Tested by 1

loadMethod · 0.68