I have also thought of the problem with an int overflow,
so basically what I do is keep a list of UIDs that were used
before and take them first.
When an object is deallocated it returns its UID to the system.
class UIDGenerator{private: std::list<int> returnedIDs; int highestID;public: int GetUniqueID(); void ReturnUniqueID(int id);};int UIDGenerator::GetUniqueID(){ if (retunedIDs.empty()) { return highestID++; } else { int id = retunedIDs.back(); retunedIDs.pop_back(); return id; }}void UIDGenerator::ReturnUniqueID(int id){ retunedIDs.push_back(id);}
****EDIT:
Oh sorry, I didn't read the other posts.
So you're looking for something like a ClassID to identify
a class and not an ID to identify actual instances of the class.
hm........ :)