2d-platformer/Engine-Core/include/Entities/EntityView.h

43 lines
743 B
C++

#pragma once
#include <utility.h>
class EntityManager;
class EntityMemoryPool;
class Entity;
class EntityView
{
private:
friend class EntityManager;
friend class EntityMemoryPool;
EntityView() = delete;
EntityView(index_t, index_t);
public:
class iterator
{
public:
iterator(index_t);
iterator& operator++();
iterator operator++(int);
iterator& operator--();
iterator operator--(int);
Entity operator*();
Entity operator[](int);
bool operator==(iterator);
bool operator!=(iterator);
private:
index_t m_currentEntity;
};
Entity operator[](index_t) const;
iterator begin() { return iterator(m_start); }
iterator end() { return iterator(m_start + m_size); }
private:
index_t m_start;
index_t m_size;
};