std::thread with movable, non-copyable argument
问题 The following program doesn't build in VS11 beta, gcc 4.5, or clang 3.1 #include <thread> #include <memory> int main() { std::unique_ptr<int> p; std::thread th([](std::unique_ptr<int>) { },std::move(p)); th.join(); } This is because the argument type is not copyable, but the implementation attempts to copy it. As far as I can tell, this program is well formed and should work. The requirements for std::thread seem to imply that movable, non-copyable arguments should work here. Specifically it