TrustedUser
2,147
edits
m (Text replacement - "<source lang=" to "<syntaxhighlight lang=") |
|||
Line 100: | Line 100: | ||
is valid for which event type. Implementation wise, we might want to use | is valid for which event type. Implementation wise, we might want to use | ||
the classic union-of-structs trick. It goes roughly like this: | the classic union-of-structs trick. It goes roughly like this: | ||
< | <syntaxhighlight lang="cpp"> | ||
struct BasicEvent { | struct BasicEvent { | ||
EventType type; | EventType type; | ||
Line 132: | Line 132: | ||
casting in code using events. The passing around of pointers could be | casting in code using events. The passing around of pointers could be | ||
mitigated by using | mitigated by using | ||
< | <syntaxhighlight lang="cpp"> | ||
typedef Common::SharedPtr<BasicEvent> Event | typedef Common::SharedPtr<BasicEvent> Event | ||
</source> | </source> |