Re: [Flightgear-devel] STL help requested

2005-02-07 Thread Gerhard Wesp
On Fri, Feb 04, 2005 at 11:37:54PM +0100, Erik Hofman wrote: You could use qsort to sort the map just prior to using it: No you cannot, neither is this necessary. std::map is always maintained in sorted order. For this it uses the comparision function std::less or the one given in the template

Re: [Flightgear-devel] STL help requested

2005-02-07 Thread Gerhard Wesp
bool operator()( const string x, const string y) const { return your ordering; } Where your ordering can be written as std::lexicographical_compare ( x.begin() , x.end() , y.begin() , y.end() , ICAOcode_char_lt() ) where ICAOcode_char_lt implements the ``less than'' relation

Re: [Flightgear-devel] STL help requested

2005-02-07 Thread David Luff
Christian Mayer writes: The C++ Programming language 3rd ed. tells me: Basically you've got 2 options: 1 - create a class with the operator class IACOcode { string the_code; } bool operator( const IACOcode a, const IACOcode b ) { return your ordering; } mapIACOcode, ARP*

Re: [Flightgear-devel] STL help requested

2005-02-05 Thread Paul Kahler
When you write your case-insensitive compare function '0-9' are ascii 48-57 'a-z' are ascii 97-172 'A-Z' are ascii 65-90 by masking off the 32 bit, you make all letters upper case while moving the numbers to the range 16-25. Now you want the numbers to come after the letters, so you could

Re: [Flightgear-devel] STL help requested

2005-02-04 Thread Erik Hofman
David Luff wrote: Hi folks, I've run into a tricky problem when using stl map, and am hoping someone might be able to point me on the right direction. I have a map of airports, indexed by string, which is the ICAO code: mapstring, ARP* apt_map; Now, I want to emulate the 'search ahead' function

Re: [Flightgear-devel] STL help requested

2005-02-04 Thread Christian Mayer
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 David Luff schrieb: Hi folks, I've run into a tricky problem when using stl map, and am hoping someone might be able to point me on the right direction. I have a map of airports, indexed by string, which is the ICAO code: mapstring, ARP*