furnace:
I found this template class from a opensource project, but I have no idea How to use it??
[阅读: 547] 2005-01-03 12:13:55
#include <cstddef>
template <class T, typename K> class objList
{
public:
static T* objFirst;
T* objNext;
K objKey;
objList(const K key)
{
objKey = key;
objNext = objFirst;
objFirst = (T *)this;
}
public:
static T* getObject(const K& key);
};
template <class T, typename K> T *objList<T, K>::objFirst = NULL;
template <class T, typename K> T *objList<T, K>::getObject(const K& key)
{
T *obj = objList<T, K>::objFirst;
while(obj)
{
if(key == obj->objKey)
break;
obj = obj->objNext;
}
return obj;
}
I don't mind if you r FAT.
I don't mind if you r UGLY.
I don't mind if you ACT CUTE.
But I can't STAND if you r FAT, UGLY and still ACT CUTE.