Inline initialize functional road classification hash table

This commit is contained in:
Daniel J. Hofmann 2016-03-03 16:20:47 +01:00 committed by Patrick Niklaus
parent b5619e89c8
commit b45efeb4bd

View File

@ -44,7 +44,7 @@ enum class FunctionalRoadClass : std::uint8_t
inline FunctionalRoadClass functionalRoadClassFromTag(std::string const &value)
{
// FIXME at some point this should be part of the profiles
const static auto initializeClassHash = []()
const static auto class_hash = []
{
std::unordered_map<std::string, FunctionalRoadClass> hash;
hash["motorway"] = FunctionalRoadClass::MOTORWAY;
@ -66,10 +66,7 @@ inline FunctionalRoadClass functionalRoadClassFromTag(std::string const &value)
hash["path"] = FunctionalRoadClass::LOW_PRIORITY_ROAD;
hash["driveway"] = FunctionalRoadClass::LOW_PRIORITY_ROAD;
return hash;
};
static const std::unordered_map<std::string, FunctionalRoadClass> class_hash =
initializeClassHash();
}();
if (class_hash.find(value) != class_hash.end())
{