Przeglądaj źródła

Fix templates being specialized in a different namespace

Actual compiler error, for the record:

    BansheeEngine/Source/BansheeUtility/Include/BsString.h:883:13: error: specialization of ‘template<class _Tp> struct std::hash’ in different namespace [-fpermissive]
Marc Legendre 9 lat temu
rodzic
commit
744ce4870d

+ 5 - 2
Source/BansheeUtility/Include/BsColor.h

@@ -266,9 +266,11 @@ namespace BansheeEngine
 
 /** @cond SPECIALIZATIONS */
 
+namespace std
+{
 /** Hash value generator for Color. */
 template<> 
-struct std::hash<BansheeEngine::Color>
+struct hash<BansheeEngine::Color>
 {
 	size_t operator()(const BansheeEngine::Color& color) const
 	{
@@ -281,5 +283,6 @@ struct std::hash<BansheeEngine::Color>
 		return hash;
 	}
 };
+}
 
-/** @endcond */
+/** @endcond */

+ 5 - 2
Source/BansheeUtility/Include/BsPath.h

@@ -617,9 +617,11 @@ namespace BansheeEngine
 
 /** @cond STDLIB */
 
+namespace std
+{
 /** Hash value generator for Path. */
 template<>
-struct std::hash<BansheeEngine::Path>
+struct hash<BansheeEngine::Path>
 {
 	size_t operator()(const BansheeEngine::Path& path) const
 	{
@@ -634,5 +636,6 @@ struct std::hash<BansheeEngine::Path>
 		return hash;
 	}
 };
+}
 
-/** @endcond */
+/** @endcond */

+ 6 - 3
Source/BansheeUtility/Include/BsString.h

@@ -876,9 +876,11 @@ namespace BansheeEngine
 
 /** @cond STDLIB */
 
+namespace std
+{
 /** Hash value generator for String. */
 template<> 
-struct std::hash<BansheeEngine::String>
+struct hash<BansheeEngine::String>
 {
 	size_t operator()(const BansheeEngine::String& string) const
 	{
@@ -891,7 +893,7 @@ struct std::hash<BansheeEngine::String>
 
 /**	Hash value generator for WString. */
 template<> 
-struct std::hash<BansheeEngine::WString>
+struct hash<BansheeEngine::WString>
 {
 	size_t operator()(const BansheeEngine::WString& string) const
 	{
@@ -901,5 +903,6 @@ struct std::hash<BansheeEngine::WString>
 		return hash ^ (hash >> 16);
 	}
 };
+}
 
-/** @endcond */
+/** @endcond */