Modern C++ 11/14/17

Vi är själva lyriska över hur C++ utvecklats som språk och systemutvecklingsplattform de senaste åren. Med nya standarden C++ 11/14/17 har C++ blivit en stark utmanare till hippa moderna språk. C++ har egenskaper som duck-typing, lambda uttryck och ett rikhaltigt standard-bibliotek, allt exekverat i en hastighet som alla andra språk inte ens kan drömma om. Denna kurs vänder sig till dig som redan arbetar i C++, men vill förstå och sätta dig in vad begreppet Modern C++ verkligen innebär.

Modern C++ 11/14/17
3 dagar
Intermediate
Rutinerade C++ programmerare
Kunna programmera i C++
  • GNU C++ Compiler, version 9 or later
  • Jetbrains CLion
  • Ubuntu Linux
Här ser du vilka kursdatum som är tillgängliga. Klicka på en av datumknapparna för att anmäla dig till ett kurstillfälle. På kursen pratar läraren svenska, medan vårt kursmaterial alltid är författat på engelska.

Du sitter bekvämt framför datorn och deltar i kursen via internet. Vi använder programvaran Zoom för alla våra fjärrkurser.

I priset ingår kursmaterial som PDF.

Pris: 15 000 kr + MOMS/VAT (25%)

Du sitter bekvämt i ett av våra klassrum, vilka finns centralt placerade i Stockholms innerstad (Östermalmstorg).

I priset ingår tryckt kursmaterial (och som PDF), samt kaffe/te med smörgås på förmiddagen och kaffe/te med bulle på eftermiddagen.

Pris: 20 000 kr + MOMS/VAT (25%)

Om ni är tre eller fler personer från samma företags, kan ni beställa en företagsanpassad kurs. Då håller vi kursen på ett datum som passar er. Antingen på plats i era lokaler eller som en fjärrkurs. Vi kan även mixa fjärr- och klassrumskurs, om några av er önskar delta på distans medan resten föredrar att ses på plats.

Företagsanpassad Kurs

Här är ett sammandrag av vad du får lära dig på kursen.

  • Use duck typing with auto and Java-style for-each loops Immerse yourself in the application of lambda expressions
  • Understand, use and realize move semantics yourself
  • Use smart pointers
  • Use regular expressions (regex) for search and substitution

Evolution of C++

  • From cfront, Classic C++ and into Modern C++
  • Design objectives
  • Some myths and facts of C++

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

  • Good support for user-defined memory management (std::pmr)
  • 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