Parsing unions in c++ can be error prone, in the sense there's no compile time guarantee to handle all cases unless using some combination of the enum and corresponding x_as_y.
A more modern alternative is to use std::variants and std::visit, however flatc is not producing the required variants, or any means to convert to such (afaik).
... is this something that was ever discussed?