-
Notifications
You must be signed in to change notification settings - Fork 0
/
cdlist.h
49 lines (42 loc) · 1019 Bytes
/
cdlist.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#ifndef CDLIST_H
#define CDLIST_H
template<class Node> // node needs to have the fibnodebase, base template
class CDList // circular doubley list
{
public:
CDList() : first(0) {
}
void setFirst(Node *newFirst) {
first = newFirst;
}
inline void setEmpty() {
first = 0;
}
inline void removeUpdate(Node *remove) {
if(remove == first /*&& first != first->prev()*/)
{
// #ifdef FIBHEAPGRAPHICS_H
first = first->prev();
// #else
// first = first->next();
// #endif
}
}
inline Node *getFirst() const {
// #ifdef FIBHEAPGRAPHICS_H
return first->next();
// #else
// return first;
// #endif
}
inline Node *getLast() const {
// #ifdef FIBHEAPGRAPHICS_H
return first;
// #else
// return first->prev();
// #endif
}
private:
Node *first; // #ifdef FIBHEAPGRAPHICS_H the node is last
};
#endif // CDLIST_H