|
-
March 17th, 2005, 02:03 PM
#1
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
-
March 17th, 2005, 02:11 PM
#2
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.
Insert entertaining phrase here
-
March 17th, 2005, 02:15 PM
#3
Re: Do I need to re-sort the set?
Thanks. what about the performance if I call erease() and insert().
Last edited by haoshi; March 17th, 2005 at 02:17 PM.
-
March 17th, 2005, 02:34 PM
#4
Re: Do I need to re-sort the set?
I guess both take O(log(n)).
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|