Best way to store inventory items in c++

Hello,
Currently I have my inventory class, which is simply a uobject that the player has assigned to him. I also have my pickupitem actor class which then has sub classes for weapons, clothing etc. My goal is to create some sort of list of that holds all of these items. My first thought was a Tarray, seems like it would be simple enough to create a method to organize and swap out items in order to hold them/drop them. Of course I am not sure if it is the best way to store the data. I know there is plenty of tutorials on how to do this in blueprints, but I try and avoid those like the plauge (besides for gui). If someone could help me out, that would be great. Thanks

TArray will work fine. Just make a TArray of PickUpItem classes and add them as you get them. You may even consider making a 2D array so that it’s easier to keep track of different types of items, i.e. Inventory[1] holds weapons, [2] armor, etc etc. Depending on what exactly your goal is, you’ll likely have to do more than that, but starting with TArray as a base should be fine.

As an aside, I currently use this to good effect in my current project.

Thanks for the info, good to know