From: <pat...@us...> - 2010-05-09 20:37:20
|
Revision: 657 http://xml-cppdom.svn.sourceforge.net/xml-cppdom/?rev=657&view=rev Author: patrickh Date: 2010-05-09 20:37:14 +0000 (Sun, 09 May 2010) Log Message: ----------- 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: -------------- trunk/cppdom/cppdom.h Modified: trunk/cppdom/cppdom.h =================================================================== --- trunk/cppdom/cppdom.h 2010-05-09 20:35:24 UTC (rev 656) +++ trunk/cppdom/cppdom.h 2010-05-09 20:37:14 UTC (rev 657) @@ -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. |