| 1 | // Jolt Physics Library (https://github.com/jrouwe/JoltPhysics) |
| 2 | // SPDX-FileCopyrightText: 2024 Jorrit Rouwe |
| 3 | // SPDX-License-Identifier: MIT |
| 4 | |
| 5 | #pragma once |
| 6 | |
| 7 | #include <Jolt/Core/HashTable.h> |
| 8 | |
| 9 | JPH_NAMESPACE_BEGIN |
| 10 | |
| 11 | /// Internal helper class to provide context for UnorderedSet |
| 12 | template <class Key> |
| 13 | class UnorderedSetDetail |
| 14 | { |
| 15 | public: |
| 16 | /// The key is the key, just return it |
| 17 | static const Key & sGetKey(const Key &inKey) |
| 18 | { |
| 19 | return inKey; |
| 20 | } |
| 21 | }; |
| 22 | |
| 23 | /// Hash Set class |
| 24 | /// @tparam Key Key type |
| 25 | /// @tparam Hash Hash function (note should be 64-bits) |
| 26 | /// @tparam KeyEqual Equality comparison function |
| 27 | template <class Key, class Hash = JPH::Hash<Key>, class KeyEqual = std::equal_to<Key>> |
| 28 | class UnorderedSet : public HashTable<Key, Key, UnorderedSetDetail<Key>, Hash, KeyEqual> |
| 29 | { |
| 30 | }; |
| 31 | |
| 32 | JPH_NAMESPACE_END |