c++ - When would anyone use a union? Is it basically a remnant from the C only days? - Stack Overflo
Unions are usually used with the company of a discriminator: a variable indicating which of the fields of the union is valid. For example, let's say you want to create your own Variant type: struct my_variant_t { int type; union { char char_value; short ....