Hello,
This is probably more of an C++ question than the UE4 Smart Pointer question, but nonetheless I’d greatly appreciate the assistance:
While passing SmartPtr’s and TWeakObjectPtr’s into the functions, should I pass them by ref or by value? In other words, what is the safe signature:
void EquipItem(TSharedPtr<UEternalItem> item)
void UsePickup(TWeakObjectPtr<UEternalPickup> pickup)
or
void EquipItem(TSharedPtr<UEternalItem>& item)
void UsePickup(TWeakObjectPtr<UEternalPickup>& pickup)
On one hand, passing by ref is definitely more lightweight, but is it memory-safe?