I am trying to create a TArray
of my own data-type APlaying_Card
. I get an error Cannot access private member in class APlaying_Card
.
In the Unreal documentation for TArray it states:
A dynamically sized array of typed elements. Makes the assumption that your elements are relocate-able;
i.e. that they can be transparently moved to new memory without a copy constructor.
The main implication is that pointers to elements in the TArray may be invalidated by adding or removing other
elements to the array. Removal of elements is O(N) and invalidates the indices of subsequent elements.
Caution: as noted below some methods are not safe for element types that require constructors.
There are two things I don't fully understand. First is the 'relocate-able' part, what does it mean to ensure it can be moved without a copy constructor and how is this done? Secondly, regarding the final statement in their remarks, How can I safely make an array of my own objects, if they do require a constructor?
As always thank you for your help.