This code is what I want to do:
Tony& Movie::addTony()
{
Tony *newTony = new Tony;
std::unique_ptr<Tony> tony(newTony);
attachActor(std::move(tony));
return *newTony;
}
I am wondering if I could do this instead:
Tony& Movie::addTony()
{
std::unique_ptr<Tony> tony(new Tony);
attachActor(std::move(tony));
return *tony.get();
}
But will *tony.get() be the same pointer or null? I know I could verify, but what is the standard thing for it to do?