Hi, I'm figuring out how to work with std::unordered_set.
Some sites indicate that you need to create custom hashing and comparison functions when using unordered_set with custom classes but is that the case if you only use pointers to custom classes?
This is my testing code:
Code:
std::unordered_set<MyClass*> unord;
unord.insert(&level.myClasses[0]);
unord.insert(&level.myClasses[1]);
unord.erase(&level.myClasses[0]);
Print((int)unord.size());
This works, the erase() removes an object and the size() afterwards is correct, but is this safe? Can I rely on that standard pointer/adress comparison will work?