Skip to content

Commit 82b415c

Browse files
committed
Move xr_hash_map into separate file
1 parent 838eb61 commit 82b415c

File tree

6 files changed

+21
-14
lines changed

6 files changed

+21
-14
lines changed

src/Common/Common.vcxproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@
177177
<ClInclude Include="..\xrCommon\xr_set.h" />
178178
<ClInclude Include="..\xrCommon\xr_stack.h" />
179179
<ClInclude Include="..\xrCommon\xr_string.h" />
180+
<ClInclude Include="..\xrCommon\xr_unordered_map.h" />
180181
<ClInclude Include="..\xrCommon\xr_vector.h" />
181182
<ClInclude Include="Common.hpp" />
182183
<ClInclude Include="Compiler.inl" />

src/Common/Common.vcxproj.filters

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@
7979
<Filter>xrCommon</Filter>
8080
</ClInclude>
8181
<ClInclude Include="Common.hpp" />
82+
<ClInclude Include="..\xrCommon\xr_unordered_map.h">
83+
<Filter>xrCommon</Filter>
84+
</ClInclude>
8285
</ItemGroup>
8386
<ItemGroup>
8487
<Filter Include="NvMender2003">

src/xrCommon/xr_unordered_map.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#pragma once
2+
// XXX: upgrade std hash structures
3+
#ifndef _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS
4+
#define _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS
5+
#endif
6+
#include <hash_map>
7+
#include <unordered_map>
8+
#include "xrCore/Memory/XRayAllocator.hpp"
9+
10+
template <typename K, class V, class _Traits = stdext::hash_compare<K, std::less<K>>, typename allocator = XRay::xray_allocator<std::pair<K, V>>>
11+
using xr_hash_map = stdext::hash_map<K, V, _Traits, allocator>;
12+
13+
template<class Key, class T, class Hasher = std::hash<Key>, class KeyEqual = std::equal_to<Key>, class allocator = XRay::xray_allocator<std::pair<const Key, T>>>
14+
using xr_unordered_map = std::unordered_map<Key, T, Hasher, KeyEqual, allocator>;

src/xrCore/_stl_extensions.h

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,24 +18,13 @@
1818
#include "xrstring.h"
1919
#include "xrCommon/inlining_macros.h"
2020
#include "xrCommon/xr_string.h"
21+
#include "xrCommon/xr_unordered_map.h"
2122
#include "xrDebug_macros.h" // only for pragma todo. Remove once handled.
2223

2324
#pragma todo("tamlin: This header includes pretty much every std collection there are. Compiler-hog! FIX!")
2425

2526
using std::swap;
2627

27-
#ifndef _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS
28-
#define _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS
29-
#endif
30-
#include <hash_map>
31-
template <typename K, class V, class _Traits = stdext::hash_compare<K, std::less<K>>,
32-
typename allocator = XRay::xray_allocator<std::pair<K, V>>>
33-
class xr_hash_map : public stdext::hash_map<K, V, _Traits, allocator>
34-
{
35-
public:
36-
u32 size() const { return (u32) __super ::size(); }
37-
};
38-
3928
#include "xrCommon/predicates.h"
4029

4130
// tamlin: TODO (low priority, for a rainy day): Rename these macros from DEFINE_* to DECLARE_*

src/xrGame/xrServer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#include "secure_messaging.h"
1515
#include "xrServer_updates_compressor.h"
1616
#include "xrClientsPool.h"
17-
#include "xrCore/_stl_extensions.h" // xr_hash_map
17+
#include "xrCommon/xr_unordered_map.h"
1818

1919
#ifdef DEBUG
2020
//. #define SLOW_VERIFY_ENTITIES

src/xrScriptEngine/script_engine.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#include "xrScriptEngine/script_space_forward.hpp"
1414
#include "xrScriptEngine/Functor.hpp"
1515
#include "xrCore/Threading/Lock.hpp"
16-
#include "xrCore/_stl_extensions.h" // xr_hash_map
16+
#include "xrCommon/xr_unordered_map.h"
1717

1818
struct lua_State;
1919

0 commit comments

Comments
 (0)