First Technology Transfer

Standard and Advanced Technical Training, Consultancy and Mentoring

Course CPP102 - Advanced C++ Programming - STL and Design Patterns

Overview and Intended Delegates

Attendees are expected to have basic C++ programming experience. The purpose of the course is to provide an in depth coverage of idioms and design patterns and application development using the Standard Template Library (STL).

C++ is a rich programming language supporting a variety of distinct programming styles: procedural, object-oriented, and generic. This course aims to take programmers from a basic level of understanding to a much more advanced level. The course starts with an overview of existing C++ knowledge and common C++ programming idioms. This is followed by an in depth coverage of templates and the Standard Template Library (STL), and an overview of the Boost libraries.

Unlike some "advanced" courses, this one does cover complex and advanced material. It is essential that delegates possess a good basic knowledge (and have practical experience) of OO programming in C++. As well as being comfortable with the basic syntax, you should be familiar with declaring, defining and using classes, inheritance, and dynamic memory management.

Course Content

  • Overview of C++ Language Features
  • Const and Casting
    • Const correctness
    • Overloading on const
    • C++ cast operators
    • Mutable
  • Conversions and Scope
    • Standard conversions
    • Converting constructors
    • User defined conversions
    • Namespaces
    • Koenig lookup
    • Nested types
    • Static
  • Exception Handling
    • Throwing and catching exceptions
    • Exception safe code
  • Memory Management
    • The new handler
    • Placement new
    • Overloading new and delete
  • Template Functions
    • What are templates?
    • Implementing template functions
    • Template instantiation
  • Template Classes
    • Creating a template class
    • Class instantiation
    • Non-type template parameters
    • Specialization
  • Template Metaprogramming
    • A brief introduction to metaprogramming
  • C++ Idioms and Design Patterns
    • Implementing Value Types
      • What are value types?
      • Construction and destruction
      • Copying and assignment
      • Operator overloading
    • The Handle/body Idiom
      • The Bridge design pattern
      • Using Bridge to decouple compilation
      • Implementing handle/body
    • Functors
      • What are functors?
      • Implementing functors using operator overloading
    • 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
    • Singletons
      • The Singleton design pattern
      • A naive implementation
      • Problems with Singleton in C++
      • Controlling Singleton lifetime
  • Standard Template Library
    • STL concepts
      • Concept-based programming
      • Containers, iterators and algorithms
    • Containers
      • Sequence containers
      • Associative containers
      • Adapters
    • Traits
      • The requirement for traits
      • How traits are implemented in STL
    • Iterators
      • The Iterator design pattern
      • Iterator concepts in C++
      • Iterators and containers
      • Implementing and using iterators
      • Stream iterators
    • Algorithms
      • The STL standard algorithms
      • Creating and using algorithms
  • Further Widely Used Patterns - by Example
    • Subject-Observer Pattern
    • Creational - Factory Patterns
    • Subject-Observer Pattern
    • Composite, Facade, Flyweight and Proxy Patterns
    • Command, Interpreter and State Patterns
  • Introduction to Boost
    • Background to Boost
    • Obtaining and installing Boost
    • Overview of the Boost libraries
  • Common Boost Libraries
    • boost::tuple
    • boost::any
    • boost::ref
    • The Boost smart pointers
    • boost::bind
  • Multi-threaded programming in C++ and the C++11 Standard
  • Traits and Metaprogramming in C++ and the C++11 Standard
  • Smart pointers and the C++11 Standard