vector sort method
-
Hello, Is there any way of tracking what elements were moved where during a vector sort? Thanks,
Create a map (or something like that) of items vs. index before the sort, and create a map of items vs. index after the soft and compare both maps. I'm certain there are more smarter ways of doing it.
Watched code never compiles.
-
Create a map (or something like that) of items vs. index before the sort, and create a map of items vs. index after the soft and compare both maps. I'm certain there are more smarter ways of doing it.
Watched code never compiles.
how about creating a clone of the vector before sorting it, then compare the clone with the sorted vector, one element at a time? :confused:
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
Getting an article published on CodeProject now is hard and not sufficiently rewarded.
-
how about creating a clone of the vector before sorting it, then compare the clone with the sorted vector, one element at a time? :confused:
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
Getting an article published on CodeProject now is hard and not sufficiently rewarded.
yep, you see, smarter than me. :-D
Watched code never compiles.
-
yep, you see, smarter than me. :-D
Watched code never compiles.
Not sure about smarter, my approach just is simpler, more straightforward. Keep it simple! :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
Getting an article published on CodeProject now is hard and not sufficiently rewarded.