by mFixman · 9mo ago · 0 comments
Still, it's a wasted opportunity not to have a language-level overload to the `switch` statement that allows nice pattern matching. Even with std::is_within_lifetime C++ unions are prone to errors and hard to work with.
std::variant<int, std::string, bool>
Which is a sum of those three types.[1] https://doc.rust-lang.org/book/ch06-01-defining-an-enum.html