public:
CArray* array;
int index;
CNode* node;
CCursor(CArray* _array, int _index):
array(_array), index(_index), node (NULL){};
CCursor(CArray* _array, CNode* _node):
array(_array), index (_node-›index), node (_node){};
CCursor& operator=(CThat* _that);
operator CThat*();
CThat* operator-›();
};
class CArray {
public:
CNode* cells;
CArray(): cells(NULL) {}
CCursor operator[](int i);
};
CCursor CArray::operator[](int _index) {
CNode* pNode = cells;
while (pNode!=NULL) {
if (pNode-›index -_index) {
return CCursor(this, pNode);
} else pNode=pNode-›next;
}
return CCursor(this, _index);
}
CCursor& CCursor::operator=(CThat* _that) {
if (node==NULL) {
node = new CNode (index, _that, array-›cells);