Course in C++ 11/14/17 for C++ Programmers

Course about the new standard C++ 11/14/17 covering both the language and the library

We ourselves are lyrical over how C++ has developed as a language and system development platform during recent years. With the new standard C++ 11/14/17 C++ has become a strong challenger to modern cool languages. C++ has characteristics like duck-typing, lambda expressions and a rich standard library, all executed i a speed that no other languages can dream about.

This course is aimed at you who already works with C++, but wants to know and get familiar with what the concept Modern C++ really means

We can't 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 sets 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
  • Using duck-typing with auto and Java-style for-each loops
  • Understand how to apply lambda expressions
  • Understand, apply and realize move semantics
  • Using smart pointers
  • Using regex for searching and substitution
Course Contents

Background and Overview

Briefly about the language evolution and what does the term Modern C++ mean

    Syntactic improvements of the language

    • For-each loops
    • Uniform initializer
    • Static initializer lists and collections
    • Member variable initialization
    • Usage of nullptr
    • Variable initialization in if and switch statements
    • Enforcing compiler generated members
    • Deleting compiler generated members
    • Grouping in integral literals
    • Binary literals
    • Nested namespaces

    Automatic Type Inference (auto)

    • Usage of auto
    • Flexible variable declarations with auto
    • Functions returning auto
    • Pinpointing the return type of an auto-return function

    Handy Helper Types

    • Usage of std::pair
    • Usage of std::tuple
    • Structured binding, a.k.a. multi-assignment
    • Initializing more than a single variable of different types, in a for-loop
    • Dealing with absence of data using std::optional
    • Dynamically typed variable using std::any
    • Type-safe unions with std::variant
    • Using std::bitset
    • Writing and reading bitset objects
    • Working with compile-time rational numbers std::ratio
    • Arithmetic and relational operations on ratio objects

    Lambda Expressions

    • What is a lambda expression?
    • Lambda declaration syntax
    • Invoking lambda expressions
    • Understanding capturing to access variables in the surrounding lexical scope
    • Writing functions that take lambdas as a parameter
    • Returning lambdas from functions

    Move Semantics

    • Understanding references
    • The key difference between rvalue and lvalue references
    • What is move semantics?
    • Implementing move constructors and assignment operators
    • How is move semantics utilized in the standard library

    Enhanced Templates

    • Type traits
    • Type operators
    • Understanding constexpr functions
    • Using static_assert
    • Using constexpr if statements to guide the compiler
    • Inline variables
    • Using auto for non-type template parameters
    • Variadic templates
    • Fold expressions

    User-Defined Suffix Literal Operators

    • What is a suffix operator?
    • Operator definition syntax
    • Type restrictions
    • Example, implementing suffix operators and operations for the length units kilometre and English mile

    Improved String Handling

    • SSO – Short string optimization
    • The string suffix operator
    • Numeric conversion functions
    • Using to/from_chars
    • Raw strings
    • Unicode support
    • Added functions
    • Fast phrase searching using Boyer-Moore and similar algorithm implementations

    Using string_view projections

    • What is string_view?
    • Working with std::string_view objects
    • The string_view suffix operator
    • Converting to std::string objects
    • Example, parsing a HTTP request string

    Regex support

    • What is a regex
    • Creating std::regex objects
    • Matching strings with patterns
    • Searching with patterns
    • Replacing string fragments based on patterns
    • Iterating over a string, based on patterns
    • Splitting and joining strings

    Date/Time/Clock handling

    • Working with clocks
    • Understanding the difference between high_resolution/system/steady _clock
    • Implementing a versatile function that computes the elapsed time
    • Working with std::chrono::duration objects
    • Duration literals and suffix operators
    • Using std::chrono::duration_cast
    • Working with std::chrono::time_point objects
    • Time conversion functions
    • Printing formatted date-time values
    • Parsing formatted date-time values
    • Setting the iostream locale

    Smart pointers

    • What is a smart pointer, and why should I bother
    • Using std::unique_ptr objects to manage heap allocated blocks
    • The convenience of using factory functions
    • Adding a custom deleter to a smart pointer
    • Working with legacy memory allocations and smart pointers
    • Using std::shared_ptr objects to keep track of heap allocated objects using reference counting

    Random Number Generation

    • Random generation engines
    • Stochastic distributions in the library
    • Generating random numbers
    • STL functions that uses random generator engines

    Additional STL Container Types

    • Compile-time sized container using std::array
    • Hash-set based containers, std::unordered_set/map
    • Understand the std::hash function
    • User-defined hash function
    • Single-linked list std::forward_list
    • STL adapter iterator factory functions

    Files and File Systems

    • Working with fs::path objects
    • Manipulating path objects
    • Extracting path components
    • Using path predicates
    • Iterating over directory entries
    • Using fs::directory_entry objects
    • Recursively iterating over directory entries
    • Working with POSIX permissions
    • File manipulation operations
    • Reading the content of a text file into a std::string object in one single step
    • Typical file usage idioms

    Threading Support

    • What is a thread?
    • What is the POSIX Threads API?
    • Creating std::thread objects
    • Waiting for thread termination
    • Sleeping and yielding
    • Obtain the number of processing units (aka CPU)
    • Using std::mutex objects and locking
    • Implementing an ostream synchronized output adapter
    • Recursive and timed locks
    • Lock adapters
    • Read/Write locks
    • Using std::condition_variable objects for inter-thread communication
    • Deadlock avoiding multi-locking
    • Atomic operations types

    Asynchronous Tasks

    • What are promises and futures?
    • Sending data via a std::promise
    • Receiving data via a std::future
    • Launching std::async tasks
    • Launch policies
    • Broadcasting results using std::shared_future

    Upcoming/Planned Features in the Standard

    • Parallel versions of STL algorithms
    • Pipeline data streams using STL ranges
    • Compile-time validation of template arguments using concepts
    • Synchronized output stream wrapper
    • Calendar operations
    • Time-zone operations
    Facts
    NameC++ 11/14/17 for C++ Programmers
    Duration3 Days
    LevelIntermediate
    Audience Experienced C++ programmers, that wants to get up to speed with Modern C++
    Prerequisites Working knowledge of programming in Classic C++
    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
    Threads Programming using Modern C++3AdvancedShow
    Linux Systems Programming using Modern C++3 AdvancedShow
    C++ Supplementary3Intermediate Show