检查C ++ 0x算法添加的可用性 [英] Checking for availability of C++0x algorithm additions
问题描述
我试图找出一个给定的实现支持哪些算法头的添加(gcc和MSVC是足够的)。方式将是做一样的方式做一个核心功能:检查编译器版本,并定义一个宏,如果一个语言特性被支持。很遗憾,我找不到显示任一编译器的版本号的列表。
只是检查一个通用的C ++ 0x宏(GXX_EXPERIMENTAL或__cplusplus)检查编译器的更改列表,并根据这些列表构建我的宏?
http://gcc.gnu.org/onlinedocs/libstdc++/manual/status.html#status.iso.200x
因为所有的编译器供应商提供了一个很好的列表,什么版本的可用,你会测试的功能,无论如何,我会使用编译器版本来检查特定的功能。或者要求用户至少使用一个好的版本,不用担心。
__ cplusplus
C ++ 0x宏,它什么也不告诉你。 GXX_EXPERIMENTAL
自GCC 4.3起已存在,所以这也是没用的。
$ b $ b
此处您可以找到要检查的特定版本的宏编译器。
I'm trying to figure out which of the additions to the algorithm headers are supported by a given implementation (gcc and MSVC would be enough).
The simple way would be to do it the same way as one would do it for core features: check the compiler version and define a macro if a language feature is supported. Unfortunately I cannot find a list that shows the version numbers for either compiler.
Is simply checking for a generic C++0x macro (GXX_EXPERIMENTAL or __cplusplus) enough or should I check the change lists for the compilers and build my macros based on those lists?
http://gcc.gnu.org/onlinedocs/libstdc++/manual/status.html#status.iso.200x
Since all compiler vendors provide a nice list of what's available in what version, and you would test the functionality anyways, I would use compiler versions to check for specific features. Or demand the user uses at least a good version, and not worry about it.
__cplusplus
is not necessarily a C++0x macro, it tells you nothing. GXX_EXPERIMENTAL
has existed since GCC 4.3, so that's pretty useless too.
This one is for MSVC. (mind you: partially implemented means broken)
Here you can find what macros to check against for a specific version of a compiler.
这篇关于检查C ++ 0x算法添加的可用性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!