我最近安装了Visual Studio 11 Developer Preview。虽然与螺纹期货玩,我来解决这个设置:VS 11与std :: future - 这是一个错误吗?
#include <future>
#include <iostream>
int foo(unsigned a, unsigned b)
{
return 5;
}
int main()
{
std::future<int> f = std::async(foo, 5, 7);
std::cout << f.get();
}
所以,很简单。但由于“foo”有两个参数,VS 11不想编译它。 (然而,g ++一样:http://ideone.com/ANrPj)(运行时错误是没有问题的:std::future exception on gcc experimental implementation of C++0x)(VS 11的ErrorMessage:http://pastebin.com/F9Xunh2s)
我有点糊涂了,现在,因为该错误在我看来极为明显,即使是一个开发人员预览。所以我的问题是:
- 此代码是否正确根据C++ 11标准?
- 这个bug是否已知/报告?
我发现错误报告:http://connect.microsoft.com/VisualStudio/feedback/details/729760/std-async-fails-compilation-for-callable-with-two-or-more-arguments – yohjp 2012-03-15 04:08:45