If I have a function that needs to work with a shared_ptr, wouldn\'t it be more efficient to pass it a reference to it (so to avoid copying the shared_ptr
shared_ptr
In the second case, doing this is simpler:
Class::only_work_with_sp(foo &sp) { ... sp.do_something(); ... }
You can call it as
only_work_with_sp(*sp);