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

Class HeapInt

cpp/src/arrow/util/small_vector_test.cc:38–68  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36namespace internal {
37
38struct HeapInt {
39 HeapInt() : HeapInt(0) {}
40
41 explicit HeapInt(int x) : ptr(new int(x)) {}
42
43 HeapInt& operator=(int x) {
44 ptr.reset(new int(x));
45 return *this;
46 }
47
48 HeapInt(const HeapInt& other) : HeapInt(other.ToInt()) {}
49
50 HeapInt& operator=(const HeapInt& other) {
51 *this = other.ToInt();
52 return *this;
53 }
54
55 int ToInt() const { return ptr == nullptr ? -98 : *ptr; }
56
57 bool operator==(const HeapInt& other) const {
58 return ptr != nullptr && other.ptr != nullptr && *ptr == *other.ptr;
59 }
60 bool operator<(const HeapInt& other) const {
61 return ptr == nullptr || (other.ptr != nullptr && *ptr < *other.ptr);
62 }
63
64 bool operator==(int other) const { return ptr != nullptr && *ptr == other; }
65 friend bool operator==(int left, const HeapInt& right) { return right == left; }
66
67 std::unique_ptr<int> ptr;
68};
69
70template <typename Vector>
71bool UsesStaticStorage(const Vector& v) {

Callers

nothing calls this directly

Calls 2

resetMethod · 0.45
ToIntMethod · 0.45

Tested by

no test coverage detected