Quellcode durchsuchen

Merge branch 'master' of github.com:taylor001/crown

Daniele Bartolini vor 10 Jahren
Ursprung
Commit
41b2430b38
2 geänderte Dateien mit 9 neuen und 8 gelöschten Zeilen
  1. 9 0
      src/core/containers/sort_map.h
  2. 0 8
      src/core/math/math_utils.h

+ 9 - 0
src/core/containers/sort_map.h

@@ -16,6 +16,9 @@ namespace crown
 /// @ingroup Containers
 namespace sort_map
 {
+	/// Returns the number of items in the map @m.
+	template <typename TKey, typename TValue, typename Compare> uint32_t size(const SortMap<TKey, TValue, Compare>& m);
+
 	/// Returns whether the @a key exists in the map.
 	template <typename TKey, typename TValue, typename Compare> bool has(const SortMap<TKey, TValue, Compare>& m, const TKey& key);
 
@@ -92,6 +95,12 @@ namespace sort_map_internal
 
 namespace sort_map
 {
+	template <typename TKey, typename TValue, typename Compare>
+	inline uint32_t size(const SortMap<TKey, TValue, Compare>& m)
+	{
+		return vector::size(m._data);
+	}
+
 	template <typename TKey, typename TValue, typename Compare>
 	inline bool has(const SortMap<TKey, TValue, Compare>& m, const TKey& key)
 	{

+ 0 - 8
src/core/math/math_utils.h

@@ -49,14 +49,6 @@ inline T clamp(const T& min, const T& max, const T& val)
 	return val > max ? max : val < min ? min : val;
 }
 
-template <typename T>
-inline void swap(T& a, T& b)
-{
-	T tmp = a;
-	a = b;
-	b = tmp;
-}
-
 inline float to_rad(float deg)
 {
 	return deg * float(PI / 180.0);