VS2010 beta1发布了,我只关心其编译器对C++0x的支持如何。于是下载,安装,写最简单的控制台程序,命令行编译之,成功!没有了tr1命名空间了,这点感觉很好,不过thread看起来还不支持!
下面是测试程序:
#include <iostream>
#include <memory>
#include <vector>
int main()
{
for (auto i = 0; i < 10; ++i)
{
std::cout << i << std::endl;
}
std::shared_ptr<int> sp(new int(1));
std::cout << *sp << std::endl;
std::vector<double> v;
v.push_back(1.0);
v.push_back(1.0/2);
v.push_back(1.0/3);
for (auto it = v.begin(); it != v.end(); ++it)
{
std::cout << *it << std::endl;
}
return 0;
}
测试结果:
D:\>cl main.cpp
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.20506.01 for 80x86
Copyright (C) Microsoft Corporation. All rights reserved.
main.cpp
E:\Program Files\Microsoft Visual Studio 10.0\VC\INCLUDE\xlocale(355) : warning
C4530: C++ exception handler used, but unwind semantics are not enabled. Specify
/EHsc
main.cpp(4) : fatal error C1083: Cannot open include file: 'thread': No such fil
e or directory
D:\>cl main.cpp
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.20506.01 for 80x86
Copyright (C) Microsoft Corporation. All rights reserved.
main.cpp
E:\Program Files\Microsoft Visual Studio 10.0\VC\INCLUDE\xlocale(355) : warning
C4530: C++ exception handler used, but unwind semantics are not enabled. Specify
/EHsc
Microsoft (R) Incremental Linker Version 10.00.20506.01
Copyright (C) Microsoft Corporation. All rights reserved.
/out:main.exe
main.obj
D:\>main
0
1
2
3
4
5
6
7
8
9
1
1
0.5
0.333333