现在C++的岗位几乎都要求会使用C++11以后的标准,正好微软官方有一章就是讲的“Welcome Back to C++ (Modern C++)”,我这里主要在内存方面介绍下。具体请看看官方文档:https://docs.microsoft.com/en-us/cpp/cpp/welcome-back-to-cpp-modern-cpp?view=vs-2019
先来个总纲:
Modern C++ emphasizes:
-
Stack-based scope instead of heap or static global scope.
-
Auto type inference instead of explicit type names.
-
Smart pointers instead of raw pointers.
-
std::string
andstd::wstring
types (see <string>) instead of rawchar[]
arrays. -
C++ Standard Library containers like
vector
,list
, andmap
instead of raw arrays or custom containers. See <vector>, <list>, and <map>. -
C++ Standard Library algorithms instead of manually coded ones.
-
Exceptions, to report and handle error conditions.
-
Lock-free inter-thread communication using C++ Standard Library
std::atomic<>
(see <atomic>) instead of other inter-thread communication mechanisms. -
Inline