Constructing a union tuple in C++11

Viewed 1474

Tuples are kind of like structs. Are there also tuples that behave like unions? Or unions where I can access the members like in tuples, e.g.

my_union_tuple<int, char> u;
get<1>(u);
get<int>(u); // C++14 only, or see below

For the 2nd line, see here.

Of course, the solution should not only work for a specific union, like <int, char>, but for arbitrary types and number of types.

1 Answers
Related