As far as I know the build tool does not support templates on UCLASS, UPROPERTY, UFUNCTION etc. but you can have a template function which is not UFUNCTION within a normal UCLASS.
Also have to mark TMyDataStructure as USTRUCT.
Depends on what you need, but a workaround could be to create a base struct without this property and use it as a base class for structs which add the property of varying datatype.
TArray and TMap (for example) are templates and can be the type of a UPROPERTY, so there must be some way to do it. I’m sure they are getting special treatment via some mechanism from UBT etc. I’m just wondering what that mechanism is, and what are the steps to giving TMyDataStructure that special treatment too.
The UnrealHeaderTool code generator will not produce a thunk for this function; it is up to the user to provide one with the DECLARE_FUNCTION or DEFINE_FUNCTION macros.
In the reflection system these containers have specific FProperty implementations : FArrayProperty and FMapProperty.
In the editor code, graph pins have hardcoded support for those container types :
And finally as Seda pointed out, the blueprint nodes to handle these types use CustomThunk specifier to handle them as wildcard types. This part can be done with pretty much anything and is pretty much the only part you can realistically do. Here’s some good example for that.