Iterator/pseudo-container Library
Summary
A small iterator library. Mostly wrapper around concrete iterators to be able to skip some component based on certain conditions, or to iterate over several components at the same time (e.g. zip)
Motivation
Whenever a system needs to iterate over it's list of components, it has to iterate over each arrays of components manually. However, some system may need to iterate over several components at the same time, then check that some precondition holds true before doing any work (e.g. check that the entity has several components at the same time, or that at least one of these component is present).
State of the art
N/A
Drawbacks
I can't see why ATM. Some benchmarks might be needed.
Rationale and alternatives
N/A
Minimal implementation
Code example
void system(registry &r) {
zipper z = {r.get<Cmp1>(), r.get<Cmp2>())
//ranged-based for
for (auto &[c1, c2] : z) {
[...]
}
//std::algorithm
for_each(z.begin(), z.end(), [](component_t<Cmp1> &c1, component_t<Cmp2> &c2)
}
Iterator/pseudo-container Library
Summary
A small iterator library. Mostly wrapper around concrete iterators to be able to skip some component based on certain conditions, or to iterate over several components at the same time (e.g. zip)
Motivation
Whenever a system needs to iterate over it's list of components, it has to iterate over each arrays of components manually. However, some system may need to iterate over several components at the same time, then check that some precondition holds true before doing any work (e.g. check that the entity has several components at the same time, or that at least one of these component is present).
State of the art
N/A
Drawbacks
I can't see why ATM. Some benchmarks might be needed.
Rationale and alternatives
N/A
Minimal implementation
Code example