Il2CppHashSet.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #pragma once
  2. #include "../../external/google/sparsehash/dense_hash_set.h"
  3. #include "KeyWrapper.h"
  4. template<class Value,
  5. class HashFcn,
  6. class EqualKey = std::equal_to<Value>,
  7. class Alloc = std::allocator<KeyWrapper<Value> > >
  8. class Il2CppHashSet : public dense_hash_set<KeyWrapper<Value>, HashFcn, typename KeyWrapper<Value>::template EqualsComparer<EqualKey>, Alloc>
  9. {
  10. private:
  11. typedef dense_hash_set<KeyWrapper<Value>, HashFcn, typename KeyWrapper<Value>::template EqualsComparer<EqualKey>, Alloc> Base;
  12. public:
  13. typedef typename Base::size_type size_type;
  14. typedef typename Base::hasher hasher;
  15. typedef typename Base::key_equal key_equal;
  16. typedef typename Base::key_type key_type;
  17. explicit Il2CppHashSet(size_type n = 0,
  18. const hasher& hf = hasher(),
  19. const EqualKey& eql = EqualKey()) :
  20. Base(n, hf, key_equal(eql))
  21. {
  22. Base::set_empty_key(key_type(key_type::KeyType_Empty));
  23. Base::set_deleted_key(key_type(key_type::KeyType_Deleted));
  24. }
  25. template<class InputIterator>
  26. Il2CppHashSet(InputIterator f, InputIterator l,
  27. size_type n = 0,
  28. const hasher& hf = hasher(),
  29. const EqualKey& eql = EqualKey()) :
  30. Base(f, l, n, hf, key_equal(eql))
  31. {
  32. Base::set_empty_key(key_type(key_type::KeyType_Empty));
  33. Base::set_deleted_key(key_type(key_type::KeyType_Deleted));
  34. }
  35. };