News for hackers. Stuff that matters.
Re:Why Rust? by HarHarVeryFunny on Wednesday October 19, 2022 @07:30AM (#33260577)
Of course the Rust features being used by that Event type are runtime polymorphism and type introspection, so another obvious C++ approach would be just to use a pointer to a virtual based class including the type, then:

switch (event->type) {

case EvKeyPressEvent:

  {

    auto kpe - dynamic_cast<KeyPressEvent*>(event)

    ...

  }

  break;

}

There are no comments on this comment yet.