<cuda/std/variant>#
2026-10-07
1 min read time
Applies to Linux and Windows
This page documents cuda::std::variant in libhipcxx, a type-safe union that holds one of a set of types, available from C++14 onwards with constexpr support.
See the documentation of the standard header <variant>
Extensions#
All features are available from C++14 onwards.
All features are available at compile time if the different value types support it.
Restrictions#
On device no exceptions are thrown in case of a bad access.
Implementation notes#
cuda::std::visit uses recursion instead of the usual array of function pointers. This improves runtime behavior
at the cost of longer compile times.