Files
Project-Reboot-3.0/Project Reboot 3.0/Set.h
2023-03-05 01:03:51 -05:00

45 lines
1.0 KiB
C++

#pragma once
#include "SparseArray.h"
template <typename ElementType>
class TSetElement
{
public:
ElementType Value;
mutable int32 HashNextId;
mutable int32 HashIndex;
TSetElement(ElementType InValue, int32 InHashNextId, int32 InHashIndex)
: Value(InValue)
, HashNextId(InHashNextId)
, HashIndex(InHashIndex)
{
}
FORCEINLINE TSetElement<ElementType>& operator=(const TSetElement<ElementType>& Other)
{
Value = Other.Value;
}
FORCEINLINE bool operator==(const TSetElement& Other) const
{
return Value == Other.Value;
}
FORCEINLINE bool operator!=(const TSetElement& Other) const
{
return Value != Other.Value;
}
};
template<typename InElementType> //, typename KeyFuncs, typename Allocator>
class TSet
{
typedef TSetElement<InElementType> ElementType;
typedef TSparseArrayElementOrListLink<ElementType> ArrayElementType;
TSparseArray<ElementType> Elements;
mutable TInlineAllocator<1>::ForElementType<int> Hash;
mutable int32 HashSize;
};