Course CPP102
Advanced C++ Programming - STL and Design Patterns
Advanced C++ Programming - STL and Design Patterns
Duration: 5 Days
Intended Audience
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).
Synopsis
Synopsis
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.
Prerequisites
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.
The class involves a lot of practical work, so delegates should come along prepared to get coding. The course will use the GNU C++ compiler and Eclipse. [If required this course can be run using Microsoft Visual Studio C++ compiler]
Publicly scheduled dates, locations, and prices
A schedule of dates for this subject is not currently available. Please call Ajay Patel on 02086471939 to enquire about places and availability.
Contents:
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
Part 3: 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 naïve 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
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
