Using Visual Studio 2013 RC and C++, I\'m trying to pass an std::unique_ptr
to a function that has been bound using std::bind
. However, I\'m having
I had the same problem with VS 2012 recently. I believe this is a bug in MSVC; at least in MSVC++11 the pseudo-variadic expansion seems to forward the parameters by value to some internal function. Seems this hasn't been improved.
As a workaround, I'm using lambdas instead, but another hack is required to make it work:
std::function)> bound =
[] (std::unique_ptr arg) { func(std::move(arg)); };
still doesn't compile. But if you add any captured value (even one that isn't used), it compiles:
int x;
std::function)> bound =
[x] (std::unique_ptr arg) { func(std::move(arg)); };