From 80b8d88c72a00bb5de5bc67b41f56c517875b30d Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Tue, 24 Nov 2009 17:33:30 +0000
Subject: [PATCH] better map search

---
 Geo/GModel.cpp | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/Geo/GModel.cpp b/Geo/GModel.cpp
index dbbb41910b..f860a2cf2b 100644
--- a/Geo/GModel.cpp
+++ b/Geo/GModel.cpp
@@ -370,8 +370,9 @@ int GModel::setPhysicalName(std::string name, int dim, int number)
 
 std::string GModel::getPhysicalName(int dim, int number)
 {
-  if(physicalNames.count(std::pair<int, int>(dim, number)))
-    return physicalNames[std::pair<int, int>(dim, number)];
+  std::map<std::pair<int, int>, std::string>::iterator it = 
+    physicalNames.find(std::pair<int, int>(dim, number));
+  if(it != physicalNames.end()) return it->second;
   return "";
 }
 
@@ -386,8 +387,9 @@ int GModel::getPhysicalNumber(const int &dim, const std::string &name)
 
 std::string GModel::getElementaryName(int dim, int number)
 {
-  if(elementaryNames.count(std::pair<int, int>(dim, number)))
-    return elementaryNames[std::pair<int, int>(dim, number)];
+  std::map<std::pair<int, int>, std::string>::iterator it = 
+    elementaryNames.find(std::pair<int, int>(dim, number));
+  if(it != elementaryNames.end()) return it->second;
   return "";
 }
 
-- 
GitLab