If I have a member function that returns a pointer that I'm using for accessing other objects...
What's the best way to optimize my code? Should I return const int*
or const int*&
?
EDIT. What I mean is: does returning a pointer involve a copy? Would be returning a reference to the pointer easy to optimize for the compiler? I don't assign the returned value to any variable:
my_object.get_ptr()->function();