I want to change an element in set , so I used set<T>::iterator . However, the compiler claims to be a "const element". Then I realized that set<T>::iterator is const_iterator ...
set
set<T>::iterator
const_iterator
So how can I change an item? Delete it and then insert a new one?
set elements will be sorted in sort order. If you are allowed to change an item, this sort order cannot be saved. Therefore, you cannot change the item. You need to erase the existing item and insert a new one.
EDIT: You cannot add an item to a specific place in a set. the set should be in sorted order, what operations do you perform. Thus, you need to delete a specific element and insert a new element so that the dialing order is not lost.
Also read more about set !
Source: https://habr.com/ru/post/910164/More articles:MSBuild Does Not Find Asynchronous Required Links - asynchronousHow to copy my files from one directory to another directory? - androidhttps://translate.googleusercontent.com/translate_c?depth=1&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/910161/how-to-traverse-all-the-files-in-a-directory-if-it-has-subdirectories-i-want-to-traverse-files-in-subdirectories-too&usg=ALkJrhgPmts7MqzRA4YqJMRhGLaAcHYcGgSetAction for NSPopUpButton disables my popUpButton - cocoaImplications and declaration procedure - scalaSingle Perceptron - non-linear evaluation function - algorithmBlock beam adjustment flow - opencvAccess JSF managed bean values โโin another managed bean - jsfpython pool apply_async and map_async are not blocked in full queue - pythonHow to manage transactions using JAX-RS, Spring and JPA - springAll Articles