|
|
@@ -5,7 +5,7 @@
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
-#include "array.h"
|
|
|
+#include "vector.h"
|
|
|
#include <algorithm>
|
|
|
|
|
|
namespace crown
|
|
|
@@ -81,11 +81,11 @@ namespace sort_map_internal
|
|
|
result.item_i = END_OF_LIST;
|
|
|
|
|
|
const typename SortMap<TKey, TValue, Compare>::Entry* first =
|
|
|
- std::lower_bound(array::begin(m._data), array::end(m._data), key,
|
|
|
+ std::lower_bound(vector::begin(m._data), vector::end(m._data), key,
|
|
|
sort_map_internal::CompareEntry<TKey, TValue, Compare>());
|
|
|
|
|
|
- if (first != array::end(m._data) && !(key < first->key))
|
|
|
- result.item_i = first - array::begin(m._data);
|
|
|
+ if (first != vector::end(m._data) && !(key < first->key))
|
|
|
+ result.item_i = first - vector::begin(m._data);
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
@@ -119,7 +119,7 @@ namespace sort_map
|
|
|
template <typename TKey, typename TValue, typename Compare>
|
|
|
inline void sort(SortMap<TKey, TValue, Compare>& m)
|
|
|
{
|
|
|
- std::sort(array::begin(m._data), array::end(m._data),
|
|
|
+ std::sort(vector::begin(m._data), vector::end(m._data),
|
|
|
sort_map_internal::CompareEntry<TKey, TValue, Compare>());
|
|
|
#if CROWN_DEBUG
|
|
|
m._is_sorted = true;
|
|
|
@@ -136,7 +136,7 @@ namespace sort_map
|
|
|
typename SortMap<TKey, TValue, Compare>::Entry e;
|
|
|
e.key = key;
|
|
|
e.value = val;
|
|
|
- array::push_back(m._data, e);
|
|
|
+ vector::push_back(m._data, e);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
@@ -155,10 +155,10 @@ namespace sort_map
|
|
|
if (result.item_i == sort_map_internal::END_OF_LIST)
|
|
|
return;
|
|
|
|
|
|
- if (array::size(m._data))
|
|
|
+ if (vector::size(m._data))
|
|
|
{
|
|
|
- m._data[result.item_i] = m._data[array::size(m._data) - 1];
|
|
|
- array::pop_back(m._data);
|
|
|
+ m._data[result.item_i] = m._data[vector::size(m._data) - 1];
|
|
|
+ vector::pop_back(m._data);
|
|
|
}
|
|
|
#if CROWN_DEBUG
|
|
|
m._is_sorted = false;
|
|
|
@@ -168,7 +168,7 @@ namespace sort_map
|
|
|
template <typename TKey, typename TValue, typename Compare>
|
|
|
inline void clear(SortMap<TKey, TValue, Compare>& m)
|
|
|
{
|
|
|
- array::clear(m._data);
|
|
|
+ vector::clear(m._data);
|
|
|
#if CROWN_DEBUG
|
|
|
m._is_sorted = true;
|
|
|
#endif // CROWN_DEBUG
|
|
|
@@ -177,13 +177,13 @@ namespace sort_map
|
|
|
template <typename TKey, typename TValue, typename Compare>
|
|
|
inline const typename SortMap<TKey, TValue, Compare>::Entry* begin(const SortMap<TKey, TValue, Compare>& m)
|
|
|
{
|
|
|
- return array::begin(m._data);
|
|
|
+ return vector::begin(m._data);
|
|
|
}
|
|
|
|
|
|
template <typename TKey, typename TValue, typename Compare>
|
|
|
inline const typename SortMap<TKey, TValue, Compare>::Entry* end(const SortMap<TKey, TValue, Compare>& m)
|
|
|
{
|
|
|
- return array::end(m._data);
|
|
|
+ return vector::end(m._data);
|
|
|
}
|
|
|
} // namespace sort_map
|
|
|
|