> How would you do that without making the visitor cases explicit?
See my edit.
std::visit([](auto &&val) {
std::cout << typeIdxToString[typeid(val)] << val;
}, var);
> E.g. you would want the '+' operator to do different things for strings and numbers.Then overload the '+' operator, no need to put all that in the visitor lambda.