Solid Modern C++
Thought you knew C++? Think again! The C++11 standard is a huge leap forward in the language and STL. Largely inspired by Boost, the C++11 standard introduces support for lambdas, multithreading, vastly improved object construction mechanisms, and much more beside. This course takes a deep and detailed look at all the new features on offer in C++11, along with the incremental additional changes in C++14.
Modules in Solid Modern C++:
Overview of C++11 and C++14
This module describes how C++11 and C++14 dramatically change the way you'll write C++ in the future. We take a look at improved type inference using the 'auto' and 'decltype' keywords, and describe new syntax for specifying function return types. We also show how to implement range-based 'for' loops, and see how to use this new language feature to define iterator and iterable classes.
This module describes how to use the new multithreading API in C++11/C++14. We begin with an overview of the <thread> namespace and show how to execute lambdas asynchronously. We then discuss futures, how to executes functions asynchronously, and launch policies. The module closes with a detailed look at thread safety and condition variables.
This module explores the new container classes introduced in C++11/C++14. We begin with std::array and std::forward-list, and then progress to examine unordered containers, how hashing and buckets work, and new support for movability and in-place construction.
Lambdas in C++
Lambda expressions are one of the headline new features in C++11/C++14. This module describes what lambdas are, what the syntax looks like, how lambdas work with respect to variable capture, and how to use lambdas in conjunction with std::function. We also compare the performance of inline lambdas, bound lambdas, and bound out-of-line functions.
Functional Programming in C++
Functional programming has attracted a lot of attention in recent times, given the potential benefits it offers for parallel processing. This module describes how to do functional programming in C++ using std::function, std::bind, and parameter placeholders.
The concept of smart pointers will be familiar to most C++ developers. C++11/C++14 introduce three types of smart pointers: shared pointers, weak pointers, and unique pointers. This module shows how to use each of these types of smart pointers, and describes scenarios where they are useful.
Lvalues, RValues, and Movability
This module takes a careful and thorough look at lvalues, rvalues, rvalue references, and movability. We describe what movability means, and compare move-semantics with copy-semantics. We explain the meaning of the curious && syntax, and show how to implement move constructors and move assignment operators. We also describe the default members that are generated in C++ classes nowadays, and show how to replace or delete these default members in your classes. To close the chapter, we describe how to implement perfect forwarding.
New Initialization Techniques in C++
C++11 and C++14 introduce various enhancements in the way you define and invoke constructors. We take a detailed look at the new features in this module. We begin with a look at constructor enhancements, including how to initialize members inline. We then discuss uniform initialization syntax, which provides a consistent way to initialize all kinds of values (simple types, arrays/structs, and class objects). The module closes with a look at initializer lists and std::initializer-list, including a discussion of how all this works in conjunction with templates, overloading, and type deduction.
This brief module describes the new features in C++11 and C++14 for handling text. We explore the new 'char16_t' and 'char32_t' typedefs and their string counterparts. We also look at raw string literals, and round off the module with an investigation of regular expressions in C++.
Miscellaneous New C++ Features
This module explores various new language features introduced in C++11 and C++14. We begin with a discussion of the 'nullptr' keyword and the 'nullptr_t' typedef. Next up, we take a look at some enhancements to the way you define and use enums. To close the module, we run through a series of specific language features that enhance the language: generalised constant expressions; restrictions on constexpr functions; explicit overrides; static asserts; using vs. typedef; explicit conversions; nested templates and >>; and variadic templates.