1
0
Fork 0

Stefan C. Mller :

Small patch fixing bugs I've encountered while getting the current CVS to build in MSVC.
* std::lower_bound was used with the key-type of a map, but lower_bound expects the value-type of the collection it works on, with is std::pair. MSVC seems to be more strict about this.
* Added an missing include statement.
* Replaced an rint() call with floor() (MSVC does not offer rint).
This commit is contained in:
fredb 2008-08-31 18:32:43 +00:00
parent fbdc0962dd
commit b53badf201
3 changed files with 22 additions and 1 deletions

View file

@ -336,6 +336,16 @@ public:
return mOrdering->compare(aA.first,aB); return mOrdering->compare(aA.first,aB);
} }
bool operator()(const std::string& aA, const airport_map::value_type& aB) const
{
return mOrdering->compare(aA, aB.first);
}
bool operator()(const airport_map::value_type& aA, const airport_map::value_type& aB) const
{
return mOrdering->compare(aA.first, aB.first);
}
private: private:
FGIdentOrdering* mOrdering; FGIdentOrdering* mOrdering;
}; };

View file

@ -24,6 +24,7 @@
#include <sstream> #include <sstream>
#include <iostream> #include <iostream>
#include <string.h> #include <string.h>
#include <time.h>
#include <simgear/debug/logstream.hxx> #include <simgear/debug/logstream.hxx>
#include <simgear/environment/metar.hxx> #include <simgear/environment/metar.hxx>
@ -76,7 +77,7 @@ const char *azimuthName(double d)
double rnd(double r, int g = 0) double rnd(double r, int g = 0)
{ {
double f = pow(10.0, g); double f = pow(10.0, g);
return f * rint(r / f); return f * floor(r / f + 0.5);
} }

View file

@ -146,6 +146,16 @@ public:
return mOrdering->compare(aA.first,aB); return mOrdering->compare(aA.first,aB);
} }
bool operator()(const std::string& aA, const fix_map_type::value_type& aB) const
{
return mOrdering->compare(aA, aB.first);
}
bool operator()(const fix_map_type::value_type& aA, const fix_map_type::value_type& aB) const
{
return mOrdering->compare(aA.first, aB.first);
}
private: private:
FGIdentOrdering* mOrdering; FGIdentOrdering* mOrdering;
}; };