- Sample Program: C++98 vs. C++11
- Features for Everybody:
autofor Type Declarations- Range-Based
forLoops - “>>” as Nested Template Closer
nullptr- Enhanced
enums - Unicode characters and strings
- Raw string literals
- Uniform initialization syntax
- Initializer lists
- Lambda Expressions
- Template Aliases
- Threading Support
- Library Enhancements:
- New Container Features
- Smart Pointers (
shared_ptr,weak_ptr,unique_ptr) - Hash Tables
- Singly-Linked Lists
- Fixed-Size Arrays
- Tuples
- Regular Expressions
- Generalized Functors(
function) - Generalized Binder (
bind) - New Algorithms
- Other New Library Functionality
- Features Primarily for Class Authors:
- Move Support, Rvalue References, and Perfect Forwarding
defaultMember FunctionsdeleteFunctions- Default Member Initialization
- Delegating Constructors
- Inheriting Constructors
- Features Primarily for Library Authors:
- Static Assertions
explicitConversion Functions- Variadic Templates
decltype- Alignment control (i.e.,
alignof,alignas, etc.
- More C++11 Features (Overview)
- More C++14 Features (Overview)
- Removed and Deprecated Features (Overview)
本文详细介绍了C++11相对于C++98的重大更新,包括auto类型推导、范围for循环、智能指针、哈希表、元组等新容器特性,以及移动语义、右值引用、lambda表达式、模板别名等编程语法改进。同时涵盖了对类作者和库作者特别重要的新功能。
1万+

被折叠的 条评论
为什么被折叠?



