[C++]How To Save Array Of Structs

How to define the “Save”?
I know the blueprintNode SaveToSlot,the derived class of the SaveGameBP will as a .sav file on your hard drive,the path is /ProjectName/Saved/SaveGames/.
I know the C++ method,it can record the member variables of blueprint and then you can restore these member variables,its complete process is the following.

//it’s a general process,don’t panic…
struct Archive_TypeA : public FObjectAndNameAsStringProxyArchive
{
//it’s a kind of design,don’t panic,they call it C++ API Wrapper mode,
Archive_TypeA(FArchive& HaHa):FObjectAndNameAsStringProxyArchive(HaHa,true){

//ArIsSaveGame is not defined by me,it’s by source,why I can operate this variable?because Archive_TypeA inherits the FObjectAndNameAsStringProxyArchive.
//If you set this boolean as true,only those member variables whose boolean variable called SaveGame is checked will be considered for serialization.
ArIsSaveGame=true;

}
//complete the above,the following is simple.

//you need a derived class object ptr of UObject,that’s object you want to record,you can pass it in as a parameter.
//ptr is pointer,about pointer you can look this web Function Pointer in C++ - GeeksforGeeks
//NR is the abbreviation for Need To Be Recorded
UObject* Object_NTBR;

}

//The following is record data,you can encapsulate them as a function named “RecordData()”

//the data recorded in this,but what makes me feel curious is that the length of this array is always 0.
TArray Array_Uint8;
FMemoryWriter MW(Array_Uint8);
FArchive_TypeA Ar(MW);
Object_NTBR->Serialize(Ar);
//After serialization by MW Array_Uint8 has data,but its length is 0,I can not understand it.
//why I emphasize MW(MemoryWriter)?you can understand its impact by comparing MW(MemoryWriter) and MR(MemoryReader).

//The following is apply data to Blueprint,you can encapsulate them as a function named"ApplyData()"

//MR
FMemoryReader MR(Array_Uint8);
FArchive_TypeA Ar(MR);
//NTBA is the abbreviation for Need to be apply data,it is a parameter,it’s a pointer,it’s your Blueprint reference to self.
Object_NTBA->Serialize(Ar);

//how to test the above code?you can test them via UserWidget,press 1 key .
//1.write the above code in a derived class of USaveGame,because USaveGame can be as .sav file in hard drive(BlueprintNode is saveGameToSlot and loadGameFromSlot),its enduring premise is hard drive,as long as the hard drive is not destroyed,it always exist.
//2.Distinguish the enduringAbility of USaveGame and the recordAbility of Serialize().
//3.UPROPERTY() must be written before the member variable in USaveGameClass otherwise this variable will not be save to .sav file.
//4.you definitely need record multiple object,declare a TArray Array_OR in derived class of USaveGame,at the beginning,FObjectRecorder only need a memberVariable called ClassFName,however,if you want to record multiple objects of the same class,you need define extra FName to distinguish them,if you do not understand the meaning of Array_OR,I believe you will understand it.
//5.if you want achieve multiple archives,you can define 2 derived classes of USaveGame,the first class named SG_TypeA,it stores all slotNames(You can use membership policy,Think of SG_TypeA as a platinum membership registration form),the second class named SG_TypeB,it represent a archive,so we has
//6.I am not rich,@reanadore is my Twitter,you can access me and give me some money for food,thanks for watching,stay awesome,sign out.