Design patterns 在游戏开发中,是否有一种设计模式可以迭代SoA集合中相同类型的所有数组?

Design patterns 在游戏开发中,是否有一种设计模式可以迭代SoA集合中相同类型的所有数组?,design-patterns,game-engine,game-development,data-oriented-design,Design Patterns,Game Engine,Game Development,Data Oriented Design,我有N个数组结构: PlayerTable: ids, velocities, positions, animations, healths ... EnemyTable: ids, velocities, positions, animations, AIs ... BulletTables: ids, velocities, positions, animations, ranges ... ... other N-3 soas applyVelocities: [read] veloci

我有N个数组结构:

PlayerTable: ids, velocities, positions, animations, healths ...
EnemyTable: ids, velocities, positions, animations, AIs ...
BulletTables: ids, velocities, positions, animations, ranges ...
... other N-3 soas
applyVelocities: [read] velocities, [write] positions
updateAnimations: [write] animations
drawEntities: [read] animations, [read] positions
... other M-3 procedures
我有M个更新这些数组结构的过程:

PlayerTable: ids, velocities, positions, animations, healths ...
EnemyTable: ids, velocities, positions, animations, AIs ...
BulletTables: ids, velocities, positions, animations, ranges ...
... other N-3 soas
applyVelocities: [read] velocities, [write] positions
updateAnimations: [write] animations
drawEntities: [read] animations, [read] positions
... other M-3 procedures
是否有一种设计模式可以迭代SoA集合中相同类型的所有数组

我可以考虑编写一个模板函数,并使用这些属性为数组的每个结构调用它。是这样吗?这通常能很好地扩展吗