A question about TSharedPtr with Tmap

Hi!

I’ve been reading about smart pointers: Smart Pointers in Unreal Engine | Unreal Engine 5.8 Documentation | Epic Developer Community and Smart Pointers in C++ - GeeksforGeeks . After reading I get confused.

A method has this parameter TMap<int32, TSharedRef<FStar>>& OutStars).

Is it OK to use TSharedRef<FStar> here? Maybe, I can use just a raw pointer.

I don’t know why I’ve started to think that I can’t use TSharedRef here.

Inside this method I do this:

while (PreparedStatement->Step() == ESQLitePreparedStatementStepResult::Row)
{
   TSharedRef Star = MakeShared();

   // Add values to the Star

   // ########################
   // Omitted for brevity
   // ########################

   OutStars.Add(Star->ID, Star);

}

Thanks!