2010-03-19 65 views

回答

9

here是的C++ 0x的支持良好的击穿几个主要的编译器

+1

这份清单似乎不完整......(但无论如何它都是很好的来源) – Klaim 2010-03-22 09:54:08

7

对于主要兼容的C++ 0x实现,您可以运行g++ -std=c++0x

从手册:

 
c++0x 
    The working draft of the upcoming ISO C++0x standard. This option enables experimental features that are 
    likely to be included in C++0x. The working draft is constantly changing, and any feature that is enabled 
    by this flag may be removed from future versions of GCC if it is not part of the C++0x standard. 

正如在行动它的一个愚蠢的小例子:

$ cat a.cpp  
const int FOO_VERSION = 2; 

int main() { 
    static_assert(FOO_VERSION >= 3, "Your version of Foo doesn't contain the necessary bugfixes to run this program correctly."); 
    return 0; 
} 

$ g++ -std=c++0x a.cpp 
a.cpp:1:17: error: stdio: No such file or directory 
a.cpp: In function ‘int main()’: 
a.cpp:6: error: static assertion failed: "Your version of Foo doesn\'t contain the necessary bugfixes to run this program correctly." 

此外,作为@GMan在评论中提到,GCC's list of C++0x compatibility可以在网上找到。

+0

AFAIK所有的线程和锁相关的东西丢失呢,对吧? – Frunsi 2010-03-19 11:19:00

+0

支持的功能列表及其相应的g ++版本:http://gcc.gnu.org/projects/cxx0x.html – GManNickG 2010-03-19 11:20:02

+0

功能页面上未列出线程和锁定内容,但头文件包含在gcc 4.4中内容看起来像是新标准。 – 2010-03-19 15:07:45

1

科莫 - 尝试一下here。不,我不为他们/从属于他们工作;)但他们在合规方面做得很好。

Intel还支持some从11.0开始的C++ 0x。 (当前版本为11.1)

相关问题