程序即人生 » 移动平台现在可用的C++ 11特性

程序即人生 » 移动平台现在可用的C++ 11特性

移动平台现在可用的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
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编译器

最新修改的原文所在地址

原文地址:https://www.cnblogs.com/lexus/p/2601814.html