|
|
|
|
|
by HarHarVeryFunny
1345 days ago
|
|
OK, that's an interesting language feature, but I can't say it's something that I've often wanted to do in C++. Of course C++ does have std::variant and std::any, although I'm not really a fan. I'd tend to (and have) just use a class that contains the variants and an enum to track which one, then setters and getters. event.SetKeyPress(ch); event.SetMouseButtonPress(pos, but);
etc ... switch (event.type) { case EvKeyPress: ch = event.GetKeyPress(); |
|
switch (event->type) {
case EvKeyPressEvent: