template <class MyKeyClass, class MyOtherClass>class TileCache : public QCache<class Key, class T>{ struct Node { inline Node() : keyPtr(0) {} inline Node(T *data, int cost) : keyPtr(0), t(data), c(cost), p(0), n(0) {} const Key *keyPtr; T *t; int c; Node *p,*n; }; Node *f, *l; QHash<Key, Node> hash; int mx, total;public: inline explicit TileCache(int maxCost = 100);};template <class MyKeyClass, class MyOtherClass>inline TileCache<MyKeyClass, MyOtherClass>::TileCache(int amaxCost) : f(0), l(0), mx(amaxCost), total(0){}
C++ (Qt)template <class MyKeyClass, class MyOtherClass>class TileCache : public QCache<class Key, class T>
C++ (Qt)template <class Key, class T>class TileCache : public QCache<Key, T>
template <class Key, class T>inline void TileCache<Key,T>::setMaxCost(int m){ mx = m; trim(mx); }
template <class Key, class T>class QCache{ struct Node { inline Node() : keyPtr(0) {} inline Node(T *data, int cost) : keyPtr(0), t(data), c(cost), p(0), n(0) {} const Key *keyPtr; T *t; int c; Node *p,*n; }; Node *f, *l; QHash<Key, Node> hash; int mx, total; inline void unlink(Node &n) { if (n.p) n.p->n = n.n; if (n.n) n.n->p = n.p; if (l == &n) l = n.p; if (f == &n) f = n.n; total -= n.c; T *obj = n.t; hash.remove(*n.keyPtr); delete obj; }.....