Add `cuda::std::variant`, `cuda::std::visit`, and `cuda::std::monostate`
It would be helpful to have discriminated union functionality, equivalent to C++17 standard std::variant, std::visit, std::monostate, but available in device code.
See a nice summary of that functionality, for example, in "C++17, The Complete Guide", by N. Josuttis, 2019, Chapter 16.
@brycelelbach I second the request for std::variant and friends in device code, or equivalent functionality with a similar API. This comes up commonly in some of the DOE multiphysics simulation codes where they want to represent multiple variants of some physics, such as an equation of state or radiation opacity for different materials in a simulation domain. singularity-eos and singularity-opac are examples from Los Alamos National Lab that use this today, and the ECP ExaStar project would use it for a similar approach if it were available. This also comes up in the context of having multiple kinds of solvers, for example variants on ODE solvers or root finding routines, or picking higher or lower resolution versions of a given algorithm.
Tentatively scheduled for 2.1.0, but don't be surprised if that gets pushed back.
@griwes Are you working on a cuda::variant? Can I assign this to you?
I'm going to do that myself for this and optional.