Revision: 659
http://xml-cppdom.svn.sourceforge.net/xml-cppdom/?rev=659&view=rev
Author: patrickh
Date: 2010-05-09 20:45:27 +0000 (Sun, 09 May 2010)
Log Message:
-----------
Merged r657 from the trunk:
When using GCC 4.x or newer, prefer the use of std::tr1::unordered_map over
the deprecated, non-standard std::hash_map.
Submitted by: Jan P. Springer
Modified Paths:
--------------
branches/1.0/cppdom/cppdom.h
Modified: branches/1.0/cppdom/cppdom.h
===================================================================
--- branches/1.0/cppdom/cppdom.h 2010-05-09 20:39:42 UTC (rev 658)
+++ branches/1.0/cppdom/cppdom.h 2010-05-09 20:45:27 UTC (rev 659)
@@ -73,11 +73,22 @@
#define CPPDOM_USE_HASH_MAP 1
// Use fastest map available
-#if defined(CPPDOM_USE_HASH_MAP) && defined(__GNUC__) && (__GNUC__ >= 3)
+#if defined(CPPDOM_USE_HASH_MAP)
-#include <ext/hash_map>
-#include <map>
+# if defined(__GNUC__) && (__GNUC__ >= 4)
+# include <tr1/unordered_map>
+# include <map>
+namespace cppdom
+{
+ typedef std::tr1::unordered_map<TagNameHandle,std::string> TagNameMap_t;
+ typedef std::tr1::unordered_map<std::string, TagNameHandle> NameToTagMap_t;
+}
+
+# elif defined(__GNUC__) && (__GNUC__ >= 3)
+# include <ext/hash_map>
+# include <map>
+
namespace std
{ using namespace __gnu_cxx; }
@@ -92,16 +103,18 @@
typedef std::hash_map<TagNameHandle,std::string> TagNameMap_t;
typedef std::hash_map<std::string, TagNameHandle, HashString> NameToTagMap_t;
}
+# endif // # elif defined(__GNUC__) && (__GNUC__ >= 3)
-#else
+#else // #if defined(CPPDOM_USE_HASH_MAP)
-#include <map>
+# include <map>
+
namespace cppdom
{
typedef std::map<TagNameHandle,std::string> TagNameMap_t;
typedef std::map<std::string, TagNameHandle> NameToTagMap_t;
}
-#endif
+#endif // #if defined(CPPDOM_USE_HASH_MAP)
#include "config.h"
#include "shared_ptr.h" // the boost::shared_ptr class
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|