Re:Flecs – A fast entity component system for C and C++
by nyanpasu64 on Tuesday April 04, 2023 @02:42AM
(#35435943)
One trick I found is to gate mutable access to state behind a "transaction object" which sets a flag for each object mutated, then once the transaction object's destructor is called, recomputes all derived state based on which flags were set. Using a destructor might not be the best idea since I ended up not marking it noexcept, it may be better to add an explicit "recompute" function called at the end, but this breaks the convenience of `state().cursor_mut() = new_cursor;` automatically recomputing derived state once the state() object is destroyed.
[ Parent
| on HN ]
There are no comments on this comment yet.