MCPcopy Create free account
hub / github.com/SergeyMakeev/ExcaliburHash / ComplexVal

Class ComplexVal

ExcaliburHashTest05.cpp:54–103  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

52static int assignCallCount = 0;
53
54struct ComplexVal
55{
56 ComplexVal() = delete;
57 ComplexVal(const ComplexVal& other) = delete;
58 ComplexVal& operator=(const ComplexVal& other) noexcept = delete;
59
60 ComplexVal(uint32_t _v) noexcept
61 : v(_v)
62 , status(Status::Constructed)
63 {
64 ctorCallCount++;
65 }
66
67 ComplexVal(ComplexVal&& other) noexcept
68 : v(other.v)
69 , status(Status::MoveConstructed)
70 {
71 EXPECT_NE(other.status, Status::Destructed);
72 ctorCallCount++;
73 other.status = Status::Moved;
74 }
75
76 ~ComplexVal() noexcept
77 {
78 EXPECT_NE(status, Status::Destructed);
79 status = Status::Destructed;
80 dtorCallCount++;
81 }
82
83 ComplexVal& operator=(ComplexVal&& other) noexcept
84 {
85 status = Status::MoveAssigned;
86 other.status = Status::Moved;
87
88 v = other.v;
89 assignCallCount++;
90 return *this;
91 }
92
93 uint32_t v;
94 enum class Status
95 {
96 Constructed = 0,
97 MoveConstructed = 1,
98 MoveAssigned = 2,
99 Destructed = 3,
100 Moved = 4,
101 };
102 Status status;
103};
104
105template <typename TFrom, typename TTo> void doMoveAssignmentTest(TFrom& hm1, TTo& hm2, size_t numValuesToInsert)
106{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected