
Thank you. I appreciated all of the insight from all. -----Original Message----- From: boost-bounces@lists.boost.org [mailto:boost-bounces@lists.boost.org] On Behalf Of Olaf van der Spek Sent: Sunday, May 29, 2011 7:06 AM To: boost@lists.boost.org Subject: Re: [boost] [shared_ptr] calling functions by reference On Sun, May 29, 2011 at 4:36 AM, Sid Sacek <ssacek@securewatch24.com> wrote:
This might be a unimportant question and may have already been answered many times before, but I was wondering about functions that take shared pointers as arguments. Is there ever a reason I would not want to use a shared_ptr reference as an argument? I can't think of any, but is there any?
Yes, I think. If the function makes a copy of the argument, passing by value might allow you to take advantage of move semantics (if the callee doesn't need the argument anymore), whereas passing by (const) reference doesn't. Olaf _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost