How do you check if a variant has value at compile time ?
A std::variant almost always has a value when in scope. The only time it does not is when an exception is thrown during an assignment. The type of the contained value is not necessarily available at compile time, however. Since it implements a tagged union, the underlying type can change depending on the path through the code. If you need compile-time variant types, you are better off writing custom template code.