Now, I know this is a common question, but I haven\'t been able to really find a straight answer on this. This is really a question about standards. I am working on a project in
If you can, always use a reference (&) instead of using the class itself. This even refers to smart pointers (std::shared_ptr), because you will avoid an extra copy even of the pointer itself. And just to make sure that your returned pointer does not get overwritten, pre-pend const to it, so:
void Function(const std::shared_ptr &someObject);