From cc2f44408d8fabf7843b731205d5ccf90de0664c Mon Sep 17 00:00:00 2001 From: Dominik Drexler Date: Wed, 6 Mar 2024 19:31:51 +0100 Subject: [PATCH] update unorderedset --- .../flatmemory/details/containers/unordered_set.hpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/include/flatmemory/details/containers/unordered_set.hpp b/include/flatmemory/details/containers/unordered_set.hpp index fc5235c..8c7c430 100644 --- a/include/flatmemory/details/containers/unordered_set.hpp +++ b/include/flatmemory/details/containers/unordered_set.hpp @@ -17,14 +17,14 @@ namespace flatmemory { template struct CustomHash { - size_t operator()(const T& element) const { + size_t operator()(const ConstView& element) const { return element.hash(); } }; template struct CustomEqual { - bool operator()(const T& left_element, const T& right_element) const { + bool operator()(const ConstView& left_element, const ConstView& right_element) const { return left_element == right_element; } }; @@ -34,7 +34,7 @@ struct CustomEqual { * but without the functionality to erase elements * since m_storage would keep growing. */ -template +template, typename Equal = CustomEqual> class UnorderedSet { private: @@ -42,10 +42,10 @@ class UnorderedSet ByteBufferSegmented m_storage; // Data to be accessed - std::unordered_set, CustomHash>, CustomEqual>> m_data; + std::unordered_set, Hash, Equal> m_data; - using iterator = std::unordered_set>::iterator; - using const_iterator = std::unordered_set>::const_iterator; + using iterator = std::unordered_set, Hash, Equal>::iterator; + using const_iterator = std::unordered_set, Hash, Equal>::const_iterator; public: explicit UnorderedSet(NumBytes n = 1000000)