42#ifndef RTYPE_SPARSEARRAY_HPP_
43 #define RTYPE_SPARSEARRAY_HPP_
100 static constexpr std::size_t NullIndex =
101 std::numeric_limits<size_t>::max();
127 void clear(
void) noexcept override final;
137 template <typename Self>
139 auto &&operator[](this Self &self,
Entity entity) noexcept;
148 template <typename... Args>
149 T &emplace(
Entity entity, Args &&...args);
155#if defined(__GNUC__) || defined(__clang__)
157 template <
typename Self>
159 auto data(
this Self &&self)
noexcept;
166 std::span<const T> data() const noexcept;
173#if defined(__GNUC__) || defined(__clang__)
175 template <
typename Self>
177 auto entities(
this Self &&self)
noexcept;
192 std::size_t
size(
void)
const noexcept;
Assertion and verification macros for runtime checks.
Concepts for validating component types in the ECS.
Entity identifier for ECS architecture.
Represents an entity in the ECS (Entity-Component-System) architecture.
Type-erased base interface for sparse arrays.
virtual ~ISparseArray() noexcept=default
virtual bool has(Entity entity) const =0
Check if an entity has a component.
virtual void erase(Entity entity)=0
Remove a component from an entity.
virtual void clear(void)=0
Remove all components.
Sparse array container for component storage.
std::vector< size_t > _sparse
The Sparse Array (The Map)
std::span< Entity > entities() noexcept
Get the entity array corresponding to components.
std::vector< Entity > _dense
The Dense Entity Array (The Reverse Lookup)
std::span< T > data() noexcept
Get the underlying dense component array.
SparseArray(const SparseArray &)=default
container_t _data
The Dense Component Array (The Cache Friendly Data)
std::vector< value_type > container_t
std::size_t size(void) const noexcept
Get the number of components stored.
bool empty(void) const noexcept
Check if the array is empty.
SparseArray(SparseArray &&) noexcept=default
Concept for valid ECS component types.
File : RenderSystem.hpp License: MIT Author : Elias Josué HAJJAR LLAUQUEN elias-josue....