logoalt Hacker News

foldr • today at 2:57 PM • 1 reply • view on HN

C++ still doesn't have a sane modern pattern for tagged unions. If you want to define a type to represent, say, a simple parse tree, then Rust makes that easy and obvious, whereas C++ offers you a hundred options, all of which suck.


Replies

sltkr • today at 5:26 PM

Isn't the obvious choice std::variant<>?

It is kind of annoying to use, but at least there is an obvious default choice.

➕ show 1 reply