
class Node2D : public CanvasItem {
...
}
.
.
.
class PhysicsBody2D : public CollisionObject2D {
...
}
class CharacterBody2D : public PhysicsBody2D {
...
}
class Component;
class Entity {
//...
private:
std::unordered_map<std::type_info, Component*> m_components;
}

Code in Unreal’s AActor class5:
/**
* All ActorComponents owned by this Actor. Stored as a Set as actors may have a large number of components
* @see GetComponents()
*/
TSet<TObjectPtr<UActorComponent>> OwnedComponents;
/**
* Get all components derived from class 'ComponentType' and fill in the OutComponents array with the result.
* It's recommended to use TArrays with a TInlineAllocator to potentially avoid memory allocation costs.
* TInlineComponentArray is defined to make this easier, for example:
* {
* TInlineComponentArray<UPrimitiveComponent*> PrimComponents(Actor);
* }
*
* @param bIncludeFromChildActors If true then recurse in to ChildActor components and find components of the appropriate type in those Actors as well
*/
template<class ComponentType, class AllocatorType>
void GetComponents(TArray<ComponentType, AllocatorType>& OutComponents, bool bIncludeFromChildActors = false) const
{
typedef TPointedToType<ComponentType> T;
OutComponents.Reset();
ForEachComponent_Internal<T>(T::StaticClass(), bIncludeFromChildActors, [&](T* InComp)
{
OutComponents.Add(InComp);
});
}




One thing known to most is that EnTT is also used in Minecraft. Given that the game is available literally everywhere, I can confidently say that the library has been sufficiently tested on every platform that can come to mind.
| CPU | L1 | L2 | L3 |
|---|---|---|---|
| Pentium N4200 | 96 KiB | 128 KiB | 2 MiB |
| i7 14700HX | 1800 KB | 28 MB | 33 MB |
//one possibility
typedef uint_32t UID;
typedef UID Entity;
A std::flat_map is a fitting datatype.
| GCC libstdc++ | Clang libc++ | MSVC STL |
|---|---|---|
| not implemented | partially implemented | not implemented |
class ComponentManager{
template<typename comp_type> requires std::is_base_of<Component, comp_type>
foreachComponent(std::function func){
//...
}
template<typename comp_type> requires std::is_base_of<Component, comp_type>
addComponentToEntity(Entity entity){
//...
}
//some type of ComponentMap store
}
template <typename component_type>
class ComponentMap
std::vector<component_type> m_values;
std::unordered_map<Entity, size_type> m_mapping;

https://br.ign.com/league-of-legends-wild-rift/89123/feature/wild-rift-tudo-sobre-o-lol-mobile ; Image: Riot Games ↩︎
https://pressakey.com/gameinfos,4981,screenshots,,,Age-of-Empires-Definitive-Edition,.html ↩︎
Screenshot: Godot Engine ↩︎
Engine/Source/Runtime/Engine/Classes/GameFramework/Actor.h ↩︎
https://docs.unity3d.com/6000.0/Documentation/Manual/UsingTheInspector.html ↩︎
https://en.cppreference.com/w/cpp/compiler_support/23 ↩︎