-
Notifications
You must be signed in to change notification settings - Fork 115
/
Copy pathgc_details.h
33 lines (32 loc) · 967 Bytes
/
gc_details.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// This class defines an element that is stored
// in the garbage collection information list.
//
template <class T>
class PtrDetails
{
public:
unsigned refcount; // current reference count
T *memPtr; // pointer to allocated memory
/* isArray is true if memPtr points
to an allocated array. It is false
otherwise. */
bool isArray; // true if pointing to array
/* If memPtr is pointing to an allocated
array, then arraySize contains its size */
unsigned arraySize; // size of array
// Here, mPtr points to the allocated memory.
// If this is an array, then size specifies
// the size of the array.
PtrDetails(void)
{
// TODO: Implement PtrDetails
}
};
// Overloading operator== allows two class objects to be compared.
// This is needed by the STL list class.
template <class T>
bool operator==(const PtrDetails<T> &ob1,
const PtrDetails<T> &ob2)
{
// TODO: Implement operator==
}