Hi,
I have struct with TUnion:
struct ItemAttribute {
TUnion<int, float> Value;
};
And overload of operator<<
FORCEINLINE FArchive& operator<< (FArchive& Ar, ItemAttribute& wi) {
TArray<uint8> attrsToSave = {
0, // Attribute Value
};
Ar << attrsToSave;
for(uint8 attrID : attrsToSave) {
switch(attrID) {
case 0:
Ar << wi.Value;
break;
}
}
return Ar;
}
When i try to compile project I get this error:
Error C2679 binary '<<': no operator found which takes a right-hand operand of type 'FNull' (or there is no acceptable conversion)
If I replace TUnion<int, float> Value;
with TUnion<int, float, double, FString, FVector, FText> Value;
then everythings works fine. But I don’t need more than two variables now.