For testing purposes I created a little unordered_set and tried to iterate over the set. The set holds an own class:
class Student { private: int matrNr;
You can cast const type to non-const type. By this you are 'telling the compiler' that you know what you are doing, so you should indeed know what you are doing.