variant in C++
The class template std::variant represents a type-safe union. An instance of std::variant at any given time either holds a value of one of its alternative types, or in the case of error - no value ``` #include <variant> #include <iostream> using namespace std; int main() { variant<int, double, char> v; v=1.1; cout << v.index(); } // 1 ```