17 Jun
2016
17 Jun
'16
12:40 a.m.
On 17/06/2016 12:27, Piotr Kowalski wrote:
Under Visual Studio C++ 2013 the example works fine after adding a reference in function signature: boost::function
This somehow prevents too much forwarding and losing the original value
I'm a firm believer in never ever passing smart pointers by value -- they're still objects and copying them is expensive and unnecessary when accepting parameters. (You do have to pay for copying sometimes, particularly when passing things between threads or deferred calls -- but in this case the bind itself will do the copy and you don't need to copy it again when calling the bound method.) Although it should be a const& parameter.