Say at run-time I establish some events with occurrence times. Now I have certain entities in the system and I need to establish which entities were impacted by these events.
So as an example say that I have:
- Entity1 intialized at time 1
- EventRed occurs at time 3
- Entity2 initialized at time 8
- EventBlue occurs at time 9
- EventYellow occurs at time 11
- Entity3 initialized at time 13
This should result in:
- Entity1 is white
- Entity2 is green
- Entity3 is black
I want a case
-like control structure to do this which supports fall through and who's cases are evaluated as "greater than or equal to this value". I'd like syntax like this:
for(auto& i : Entity) {
?switch(i.GetInitializedTime()) {
?case(Red.GetOccuranceTime()):
i.AddRed();
?case(Blue.GetOccranceTime()):
i.AddBlue();
?case(Yellow.GetOccuranceTime()):
i.AddYellow();
}
}
Is there a control structure like this or do I have to juggle all the if statements?