2
2
#define OSRM_UTIL_QUERY_HEAP_HPP
3
3
4
4
#include " util/pool_allocator.hpp"
5
+ #include < memory_resource>
5
6
#include < algorithm>
6
7
#include < boost/assert.hpp>
7
8
#include < boost/heap/d_ary_heap.hpp>
@@ -99,7 +100,7 @@ template <typename NodeID, typename Key> class MapStorage
99
100
template <typename NodeID, typename Key> class UnorderedMapStorage
100
101
{
101
102
public:
102
- explicit UnorderedMapStorage (std::size_t ) { nodes.rehash (1000 ); }
103
+ explicit UnorderedMapStorage (std::size_t ) : poolResource_(std::pmr::new_delete_resource()), nodes(&poolResource_) { nodes.rehash (1000 ); }
103
104
104
105
Key &operator [](const NodeID node) { return nodes[node]; }
105
106
@@ -122,9 +123,11 @@ template <typename NodeID, typename Key> class UnorderedMapStorage
122
123
void Clear () { nodes.clear (); }
123
124
124
125
private:
126
+ std::pmr::unsynchronized_pool_resource poolResource_;
127
+
125
128
template <typename K, typename V>
126
129
using UnorderedMap = std::
127
- unordered_map<K, V/* , std::hash<K>, std::equal_to<K>, PoolAllocator <std::pair<const K, V>>*/ >;
130
+ unordered_map<K, V, std::hash<K>, std::equal_to<K>, std::pmr::polymorphic_allocator <std::pair<const K, V>>>;
128
131
129
132
UnorderedMap<NodeID, Key> nodes;
130
133
};
0 commit comments