Download

Nesting TArray's inside TSharedRef

Is it possible to best a TArray inside a TSharedRef?

Something similar to

TArray<int32> Variable;
TSharedRef<Test> MySharedRef[Variable] = Test;

Where I’d then be able to reference a dynamic TSharedRef via a TArray like

MySharedRef[1]
(results #1 TSharedRef instead of int)

???
can’t figure it out
The only similar post I’ve found is here
https://answers.unrealengine.com/questions/199160/how-to-properly-use-slistview-with-a-tarray-of-str.html

and I’m not able to get that to work with what I’m attempting neither

help is much appreciated!

TSharedRef<TArray<int32>> ?

Your post makes almost no sense, so it’s not clear what you are trying to achieve.

TSharedRef<TArray<STextBox>> TextBox;
TextBox[1] = SNew(STextBox);
TextBox[2] = SNew(STextBox);

Something like this but it has compilation issues

you are doing it the wrong way.
The array should have tsharedref inside of it.
TArray<TSharedRef<STextBox>> TextBoxes

now you can actually do:
TSharedRef<STextBox> mytextbox = SNew(…);
TextBoxes.Add(mytextbox);

TSharedRef<STextBox> mySecondTextbox = SNew(…);
TextBoxes.Add(mySecondTextbox);

Then you can access it through TextBoxes[0], and TextBoxes[1] respectively.

You should actually read a tutorial on C++ (since I saw your other post too, and you are a bit confused about arrays)

Also, another mistake you are doing is trying to access the FIRST value of an ARRAY using 1.
The first value is accessed with a zero index: myArray[0]! Indexes start from 0…