I keep getting the same compile error in multiple places when trying to copy TSharedPtr’s around. That error being of the form:
Error 1 error C2440: 'initializing' : cannot convert from 'NonexpirableStatModValue *const ' to 'Stats::NonexpirableStatModValue *'
One example is that I have an array of shared pointers, declared as:
TArray< TSharedPtr<class NonexpirableStatModValue> > m_mods;
And I try to pass an element of that array in to a function like so:
pQuery->AddMod(m_mods[statIndex]);
Where that function signature is of the form:
void AddMod(const TSharedPtr<NonexpirableStatModValue> pMod)
It seems that most of these instances have to do with having a TArray of shared pointers, and probably due to the fact that the [] operator of TArray returns a reference, which I suppose is automatically const when it’s an rvalue, but I’m not sure I’m supposed to be doing in this instance. Are you just not allowed to have arrays of shared pointers?