UnorderedSet.h 792 B

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