简体   繁体   English

在任何编译器中c ++ 0x库可用性?

[英]c++0x library availability in any compiler?

The standard will doubtless take years to put in place, which stinks because it looks great. 毫无疑问,该标准将需要数年才能实现,因为它看起来很棒,所以很臭。 But I was reading it, and at least the library additions (hash maps in particular) would be really useful right away. 但我正在阅读它,至少库添加(特别是哈希映射)会立即真正有用。 I noticed in the g++ docs that I can get 4.3 or better and use a flag to request the new features, whatever exists, but I was wondering if there is any way to just get the library. 我注意到在g ++文档中我可以获得4.3或更高版本并使用标志来请求新功能,无论存在什么,但我想知道是否有任何方法可以获得库。 And the fact that lots of the best boost stuff is now built in is really great, finally a decent random number facility built in! 现在内置的许多最好的增强功能非常棒,最后内置了一个像样的随机数设备!

So, are there any compilers which I can use right now which have a reasonably complete library in place, even if it can't use some of the cool new language features like auto? 那么,有没有我现在可以使用的编译器有一个相当完整的库,即使它不能使用一些很酷的新语言功能,如汽车?

If you want the standard library extensions, you can use Boost . 如果您需要标准库扩展,可以使用Boost The new standard library enhancements were mainly inspired by Boost libraries anyway. 无论如何,新的标准库增强主要受到Boost库的启发。

As for supporting compilers, Visual Studio 2010 supports a subset of the C++11 standard , GCC has currently the best support for C++11 and Clang is also adopting the new standard . 至于支持编译器,Visual Studio 2010 支持C ++ 11标准的子集 ,GCC 目前支持C ++ 11,而Clang也采用新标准 Don't know about other compilers but I think they will soon follow. 不知道其他编译器,但我认为他们很快就会关注。

GCC with option -std=c++0x already covers a pretty good subset of C++0x. 带选项-std=c++0x GCC已经涵盖了C ++ 0x的一个很好的子集。 Version 4.4 is already pretty usable, 4.6 even moreso. 4.4版本已经非常实用,4.6甚至更多。 It's missing template aliases, but many extremely useful language features as well as a very large part of the library is there and fully functional. 它缺少模板别名,但是许多非常有用的语言功能以及库的很大一部分都在那里并且功能齐全。

Here is the full feature list . 这是完整的功能列表

除了GCC in -std=c++0x模式及其在GCC支持的所有平台上的默认libstdc ++之外,您还可以使用LLVM的libc++ ,它在Linux / BSD / Mac上运行良好,但尚未移植到Windows。

GCC/libstdc++ has most of the library in place, but may require prepending tr1/ to the include paths ( #include <tr1/unordered_map> for hashed maps). GCC / libstdc ++有大部分库,但可能需要在包含路径前加上tr1/#include <tr1/unordered_map>用于散列映射)。 It also puts the new library stuff in the namespace std::tr1 instead of just std . 它还将新库的东西放在命名空间std::tr1而不是std

(TR1 stands for Technical Report 1, which was a report describing the library additions for C++0x.) (TR1代表技术报告1,这是一份描述C ++ 0x库添加的报告。)

Some of the libraries, and in particular the one you mention here (unordered_map) were defined as part of a technical review back in 2003, and have been moved to the C++0x standard mainly unmodified. 一些库,特别是你在这里提到的库(unordered_map)在2003年被定义为技术评审的一部分,并且已经被转移到C ++ 0x标准,主要是未经修改的。 Most compilers have the TR1 libraries implemented in the std::tr1 namespace. 大多数编译器都在std::tr1命名空间中实现了TR1库。

Other libraries were pulled from other sources, Boost being a big source of libs for the upcoming standard ( function , bind , thread ...), but that depends on what you want to add to your project. 其他库来自其他来源,Boost是即将推出的标准( functionbindthread ......)的lib的重要来源,但这取决于你想要添加到项目中的内容。

As to whether you can extract the libraries from a C++0x and use them in a non-c++0x compiler, you most probably cannot do it, as they will make use of the newer features (think move constructors), and that will fail to compile. 至于你是否可以从C ++ 0x中提取库并在非c ++ 0x编译器中使用它们,你很可能不能这样做,因为它们会利用更新的特性(想想移动构造函数),以及这将无法编译。

Here is the link where you can find c++0x support for most of the compilers 这是您可以找到大多数编译器的c ++ 0x支持的链接

http://wiki.apache.org/stdcxx/C%2B%2B0xCompilerSupport http://wiki.apache.org/stdcxx/C%2B%2B0xCompilerSupport

The list gets updated whenever a new c++0x support is added. 每当添加新的c ++ 0x支持时,列表都会更新。 As you can see g++ has the support of maximum number of C++0x features as of now. 正如您所看到的,g ++目前支持最大数量的C ++ 0x功能。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM