diff --git a/include/util/pool_allocator.hpp b/include/util/pool_allocator.hpp index f082b7782a..6093f6ee7e 100644 --- a/include/util/pool_allocator.hpp +++ b/include/util/pool_allocator.hpp @@ -130,13 +130,6 @@ class PoolAllocator PoolAllocator &operator=(const PoolAllocator &) = default; PoolAllocator(PoolAllocator &&) noexcept = default; PoolAllocator &operator=(PoolAllocator &&) noexcept = default; - -private: - static size_t get_next_power_of_two_exponent(size_t n) - { - BOOST_ASSERT(n > 0); - return (sizeof(size_t) * 8) - std::countl_zero(n - 1); - } }; template diff --git a/include/util/query_heap.hpp b/include/util/query_heap.hpp index 6f9ef54e1c..db22e800b8 100644 --- a/include/util/query_heap.hpp +++ b/include/util/query_heap.hpp @@ -2,6 +2,7 @@ #define OSRM_UTIL_QUERY_HEAP_HPP #include "util/pool_allocator.hpp" +#include #include #include #include @@ -99,7 +100,7 @@ template class MapStorage template class UnorderedMapStorage { public: - explicit UnorderedMapStorage(std::size_t) { nodes.rehash(1000); } + explicit UnorderedMapStorage(std::size_t) : poolResource_(std::pmr::new_delete_resource()), nodes(&poolResource_) { nodes.rehash(1000); } Key &operator[](const NodeID node) { return nodes[node]; } @@ -122,9 +123,11 @@ template class UnorderedMapStorage void Clear() { nodes.clear(); } private: + std::pmr::unsynchronized_pool_resource poolResource_; + template using UnorderedMap = std:: - unordered_map, std::equal_to, PoolAllocator>*/>; + unordered_map, std::equal_to, std::pmr::polymorphic_allocator>>; UnorderedMap nodes; };