How to create an instance of UStruct according to UScriptStruct

In a function, given a ustruct type or a UScriptStruct, how can I create an instance of a specific UStruct

For example, I have FBaseStruct and FDerivedStructA, can I somehow create an instance like below:

void func_A(USctiptStruct* structType)
{
    FBaseStruct* structPtr = new ??? /*info in structType*/;
}

I know NewObject() can be used to create an instance of a derived UClass, but I can’t use this method for UStruct.

You just need to set the parameters of the struct,.

FBaseStruct myStruct;

myStruct.field1 = structType.field1; 
myStruct.field2 = structType.field2;

alternatively you can do:

FBaseStruct myStruct{structType.field1,structType.field2 };