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 » How to sort a vector?
Re: How to sort a vector? [message #37875 is a reply to message #37874] Mon, 19 November 2012 16:09 Go to previous messageGo to previous message
koldo is currently offline  koldo
Messages: 3361
Registered: August 2008
Senior Veteran
Hello Crydev

AFAIK ArrayCtrl Sort() uses Value comparison that in case of Strings uses DefaultLanguageCompare() function in LangInfo.cpp. However String comparison uses String0::Compare() in AString.hpp.

If you prefer the second, I suppose that you have to create a comparison function like this;

int MyStringCompare(const Value& a, const Value& b) {
	return a.ToString() < b.ToString();
}


and refer to it in Sort:

array.Sort(columnToSort, MyStringCompare);


I have not tested it. Does it work?


Best regards
IƱaki
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Is libXi needed ??
Next Topic: To add serialize/xmlize/jsonize functions to EditField and others
Goto Forum:
  


Current Time: Fri May 10 00:36:20 CEST 2024

Total time taken to generate the page: 0.02345 seconds