class AttributeList {
private:
struct AttributeListImp {
int *list;
unsigned count;
AttributeListImp (int *
data, unsigned size)
{
list = new int[size];
memcpy(list,data,
sizeof(int)*size);
count = 1;
}
} *ptr;
public:
AttributeList()
{
// Empty list special case:
ptr = NULL;
}
AttributeList(int *data,
unsigned size)
{
ptr = new
AttributeListImp(data,
size);
}
AttributeList(const
AttributeList &a)
{
// Now we have to check
// for null:
ptr: a.ptr;
if(ptr) ptr->count++;
}
...
};
// End of File