I used integers only to keep the example simple.
In reality I have a few structs with trivial copy-assignment operator and trivial destructor that I make members of the variant. variant lets me use static visitors.
If I use my own union with switch statements instead of variant with static visitors, when I add a new type to the union, I may forget to update some switch statement but with static visitors I'll get a compiler error if I forget to update any static visitor.
The code may be simpler in some sense if I use a union but it's safer and more maintainable if I use a variant, especially if I would have to maintain many switch statements.
I could implement my own static visitor mechanism just for this union-ish type but that seems like reinventing the wheel.
So, it would be convenient if I could use boost::lock_free::queue<variant<...>> on my structs, although I have barely any idea on the implementation complexity required.