Roderick Gibson:
auto entities = new Entities();
auto entity_id = entities.createEntity();
entities.addComponent!(position)(entity_id, pos);
entities.addComponent!(movement)(entity_id, mov);
entities.addComponent!(collision)(entity_id, col);
auto physics_data =
entities.getEntitiesWithComponents!(position, movement,
collision)();
The two big requirements are some kind of regular, queryable
structure to hold the components (of different types), and the
ability to filter by type. Is anything like that remotely
possible?
If the possible types are know, then there's
std.variant.Algebraic, otherwise there is a free Variant or
VariantN. They are not perfect, but maybe they are good enough
for you.
Bye,
bearophile