Std::visit is everything wrong with modern C++
I agree completely with everything in this article. But in addition, I think std::variant also misses the point of sum types in a big way.<p>Sum types don't just store values of different types. They store different states, with associated data. So, for instance, consider the following simplistic expression AST; how would you store it in a std::variant?<p><pre><code>    enum Expr {
        Number(usize),
        Negate(Expr),
        Add(Expr, Expr),
        Sub(Expr, Expr),
        Let(String, Expr, Expr),
        Var(String),
    }</code></pre>