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. 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!
毫无疑问,该标准将需要数年才能实施,因为它看起来很棒,因此很臭。但我正在阅读它,至少库添加(特别是哈希映射)将立即真正有用。我在g ++文档中注意到我可以获得4.3或更高版本并使用标志来请求新功能,无论存在什么,但我想知道是否有任何方法可以获得库。现在内置了许多最好的增强功能的事实非常棒,最后内置了一个像样的随机数设备!
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?
那么,有没有我现在可以使用的编译器,它们有一个相当完整的库,即使它不能使用一些很酷的新语言功能,如auto?
6 个解决方案
#1
3
GCC with option -std=c++0x
already covers a pretty good subset of C++0x. Version 4.4 is already pretty usable, 4.6 even moreso. 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.
带选项-std = c ++ 0x的GCC已经涵盖了C ++ 0x的一个非常好的子集。 4.4版已经非常实用,4.6甚至更多。它缺少模板别名,但是许多非常有用的语言功能以及库的很大一部分都在那里并且功能齐全。
Here is the full feature list.
这是完整的功能列表。
#2
7
If you want the standard library extensions, you can use Boost. The new standard library enhancements were mainly inspired by Boost libraries anyway.
如果您想要标准库扩展,可以使用Boost。无论如何,新的标准库增强主要受到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. Don't know about other compilers but I think they will soon follow.
至于支持编译器,Visual Studio 2010支持C ++ 11标准的子集,GCC目前支持C ++ 11,而Clang也采用新标准。不知道其他编译器,但我认为他们很快就会关注。
#3
3
Apart from GCC in -std=c++0x
mode with its default libstdc++ on all platforms supported by GCC, you can also use LLVM's libc++
, which works well on Linux/BSD/Mac, but hasn't been ported yet to Windows.
除了GCC in -dd = c ++ 0x模式及其在GCC支持的所有平台上的默认libstdc ++之外,您还可以使用LLVM的libc ++,它在Linux / BSD / Mac上运行良好,但尚未移植到Windows。
#4
1
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). It also puts the new library stuff in the namespace std::tr1
instead of just std
.
GCC / libstdc ++有大部分库,但可能需要在包含路径前加上tr1 /(#include
(TR1 stands for Technical Report 1, which was a report describing the library additions for C++0x.)
(TR1代表技术报告1,这是一份描述C ++ 0x库添加的报告。)
#5
1
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. Most compilers have the TR1 libraries implemented in the std::tr1
namespace.
一些库,特别是你在这里提到的库(unordered_map)在2003年被定义为技术评审的一部分,并且已经被转移到C ++ 0x标准,主要是未经修改的。大多数编译器都在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是即将推出的标准(函数,绑定,线程......)的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编译器中使用它们,你很可能无法做到,因为它们将利用更新的特性(想想移动构造函数),以及这将无法编译。
#6
0
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
The list gets updated whenever a new c++0x support is added. As you can see g++ has the support of maximum number of C++0x features as of now.
每当添加新的c ++ 0x支持时,列表都会更新。正如您所看到的,g ++目前支持最大数量的C ++ 0x功能。
#1
3
GCC with option -std=c++0x
already covers a pretty good subset of C++0x. Version 4.4 is already pretty usable, 4.6 even moreso. 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.
带选项-std = c ++ 0x的GCC已经涵盖了C ++ 0x的一个非常好的子集。 4.4版已经非常实用,4.6甚至更多。它缺少模板别名,但是许多非常有用的语言功能以及库的很大一部分都在那里并且功能齐全。
Here is the full feature list.
这是完整的功能列表。
#2
7
If you want the standard library extensions, you can use Boost. The new standard library enhancements were mainly inspired by Boost libraries anyway.
如果您想要标准库扩展,可以使用Boost。无论如何,新的标准库增强主要受到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. Don't know about other compilers but I think they will soon follow.
至于支持编译器,Visual Studio 2010支持C ++ 11标准的子集,GCC目前支持C ++ 11,而Clang也采用新标准。不知道其他编译器,但我认为他们很快就会关注。
#3
3
Apart from GCC in -std=c++0x
mode with its default libstdc++ on all platforms supported by GCC, you can also use LLVM's libc++
, which works well on Linux/BSD/Mac, but hasn't been ported yet to Windows.
除了GCC in -dd = c ++ 0x模式及其在GCC支持的所有平台上的默认libstdc ++之外,您还可以使用LLVM的libc ++,它在Linux / BSD / Mac上运行良好,但尚未移植到Windows。
#4
1
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). It also puts the new library stuff in the namespace std::tr1
instead of just std
.
GCC / libstdc ++有大部分库,但可能需要在包含路径前加上tr1 /(#include
(TR1 stands for Technical Report 1, which was a report describing the library additions for C++0x.)
(TR1代表技术报告1,这是一份描述C ++ 0x库添加的报告。)
#5
1
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. Most compilers have the TR1 libraries implemented in the std::tr1
namespace.
一些库,特别是你在这里提到的库(unordered_map)在2003年被定义为技术评审的一部分,并且已经被转移到C ++ 0x标准,主要是未经修改的。大多数编译器都在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是即将推出的标准(函数,绑定,线程......)的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编译器中使用它们,你很可能无法做到,因为它们将利用更新的特性(想想移动构造函数),以及这将无法编译。
#6
0
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
The list gets updated whenever a new c++0x support is added. As you can see g++ has the support of maximum number of C++0x features as of now.
每当添加新的c ++ 0x支持时,列表都会更新。正如您所看到的,g ++目前支持最大数量的C ++ 0x功能。