Advanced C++ Programming

Contact Us for Dates
5 days practical workshop for up to 12 people.

Contact us for Onsite Price

This course is intended to teach C++ programmers more about the language and how to use it properly. This course is divided into four sections.

Layout

This training course combines lectures with practical exercises that help the delegates to put what they have learned on the training course into practice.  The exercises specifically build on what has been recently taught and are built up as the training course progresses.

Training Course Objectives

  • Using Language Features Correctly: this looks at various language areas that people may not know in detail, and where there may be confusion about exactly how things work. This first section gives students a solid foundation for the rest of the course.
  • Templates: students may well be familiar with templates to an extent, but even if they are, there are facets that they may not know. And since they form the basis of modern C++ (and hence most of the rest of the course), they need to be covered in depth.
  • C++ Idioms and Design Patterns: The unique features of C++ (specifically manual memory management and templates) present challenges to the programmer, and provide ways to overcome them. This section looks at a number of idioms and patterns, showing how they can be implemented in C++.
  • Standard Libraries: The final section looks at both the Standard Library and Boost, examining both in some detail.

Who it is for

This course is for experienced C++ programmers.

Training Course Prerequisites

  • Delegates should have practical experience of programming in modern C++. It is not suitable for those who have not programmed in C++ before. Note that the course can be run on Windows using Visual C++ or gcc, or on other platforms using gcc.

Chapters

Chapter 1 Const and Casting

  • Const correctness
  • Overloading on const
  • C++ cast operators
  • Mutable

Chapter 2 Conversions and Scope

  • Standard conversions
  • Converting constructors
  • User defined conversions
  • Namespaces
  • Koenig lookup
  • Nested types
  • Static

Chapter 3 Proper Exception Handling

  • Throwing and catching correctly
  • Exception safe code

Chapter 4 Memory Management

  • The new handler
  • Placement new
  • Overloading new and delete

Chapter 5 Template Functions

  • What are templates?
  • Implementing template functions
  • Template instantiation

Chapter 6 Template Classes

  • Creating a template class
  • Class instantiation
  • Non-type template parameters
  • Specialization

Chapter 7 Template Metaprogramming

  • A brief introduction to metaprogramming

Chapter 8 Implementing Value Types

  • What are value types?
  • Construction and destruction
  • Copying and assignment
  • Operator overloading

Chapter 9 The Handle/body Idiom

  • The Bridge design pattern
  • Using Bridge to decouple compilation
  • Implementing handle/body

Chapter 10 Functors

  • What are functors?
  • Implementing functors using operator overloading

Chapter 11 Smart Pointers

  • What are smart pointers?
  • Uses of smart pointers in C++
  • Implementing a simple smart pointer
  • Reference counting and smart pointers
  • Std::auto_ptr

Chapter 12 Singletons

  • The Singleton design pattern
  • A naïve implementation
  • Problems with Singleton in C++
  • Controlling Singleton lifetime

Chapter 13 STL Concepts

  • Concept-based programming
  • Containers, iterators and algorithms

Chapter 14 STL Containers

  • Sequence containers
  • Associative containers
  • Adapters

Chapter 15 STL Traits

  • The need for traits
  • Implementation of traits in STL

Chapter 16 STL Iterators

  • The Iterator design pattern
  • Iterator concepts in C++
  • Iterators and containers
  • Implementing and using iterators
  • Stream iterators

Chapter 17 STL Algorithms

  • The STL standard algorithms
  • Creating and using algorithms

Chapter 18 Introduction to Boost

  • What is Boost?
  • Obtaining and installing Boost
  • Overview of the Boost libraries

Chapter 19 Common Boost Libraries

  • boost::tuple
  • boost::any
  • boost::ref
  • The Boost smart pointers
  • boost::bind