VS2010的绑定实现不支持仅移动类型?

3
我发现以下代码在Visual Studio 2010中无法编译(但在GCC中可以正常工作):
using namespace std;
unique_ptr<string> up(new string("abc"));
auto bound = bind(&string::size, move(up));
bound();

我收到的错误信息是:
' std::unique_ptr<_Ty>::unique_ptr':无法访问类中声明的私有成员'std::unique_ptr<_Ty>'
这是因为VS2010绑定实现不支持仅移动类型吗?
1个回答

7
你的猜测是正确的:Visual C++ 2010 实现的 std::bind 不支持移动语义。请参考此错误报告:"std::bind and std::function are not move-aware."
这个问题在即将发布的版本 Visual C++ 11 中已经得到解决。修复程序应该已经包含在 9 月份发布的 Visual C++ Developer Preview 中了。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接