From f36d1d5b8934aac60d3097047ecedeb58bae2185 Mon Sep 17 00:00:00 2001 From: Jeffrey Czyz Date: Wed, 5 Jun 2019 15:54:11 -0700 Subject: Use void* throughout support/lockedpool.h Replace uses of char* with void* in Arena's member variables. Instead, cast to char* where needed in the implementation. Certain compiler environments disallow std::hash specializations to prevent hashing the pointer's value instead of the string contents. Thus, compilation fails when std::unordered_map is keyed by char*. Explicitly using void* is a workaround in such environments. For consistency, void* is used throughout all member variables similarly to the public interface. --- src/support/lockedpool.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/support/lockedpool.h') diff --git a/src/support/lockedpool.h b/src/support/lockedpool.h index b420c909fc..ce6fedc8e8 100644 --- a/src/support/lockedpool.h +++ b/src/support/lockedpool.h @@ -89,23 +89,23 @@ public: */ bool addressInArena(void *ptr) const { return ptr >= base && ptr < end; } private: - typedef std::multimap SizeToChunkSortedMap; + typedef std::multimap SizeToChunkSortedMap; /** Map to enable O(log(n)) best-fit allocation, as it's sorted by size */ SizeToChunkSortedMap size_to_free_chunk; - typedef std::unordered_map ChunkToSizeMap; + typedef std::unordered_map ChunkToSizeMap; /** Map from begin of free chunk to its node in size_to_free_chunk */ ChunkToSizeMap chunks_free; /** Map from end of free chunk to its node in size_to_free_chunk */ ChunkToSizeMap chunks_free_end; /** Map from begin of used chunk to its size */ - std::unordered_map chunks_used; + std::unordered_map chunks_used; /** Base address of arena */ - char* base; + void* base; /** End address of arena */ - char* end; + void* end; /** Minimum chunk alignment */ size_t alignment; }; -- cgit v1.2.3