<commit_before>#pragma once
#include <Zmey/Memory/MemoryManagement.h>

namespace Zmey
{

struct EntityId
{
	EntityId(const EntityId&) = default;
	EntityId& operator=(const EntityId&) = default;
	using IndexType = uint32_t;
private:
	EntityId(uint32_t index, uint16_t generation)
		: Index(index)
		, Generation(generation)
		, UnusedBits(0)
	{}
	const uint32_t Index;
	const uint16_t Generation;
	const uint16_t UnusedBits;
	friend class EntityManager;
};

// TODO To be replaced by something loaded from the resource loader
using EntityDescription = void*;
class EntityManager
{
public:
	EntityId Spawn(const EntityDescription&);
	void Destroy(EntityId);
	bool IsAlive(EntityId);
private:
	stl::vector<uint16_t> m_Generation;
	stl::queue<uint_fast32_t> m_FreeIndices;
};

}<commit_msg>Added operator== and hash for EntityId.<commit_after>#pragma once
#include <Zmey/Memory/MemoryManagement.h>

namespace Zmey
{

struct EntityId
{
	EntityId(const EntityId&) = default;
	EntityId& operator=(const EntityId&) = default;
	using IndexType = uint32_t;

	friend bool operator==(const EntityId& lhs, const EntityId& rhs)
	{
		return std::memcmp(&lhs, &rhs, sizeof(EntityId)) == 0;
	}
private:
	EntityId(uint32_t index, uint16_t generation)
		: Index(index)
		, Generation(generation)
		, UnusedBits(0)
	{}
	const uint32_t Index;
	const uint16_t Generation;
	const uint16_t UnusedBits;
	friend class EntityManager;
};

// TODO To be replaced by something loaded from the resource loader
using EntityDescription = void*;
class EntityManager
{
public:
	EntityId Spawn(const EntityDescription&);
	void Destroy(EntityId);
	bool IsAlive(EntityId);
private:
	stl::vector<uint16_t> m_Generation;
	stl::queue<uint_fast32_t> m_FreeIndices;
};

}

namespace std
{
template<>
struct hash<Zmey::EntityId>
{
inline std::size_t operator()(const Zmey::EntityId& id) const
{
	return *reinterpret_cast<const size_t*>(&id);
}
};

}
{'fraction_non_alphanumeric': 0.11076115485564304, 'fraction_numerical': 0.01837270341207349, 'mean_word_length': 6.007352941176471, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2201405', 'n_tokens_mistral': 688, 'n_tokens_neox': 662, 'n_words': 166}