New and Improved C++ Fundamentals - Duffy, Daniel J (Financial Instrument Pricing Using C++, 2018)
This chapter introduces new syntax and functionality in C++ that adds value to the language as a worthy successor to C++03. It discusses the features that promote the run‐time efficiency, reliability and usability of code, namely: Automatic memory management; move semantics; and new fundamental data types. The chapter gives a short overview of object lifecycles. In particular, it considers the heap‐based memory allocation of objects. Such memory allocation and deallocation in C++ is the responsibility of the developer. The developers can allow automatic memory management by using garbage collection (GC) that is supported by some languages such as C# and Java. Another feature, that is move semantics, allows the compiler to replace expensive copying operations with less expensive move operations. In some cases, move semantics are the only options as some classes do not support copy constructors. Typical examples are smart pointers and classes for multithreading and multitasking.