Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
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 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 13980
Registered: November 2005
Ultimate Member
aftershock wrote on Sun, 21 May 2017 22:30
Have 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

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Writing Bits object to disk
Next Topic: How to distribute some parts of Core in another library?
Goto Forum:
  


Current Time: Tue May 14 11:28:30 CEST 2024

Total time taken to generate the page: 0.02646 seconds