MCPcopy Create free account
hub / github.com/apache/arrow / HeapAllocatedObject

Class HeapAllocatedObject

cpp/src/arrow/result_test.cc:114–142  ·  view source on GitHub ↗

A data type with dynamically-allocated data.

Source from the content-addressed store, hash-verified

112
113// A data type with dynamically-allocated data.
114struct HeapAllocatedObject {
115 int* value;
116
117 HeapAllocatedObject() {
118 value = new int;
119 *value = kIntElement;
120 }
121
122 HeapAllocatedObject(const HeapAllocatedObject& other) {
123 value = new int;
124 *value = *other.value;
125 }
126
127 HeapAllocatedObject& operator=(const HeapAllocatedObject& other) {
128 *value = *other.value;
129 return *this;
130 }
131
132 HeapAllocatedObject(HeapAllocatedObject&& other) {
133 value = other.value;
134 other.value = nullptr;
135 }
136
137 ~HeapAllocatedObject() { delete value; }
138
139 bool operator==(const HeapAllocatedObject& other) const {
140 return *value == *other.value;
141 }
142};
143
144// Constructs a Foo.
145struct FooCtor {

Callers 1

operator()Method · 0.85

Calls

no outgoing calls

Tested by 1

operator()Method · 0.68