How to change a set element?

后端 未结 3 767
死守一世寂寞
死守一世寂寞 2020-11-27 22:44

I want to change the element in a set, so I used set::iterator. However, the compiler argues \"the element is const\". Then I realized tha

3条回答
  •  难免孤独
    2020-11-27 23:37

    EDIT: You cant add an element to a specific location in set. the set should be in the sorted order whatever operations you do. So you have to erase the specific element and insert the new element so that the ordering of set isnt lost.

    Also read more about set!

提交回复
热议问题