Programming in C++11/14
Course objectives
Delegates will learn:
- new features introduced to the language and standard library in the C++11/14 standard
- language extensions such as
nullptr
,auto
anddecltype
deduction mechanisms, range-based for loop, strongly typed enums (scoped enums), and uniform initialization syntax - implementation of move semantics for classes
- perfect forwarding mechanism
- practical use of lambda expressions in combination with the STL library
- new features in the Standard Library, such as
std::tuple
, hashing containers, and new standard algorithms
Course syllabus
C++98 vs. C++11 and C++14
Core language features
- New basic types
- Raw strings
- nullptr keyword
- Type deduction in modern C++
- auto
- decltype
- Functions and trailing return type
- Scoped enumerations
- Range-based-for loops
- Uniform initialization syntax
- Initializers list
- Type aliases, alias templates
New features in C++ classes
- Defaulting special member functions -
default
- Default initialization of non-static members
- Delegating and inheriting of constructors
- Overriding virtual methods - override
- Blocking inheritance and overriding using
final
Move semantics
- Motivation for move semantics
- l-values and r-values
- rvalue references
- Implementing move semantics for user types
- Move constructors
- Move assignment operators
- Using
std::move()
function - Perfect Forwarding
noexcept
keyword
Lambda expressions
- Lambda expressions
- Closure classes and objects
- Capturing local variables – closures
- Lambdas in C++14 – generic lambdas
- Passing lambdas to functions
- Storing lambdas in variables
Templates in C++11
- Static assertions -
static_assert
- Type Traits in Standard Library
- Variadic templates
Compile-time programming in C++11/14
- Running code at compile time
- constexpr expressions
- constexpr functions
Novelties in Standard Library
- Smart pointers -
std::unique_ptr
,std::shared_ptr
andstd::weak_ptr
- New features in STL containers (move semantics, new member functions, etc.)
std::array
– convenient wrapper for native arrays- Hash containers
- Tuples –
std::tuple
std::function
– callbacks in C++11/14- New STL algorithms
Writing asynchronous code in C++11/14
- Asynchronous functions –
std::async()
andstd::future
Prerequisites
Attendance of our Programming in C++ course or equivalent experience with C++