Просмотр исходного кода

core: move hash<StringView> to string_view.inl

Daniele Bartolini 2 лет назад
Родитель
Сommit
70e3f3fc55
2 измененных файлов с 10 добавлено и 10 удалено
  1. 0 10
      src/core/json/json_object.inl
  2. 10 0
      src/core/strings/string_view.inl

+ 0 - 10
src/core/json/json_object.inl

@@ -7,20 +7,10 @@
 
 #include "core/containers/hash_map.inl"
 #include "core/json/types.h"
-#include "core/murmur.h"
 #include "core/strings/string_view.inl"
 
 namespace crown
 {
-template<>
-struct hash<StringView>
-{
-	u32 operator()(const StringView &val) const
-	{
-		return (u32)murmur32(val._data, val._length, 0);
-	}
-};
-
 /// Functions to manipulate JsonObject.
 ///
 /// @ingroup JSON

+ 10 - 0
src/core/strings/string_view.inl

@@ -5,6 +5,7 @@
 
 #pragma once
 
+#include "core/murmur.h"
 #include "core/strings/string.inl"
 #include "core/strings/string_view.h"
 
@@ -74,4 +75,13 @@ inline bool operator<(const StringView &a, const StringView &b)
 	return cmp < 0 || (cmp == 0 && a._length < b._length);
 }
 
+template<>
+struct hash<StringView>
+{
+	u32 operator()(const StringView &val) const
+	{
+		return (u32)murmur64(val._data, val._length, 0);
+	}
+};
+
 } // namespace crown