Giter Club home page Giter Club logo

cpp_new_features's Introduction

🌞🌞🌞 2021年最新整理, C++ 学习资料,含C++ 11 / 14 / 17 / 20 / 23 新特性、入门教程、推荐书籍、优质文章、学习笔记、教学视频等


🌋 C++ 发展历程

  • C++ 编程语言的历史可以追溯到 1979 年,当时 Bjarne Stroustrup 为博士学位论文进行了一些开发。在 Stroustrup 可以使用的所有语言中,有一种被称为 Simula 的语言,顾名思义,它可能是一种主要为仿真而设计的语言。Simula 67 语言是 Stroustrup 使用的变体,被认为是支持面向对象编程范例的主要语言。Stroustrup 发现这种范例对包装开发很有帮助。但是,Simula 语言对于实践和实际使用而言太慢了。 随后不久,Bjarne Stroustrup 希望通过支持面向对象范例来增强 C。他深入研究了 Smalltalk 的 OO 实现,以获取有关实现的想法。但是他不愿意为此放弃性能,因此他开始从事 “C with Classes (带有类的 C)” 的工作,希望 C++ 代码运行时应具有与 C 代码相似(或更好)的性能。

  • 1983 年,语言的名称从 “带有类的 C” 更改为 C++。C 语言中的 ++ 运算符是用于递增变量的运算符,它使您可以深入了解 Stroustrup 如何看待该语言。在此期间添加了许多新功能,其中最引人注目的是虚函数,函数重载,带有&符号的引用,const 关键字和使用两个正斜杠的单行注释。

  • 1985 年,Stroustrup 出版了名为*“C++ 编程语言” 的书籍*。同年,C++ 被实现为商业产品。该语言尚未正式标准化,因此使该书成为非常重要的参考。该语言在 1989 年再次进行了更新,以包括受保护的成员和静态成员,以及从多个类的继承。

  • 1990 年,发行了*《带注释的 C++ 参考手册*》。同年,Borland 的 Turbo C++ 编译器将作为商业产品发布。Turbo C++ 添加了许多其他库,这些库会对 C++ 的开发产生相当大的影响。尽管 Turbo C++ 的最后一个稳定版本是 2006 年,但该编译器仍被广泛使用。

  • 1998 年,C++ 标准委员会发布了第一个 C++ ISO / IEC 14882:1998 国际标准,其非正式名称为 C++ 98。据说*《带注释的 C++ 参考手册*》对标准的制定产生了很大的影响。还包括标准模板库,该模板库于 1979 年开始概念开发。2003 年,该委员会对 1998 年标准所报告的多个问题做出了回应,并对其进行了相应的修订。更改的语言称为 C++ 03。

  • 2005 年,C++ 标准委员会发布了一份技术报告(称为 TR1),详细介绍了他们计划添加到最新 C++ 标准中的各种功能。新标准被非正式地称为 C++ 0x,因为它有望在第一个十年结束之前的某个时间发布。具有讽刺意味的是,新标准要到 2011 年年中才会发布。直到那时为止,已经发布了几份技术报告,并且一些编译器开始为新功能添加实验性支持。

  • 2011 年中,新的 C++ 标准(称为 C++ 11)完成。Boost 库项目对新标准产生了重大影响,其中一些新模块直接来自相应的 Boost 库。一些新功能包括正则表达式支持,全面的随机化库,新的 C++ 时间库,原子支持,标准线程库 ,一种新的 for 循环语法,提供的功能类似于某些其他语言中的 foreach 循环,auto 关键字,新的容器类,对联合和数组初始化列表以及可变参数模板的更好支持。

  • 2014 年,C++ 14(也称为 C++ 1y)作为 C++11 的一个小扩展发布,主要功能是错误修复和小的改进,国际标准投票程序草案于 2014 年 8 月中完成,加强 lambda 函数,constexpr 和类型推导特性。

  • 2017 年,发布 C17 标准,C17 提供了很多东西。增强了核心语言和库。

  • 2020 年,发布 C++20 标准,推出了很多重量级功能,其中比较重要的有:

    • Concepts:概念改变了我们思考和编程模板的方式。它们是模板参数的语义类别。它们使您可以直接在类型系统中表达您的意图。如果出了什么问题,您会收到清晰的错误消息。
    • Ranges library:新的 ranges 库使它可以直接在容器上执行算法,用管道符号组成算法,并将其应用于无限数据流。
    • Coroutines:由于协程,C++ 中的异步编程成为主流。协程是协作任务,事件循环,无限数据流或管道的基础。
    • Modules:模块克服了头文件的限制。头文件和源文件的分离变得和预处理器一样过时了。最后,我们有更快的构建时间和更轻松的构建软件包的方法。
    • Concurrency:Atomic Smart Pointers,Joining & Cancellable Threads,The C20 Synchronization Library,增强了 C++ 并发编程能力;


🚪 入门教程

📚 书籍推荐

📰 文章推荐

▶ 教学视频

🌰 干货铺

  • C++ FAQ − C++ 常见问题
  • Free Country − Free Country 提供了免费的 C++ 源代码和 C++ 库,这些源代码和库涵盖了压缩、存档、游戏编程、标准模板库和 GUI 编程等 C++ 编程领域。
  • C and C++ Users Group − C 和 C++ 的用户团体提供了免费的涵盖各种编程领域 C++ 项目的源代码,包括 AI、动画、编译器、数据库、调试、加密、游戏、图形、GUI、语言工具、系统编程等
  • LearnCpp - 免费学习c++编程

🖥 部分代码案例

关键字

新增关键字

含义变化或者新增含义关键字(meaning changed or new meaning added)

类型支持(基本类型、RTTI、类型特性)

Defined in header <type_traits>

STL容器

无序容器

元组std::tuple

hash

智能指针

正则表达式

函数

非静态成员函数

函数对象模板

模板

原子操作

线程

异常

错误

新语法

预处理

C++宏(cplusplus macro)

基于范围的for语句

对齐支持(alignment support)

显式转换操作符(explicit conversion operators)

静态断言(static assert)
  • 语法:static_assert(常量表达式,"提示字符串")

  • static assert

数字限制(numeric limits)

原始字符串(raw string)

追踪返回类型语法(trailing return type syntax)

扩展的friend语法(extended friend syntax)

扩展的整型(extended integer types)

非受限联合体(unrestricted union)

内联名字空间(lnline namespace)

用户定义的字面量(user-defined literals)

强类型枚举(scoped and strongly typed enums)

随机装置(random device)

std::ref和std::cref

常量表达式(constexpr)

lamda表达式

指针空值(nullptr)

防止类型收窄(Preventing narrowing)

初始化列表(initializer lists)

统一的初始化语法和语义(Uniform initialization syntax and semantics)

POD(plain old data)

long long整型

移动语义(move semantics)

右值引用(rvalue reference)

c99特性(c99)

一般化的SFINAE规则(generalized SFINAE rules)

类型支持(基本类型、RTTI、类型特性)

Defined in header<type_traits>

Defined in header<utility>

Defined in header<initializer_list>

Defined in header<iterator>

Defined in namespace std

Defined in header <array>

Defined in header <deque>

Defined in header <forward_list>

Defined in header <iterator>

Defined in header <list>

Defined in header <map>

Defined in header <regex>

Defined in header <set>

Defined in header <span>

Defined in header <string>

Defined in header <string_view>

Defined in header <unordered_map>

Defined in header <unordered_set>

Defined in header <vector>

Defined in namespace std

关键字

含义变化或者新增含义关键字(meaning changed or new meaning added)

类型支持(基本类型、RTTI、类型特性)

Defined in header<type_traits>

Defined in header<utility>

Defined in header<tuple>

Defined in header<optional>

Defined in header<variant>

Defined in header<any>

Defined in header<charconv>

Defined in header<initializer_list>

容器库

Defined in header<map>

Defined in header<unordered_map>

Defined in header <array>

Defined in header <deque>

Defined in header <forward_list>

Defined in header <iterator>

Defined in header <list>

Defined in header <map>

Defined in header <regex>

Defined in header <set>

Defined in header <span>

Defined in header <string>

Defined in header <string_view>

Defined in header <unordered_map>

Defined in header <unordered_set>

Defined in header <vector>

Defined in namespace std

关键字

新增关键字

含义变化或者新增含义关键字(meaning changed or new meaning added)

类型支持(基本类型、RTTI、类型特性)

Defined in header<type_traits>

协程支持

Defined in header<coroutine>

三路比较

Defined in header<compare>

Defined in header<concepts>

Defined in header<utility>

Defined in header<memory>

Concepts library(概念库)

Defined in header<concepts>

动态内存管理

Defined in header<memory>

日期和时间工具

Defined in header<chrono>

字符串

Defined in header<string>

Defined in header<string_view>

Defined in header<cuchar>

容器库

Defined in header<array>

Defined in header<vector>

Defined in header<map>

Defined in header<unordered_map>

Defined in header<span>

Defined in namespace std

Defined in namespace std::ranges

Defined in namespace std

Defined in header

Defined in namespace std

Defined in header

Defined in header <array>

Defined in header <deque>

Defined in header <forward_list>

Defined in header <iterator>

Defined in header <list>

Defined in header <map>

Defined in header <regex>

Defined in header <set>

Defined in header <span>

Defined in header <string>

Defined in header <string_view>

Defined in header <unordered_map>

Defined in header <unordered_set>

Defined in header <vector>

Defined in namespace std

Defined in header <ranges>

Defined in header <iterator>

Defined in namespace std::ranges

类型支持(基本类型、RTTI、类型特性)

Defined in header<type_traits>

Defined in header<utility>

Defined in header<stacktrace>

动态内存管理

Defined in header<memory>

字符串

Defined in header<string>

Defined in header<string_view>

联系专栏

零声教育,专注于c/c++Linux后台服务器开发架构技术学习提升。

每天晚上8点【免费技术直播】:分享Linux,Nginx,ZeroMQ,MySQL,Redis,fastdfs,MongoDB,ZK,流媒体,CDN,P2P,K8S,Docker,TCP/IP,协程,DPDK等技术内容,立即学习。

关注微信公众号【后台服务架构师】——【联系我们】,获取本repo最全PDF学习文档!

cpp_new_features's People

Contributors

ls-brynn avatar wangbojing avatar wenchao1024 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.