Home » U++ Library support » U++ Core » stable sort bug.. or looks like it
Re: stable sort bug.. or looks like it [message #48130 is a reply to message #48123] |
Mon, 22 May 2017 12:00 |
|
mirek
Messages: 13980 Registered: November 2005
|
Ultimate Member |
|
|
aftershock wrote on Sun, 21 May 2017 22:30Have a look
VectorMap<String, int> involved_nodes;
DUMPM ( involved_nodes );
StableSort ( involved_nodes.Begin(), involved_nodes.End(), lip );
DUMPM ( involved_nodes );
Stable sort does not seem copy key value pairs correctly for maps.
All Sorts, when used like this, only sort values, as begin/end here return iterators to values only (the value subvector).
I think that to do what you need, you can use [Stable]SortByValues and then StableSortByKeys.
(Perhaps we might add [Stable]SortBy[KeysAndValues|ValuesAndKeys] in future...)
Mirek
[Updated on: Mon, 22 May 2017 12:02] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Tue May 14 11:28:30 CEST 2024
Total time taken to generate the page: 0.02646 seconds
|