unordered_set non const iterator

后端 未结 5 1299
野趣味
野趣味 2021-01-04 23:39

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;
         


        
5条回答
  •  梦谈多话
    2021-01-05 00:15

    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.

提交回复
热议问题