C++ is an ISO standardized programing language. There are different C++ standards:
- C++ 98
- C++ 03
- C++ 11 modern C++
- C++ 14 |
- C++ 17 |
- C++ 20 /
Everything starting with C++11 is referred to as “Modern C++”. These standards define the language in great technical detail. They also serve as manuals for C++ compiler writers. It is a mind-boggling set of rules and specifications. The C++ standards can be bought, or a draft version can be downloaded for free. These drafts closely resemble the final C++ standard. When C++ code can be successfully transferred and compiled on different platforms (machines or compilers), and when C++ implementation closely follows the standard, we say that the code is portable. This is often referred to as portable C++ .
The standards surrounded by braces represent the so-called “Modern C++.” Each standard describes the language and introduces new language and library features. It may also introduce changes to the existing rules. We will describe notable features in each of these standards.
标准和新特性 | 解释或描述 |
C++11 | |
11.1 Automatic Type Deduction | auto |
11.2 Range-based Loops | for(auto el:range) |
11. 3 Initializer Lists | {} |
11. 4 Move Semantics | move |
11. 5 Lambda Expressions | [](){} |
11. 6 The constexpr Specifier | constexpr |
11. 7 Scoped Enumerators | enum class |
11. 8 Smart Pointers | unique_ptr |
11. 9 std: : unordered_ set | unordered_ set |
11. 10 std: : unordered_ map | unordered_ map |
11. 11 std: : tuple | pair<>->tuple<> |
11. 12 static_ assert | constexpr |
11. 13 Concurrency | thread(func) |
11. 14 Deleted and Defaulted Functions | default, delete |
11. 15 Type Aliases | using id = type |
C++14 | |
14. 1 Binary Literals | 0b1010 |
14. 2 Digits Separators | 123'456 |
14. 3 Auto for Functions | auto func(); |
14. 4 Generic Lambdas | auto lambdas |
14. 5 std: : make_ unique | make_unique() |
C++17 | |
17. 1 Nested Namespaces | n::m::p declaration |
17. 2 Constexpr Lambdas | Constexpr Lambdas |
17. 3 Structured Bindings | auto[] = arr |
17. 4 std: : filesystem | filesystem |
17. 5 std: : string_ view | non-owning view |
17. 6 std: : any | any c = 123; |
17. 7 std: : variant | union->variant |
C++20 相关阅读:
|