Given a function like
void MyFunction(std::unique_ptr<int> arg);
it is not possible (MSVC 2012) to create a functor like
std::function<void(std::unique_ptr<int>)> f = std::bind(&MyFunction, std::placeholders::_1);
The problem is not the bind - using auto f = std::bind(...)
works. Also, using a shared_ptr
also works
- Why is unique_ptr disallowed?
- Is this a MSVC problem or general C++11 restriction?
- Is there a work-around without changing the function definition?