移动平台现在可用的C++ 11特性

2011年12月29日
jtianling 发表评论
阅读评论
542 人阅读

移动平台特指iOS和Android,并且Android使用的是NDK,因为开发的时候是在Win32平台下,所以还需要考虑VS的支持。

当前(2011-12-21)最新的版本:

Win32: Visual Studio 2010

Android NDK: GCC 4.4.3

iOS: Apple LLVM compiler 3.0(Clang)

本文所描述的C++ 11特性仅在上述三个平台,所写的版本号中有效,请先确认这点。

在apache的WIKI上有个较为详细的列表。可以看到,现在能用的特性其实不怎么多:

  1. auto
  2. decltype
  3. extern template
  4. long long
  5. New function declaration syntax for deduced return types
  6. Right Angle Brackets
  7. R-Value References
  8. static_assert
  9. Built-in Type Traits

如下图:

上面是整体的描述,具体的各个编译器对C++ 11的支持情况见下面的链接:

Win32:
Visual Studio 2010支持情况:C++0x Core Language Features In VC10: The Table
Lambdas, auto, and static_assert: C++0x Features in VC10, Part 1
Rvalue References: C++0x Features in VC10, Part 2
decltype: C++0x Features in VC10, Part 3
Visual Studio 2011支持情况:C++11 Features in Visual C++ 11
Android NDK: GCC 4.4.3

Status of Experimental C++0x Support in GCC 4.4

C++0x/C++11 Support in GCC

iOS:

Apple LLVM compiler 3.0(Clang):C++ and C++’11 Support in Clang

The LLVM Compiler Infrastructure

使用方式:

1.Build Options选择Apple LLVM compiler 3.0

2.”Apple LLVM compiler 3.0 – Language”中”C++ Language Dialect”选择“C++0x” (

3.”C++ Standard Library”选择libc++(LLVM C++ standard library with C++ ’0X support)” (默认为”Compiler Default”)

其他有意思的东西:

“libc++” C++ Standard Library

在线试用LLVM编译器

最新修改的原文所在地址。

声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。