Do I need to re-sort the set?
Hi all,
I have a multiset<CMyStruct*, CMyStructLess>. When I insert pointers into the set, the sequence is ordered as expected.
Now I need to change the items that the multiset pointers point to and the the sequence should be changed after my code changes the items. Does multiset sorts the set automatically?
Thanks.
Haoshi
Re: Do I need to re-sort the set?
Nope. Not when you change the value the pointer points to. You'd have to remove the pointer, change the value, and then insert it again. Otherwise the set won't know the value changed.
Re: Do I need to re-sort the set?
Thanks. what about the performance if I call erease() and insert().
Re: Do I need to re-sort the set?
I guess both take O(log(n)).