Course in Modern C++

Fundamental course in Modern C++, based on the new standard C++ 11/14/17

The new standard C++ 11/14/17 has made a big impression on the world and C++ has retaken the role as a modern system development language. In this course we effectively develop your new knowledge and skills in modern C++-

We can not resist to quote Bjarne Stroupstrup, the creator of the language when he speaks about this:

Within C++ is a smaller, simpler, safer language struggling to get out.

Where he puts the focus on that

...code that is statically type safe, has no resource leaks, and catches many more programming logic errors than is common in code today. And it will run fast.
This is what you will learn
  • Program in Modern C++
  • Effective usage of the standard library
  • Design user-defined data types
  • Understand and apply insights regarding memory management in C++
Course Contents

Background and Overview

A few words about the evolution of the language

    Scalar Types and Operators

    The fundamentals of the syntax

    • Integral types
    • Floating-point types
    • Boolean
    • Characters
    • Type variations, such as short/long, signed/unsigned
    • Variables
    • Lexical scopes
    • Automatisk typinference med "auto"

    Composite Types

    Overview of the composite types

    • Native arrays
    • Struct
    • Classes (briefly)
    • Unions
    • Enum types
    • Name spaces
    • Type aliases

    Statements

    Overview of all statement constructs

    • If statements
    • While loops
    • For loops
    • Foreach loops
    • Switch statements

    Functions

    Functions and all their variants

    • Function syntax
    • Call by-value vs. call by-reference
    • Return by reference
    • Overloaded functions
    • Default parameters
    • Template functions
    • Extern declarations
    • Compilation units
    • Program organization
    • Linking C code

    Lambda Expressions

    With the introduction of lambda expressions, C++ have defenitely entered the stage of modern and hip languages

    • Lambda syntax
    • Passing free variables by reference or value
    • Functions taking lambdas as parameters and/or returning lambdas

    Pointers and references

    Discussion of the pointer concept in C/C++ and why you need to be cautious

    • Pointer declarations
    • Dereferencing operator
    • Address operator
    • Pointer arithmetics
    • Dangling pointers
    • The illusion of arrays
    • Nativ text strings and the danger of using them
    • Pointers to struct/class objects
    • Function pointers
    • References
    • Call-by reference
    • Return by-reference
    • What is move semantics
    • Rvalue references

    Text Strings and Regexs

    The majority of bugs in C/C++ programs has their root in wrong usage of text strings. Just by consequently use std::string instead, the code quality increases significantly. In this chapter we discuss how to use the string class and utilize regex for searching and substitution.

    • Why using std::string instead of nativ strings
    • Overview of std::string and its functions/operators
    • What is SSO (Short String Optimization) and how it is used
    • Working with legacy strings
    • Character oriented functions
    • Multi-line string literals
    • What is a regex
    • The regex support in modern C++
    • Matching text data to patterns
    • Searching using patterns
    • Replacing text fragments using patterns
    • Using regex iterators
    • Typical use cases
    • Splitting and joining strings

    I/O Streams and Files

    In this chapter we discuss how to apply formatted I/O with the console, files, and buffers.

    • ostream / ofstream / ostringStream
    • istream / ifstream / istringstream
    • Bi-directional I/O with fstream
    • Manipulators
    • The input idiom
    • Line-oriented input
    • Word-oriented input
    • Character-oriented input

    Helper Types

    Discssion of helper classes and function you need to know about

    • Pair
    • Tuple
    • Date-times
    • Durations
    • Clocks
    • Date formatting
    • Random number generators

    Container Types

    Discussion of the STL container types

    • Sequence containers and typical methods
    • vector / dequeue / array
    • list / forward_list
    • Associative containers
    • Tree vs. hash implementations
    • Unique vs. multi-key versions
    • set / unordered_set
    • map / unordered_map
    • Container adapters

    Iterators and Intervals

    Discussion of the STL iterator concept

    • What is an iterator
    • What is a range and how is it used
    • Iterator categories
    • I/O iterators
    • End-point adapter functions

    STL Algorithms

    Discussion of STL algorithms

    • What is a std::* algorithm
    • The STL architecture
    • How to pass the business logic into algorithm functions
    • Understanding *_n and *_if suffixes of functions
    • Using functions with predicates
    • Using back_insereter iterators
    • Transforming and aggregating
    • Sorting
    • Populating data inot containers

    Classes (User Defined Types)

    How to define user-defined types, aka classes

    • What is a user-defined type
    • Specification vs. implementation
    • Member variables and functions
    • Object creation (instantitation)
    • Visibility
    • Constructors
    • Destructor
    • Inline member functions
    • Member overloading
    • The pointer 'this'

    Class Member Forms

    Discussion of all variants of class member forms

    • Class variables and functions
    • Member references
    • Read-only variables
    • Const marked functions
    • Inner classes
    • Friend declarations

    Constructors and Destructors

    All you need to know about constructors and destructors

    • Initialization
    • Default constructor
    • Destructor
    • Copy constructor
    • Assignment operator
    • Pitfalls
    • Standardized class form
    • Enforcing compiler-generated members
    • Deleting compiler-generated members
    • Type conversion constructor
    • Type conversion operator
    • What is move semantics
    • Move constructor
    • Move assinment operator

    Heap Allocated Objects

    How to create and maintain dynamically allocated memory blocks

    • What is dynamic memory anyway
    • Using the new and delete operators
    • Pitfalls
    • The placement variant of new

    Exceptions

    How to deal with exceptions

    • What is an exception
    • Throwing exceptions
    • Catching exceptions
    • The merrits of automatic destructions during throw
    • Exceptions in the standard library
    • Pitfalls

    Templates

    C++ is primarly a template meta-programming langauge. In this chapter we tell you more.

    • What is a template
    • Function templates
    • Class Templates
    • Member function templates
    • Template parameter forms
    • Type eqiuvalence
    • Template specialization
    • Pitfalls
    • Type traits
    • Using decltype()
    • Variadic templates

    Operator Overloading

    User-defined operator overloading is the key to DSL (Domain Specific Language).

    • What is operator overlaoding
    • Syntax
    • Overloadable operators
    • Rule set
    • Overloading of arithemtic operators
    • Overloading of relational operators
    • Overloading of I/O operators
    • Overloading of ++/-- operators
    • Overloading of the index operator
    • Overloading of the arrow operator
    • Overloading of the function-call operator

    Inheritance and Virtual Functions

    Here we discuss class hierachies, inheritance and virtual functions

    • Whats is inheritance
    • Syntax
    • Protected visibility
    • Invocation of super-class members
    • References and pointers of root class type
    • Performing down-casts using dynamic_cast
    • Constructor initialization order
    • Base class visibility
    • Virtual member functions and why they are important
    • Abstract functions
    • Use of override and final specifiers
    • Multiple inheritance and why you need to be careful
    • Implementing Java-style interfaces in C++

    The Pre-Processor

    How to use the C pre-processorm; when to use and when not to

    • Include files
    • CPP constants
    • Pre-defined constants
    • Conditional compilation
    • Include guards
    • CPP macro functions
    • Stringification and name catenation
    • Assertions

    Building C++ Applications

    Brief discussion about how to compile and build C++ applications

    • Compilation steps
    • What is an abstract syntax tree (AST)
    • The assembler
    • Inline assembly code
    • The linker
    • Name mangling of C++ names
    • Inspecting the linker symbol table
    • The loader
    • Tracing executions
    • Compiler flags for warnings
    • Compiler flags for optimizations
    • Compiler flags for debugging
    • Creating a static archive file
    • Creating a dynamic linked library

    Build Tools and Open-Source Libraries

    Overview of some build tools and open-source libraries

    • Make
    • GNU Autotools
    • CMake
    • Gradle
    • Doxygen
    • Google Test
    • log4cxx
    • Boost
    • Poco

    Standards and Guidelines

    The C++ standardization process

    • Tracking the standard
    • Tracking compilers and what they support
    • Online compilers
    • The big C++ conference (cppcon)
    • The C++ Core Guidelines
    • GSL - The Guidelines Support Library
    Facts
    NameModern C++
    Duration5 Days
    LevelBeginner
    AudienceTechnical Programmers
    Prerequisites Practical knowledge in any compiling language
    Tools
    • GCC/G++ compiler, version 8 or later
    • Jetbrains CLion IDE
    • Ubuntu Linux @ VirtualBox or WLS @ Windows-10
    On-Site Course

    If you order an On-Site course, we will come to you and hold the course in your office. The price is determined by our price model and is based on the number of course days, number of participants and any travel and lodging.

    Read more about out price modell and term of sales here.

    Related Courses
    CourseDaysLevel
    Unit Testing in C++ with Google Test1IntermediateShow
    C++ Supplementary3IntermediateShow
    Threads Programming using Modern C++3 AdvancedShow
    Linux Systems Programming using Modern C++3AdvancedShow
    C++ 11/14/17 for C++ Programmers3IntermediateShow