Trying to use best practices for C++ and I see that you should be using std::unique_ptr now. And coming from using raw pointers only I have some questions.
When it comes to returning functions, if I return a std::unique_ptr like:
//Declared as member variable of MyObject class
std::unique_ptr<InternalObject> internalObject;
//Return function of MyObject class to get internalObject as a std::unique_ptr
std::unique_ptr<InternalObject> getInternalObject() {
return internalObject;
}
What am I really returning here? I read that this more or less “gives up” ownership of the pointer and does std::move. If this is true what happens to my internalObject …