Browse Source

ClassNames: fixed deprecated hash_map

Sven Sickert 11 years ago
parent
commit
e8763486b0
2 changed files with 7 additions and 5 deletions
  1. 3 3
      cbaselib/ClassNames.cpp
  2. 4 2
      cbaselib/ClassNames.h

+ 3 - 3
cbaselib/ClassNames.cpp

@@ -71,7 +71,7 @@ ClassNames::ClassNames ( const ClassNames & cn,
 ClassNames::ClassNames ( const ClassNames & cn )
     : tbl_code_text ( cn.tbl_code_text ), tbl_text_code ( cn.tbl_text_code ),
     tbl_classno_code ( cn.tbl_classno_code ), tbl_code_classno ( cn.tbl_code_classno ),
-    tbl_color_classno ( tbl_color_classno ), tbl_classno_color ( cn.tbl_classno_color ), maxClassNo ( cn.maxClassNo )
+    tbl_color_classno ( cn.tbl_color_classno ), tbl_classno_color ( cn.tbl_classno_color ), maxClassNo ( cn.maxClassNo )
 {
 }
 
@@ -391,7 +391,8 @@ void ClassNames::getRGBColor ( int classno, int & r, int & g, int & b ) const
 void ClassNames::getClassnoFromColor ( int & classno, int r, int g, int b ) const
 {
   long color = 256 * ( 256 * r + g ) + b;
-  __gnu_cxx::hash_map<long, int>::const_iterator i = tbl_color_classno.find ( color );
+//  __gnu_cxx::hash_map<long, int>::const_iterator i = tbl_color_classno.find ( color );
+  std::tr1::unordered_map<long, int>::const_iterator i = tbl_color_classno.find ( color );
 
   if ( i == tbl_color_classno.end() )
   {
@@ -479,4 +480,3 @@ void ClassNames::clear ()
   tbl_color_classno.clear();
   tbl_classno_color.clear();
 }
-

+ 4 - 2
cbaselib/ClassNames.h

@@ -17,7 +17,8 @@
 
 // in future we should replace this with 
 // unordered_map, but it is still experimental but standard c++
-#include <ext/hash_map>
+// #include <ext/hash_map>
+#include <tr1/unordered_map>
 
 #include "core/basics/Config.h"
 #include "core/basics/Persistent.h"
@@ -35,7 +36,8 @@ class ClassNames : public NICE::Persistent
     std::map<std::string, std::string> tbl_text_code;
     std::map<int, std::string> tbl_classno_code;
     std::map<std::string, int> tbl_code_classno;
-    __gnu_cxx::hash_map<long, int> tbl_color_classno;
+//    __gnu_cxx::hash_map<long, int> tbl_color_classno;
+    std::tr1::unordered_map<long, int> tbl_color_classno;
     std::map<int, long> tbl_classno_color;
 
     int maxClassNo;