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;
> }
> map<IACOcode, ARP*> apt_map;
> 
> 
> 2 - create a custom sort order
> class IACOcode_compare
> {
> public:
>   bool operator()( const string& x, const string& y) const
>   {
>     return your ordering;
>   }
> }
> map<string, ARP*, IACOcode_compare> apt_map;
> 
> 
> Then you'll automatically get the desired result with your described lookup.
> 

Thanks to everyone who replied.  I can see how to do it now, but unfortuanately 
it's now been complicated by the fact that the GPS unit appears to sometimes 
consider letters before numbers (forward prediction of airports), but sometime 
consider numbers before letters (scanning through the waypoint lists).  It 
seems that associative containers need the comparison operator specified at 
creation (for good reason when I think about it) so I guess I'll just carry on 
with my hack to avoid storing the data in memory twice.

Cheers - Dave

_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@flightgear.org
http://mail.flightgear.org/mailman/listinfo/flightgear-devel
2f585eeea02e2c79d7b1d8c4963bae2d

Reply via email to