Advanced Programming in C++

Course objectives

After completing this course you will be able to:

  • implement move semantics in classes
  • prevent memory leaks using smart pointers
  • write generic code using function and class templates, feature classes, and guidelines
  • use variadic templates
  • create data structures at the compilation stage - functions and constexpr constants

Course syllabus

Move semantics

  • l-value vs. r-value
  • r-value references – T&&
  • Implementing "move semantics" for types
  • Using std::move
  • Perfect forwarding
  • noexcept

Writing exception-safe code - RAII

  • Exception safety guarantees
  • RAII idiom (Resource Acquisition Is Initialization)

Smart pointers

  • Introduction to smart pointers
  • std::unique_ptr
  • std::shared_ptr
  • std::weak_ptr
  • Custom deallocators

Generic programming – templates

  • Introduction to generic programming
  • Function templates
  • Class templates
  • Template parameters
  • Templates specialization
  • Generic programming using traits and polices
  • <type_traits> library
  • Static assertions – enforcing constraints in generic code
  • SFINAE – choosing the optimal implementation at compile time

Variadic templates

  • Template parameter packs and function parameter packs
  • Programming with variadic templates
  • Metaprogramming with tuples - std::tuple (optional)
  • Creating and using index sequences (optional)

Constant expressions - constexpr

  • Constant expressions w C++11/14
  • Using constant expressions for generating data structures at compile time

Prerequisites

Attendance of our Programming in C++ course or equivalent experience with C++

Course duration

3 days, 8 class hours each
On-site course quote

In-house training course.

Run at your company premises.

Get a quote
On-line course quote

In-house training course.

Delivered live in a virtual classroom.

Get a quote
Upcoming public courses

No scheduled dates available for this course?

Request a course