As the name implies, you can implement them yourself in C/C++. It basically consists of three things: an enum that lists out the constructors (Type1, Type2, and Type 3, in OP's example); a union over the types being summed (String, u32, and unit); and a struct containing the enum and the union. You then switch the enum to figure out what the underlying type is, and access the associated union case to get the data.
This is why they're called tagged unions or discriminated unions.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
As the name implies, you can implement them yourself in C/C++. It basically consists of three things: an enum that lists out the constructors (Type1, Type2, and Type 3, in OP's example); a union over the types being summed (String, u32, and unit); and a struct containing the enum and the union. You then switch the enum to figure out what the underlying type is, and access the associated union case to get the data.
This is why they're called tagged unions or discriminated unions.