Påbyggnadskurs i C++

I denna påbyggnadskurs i C++, fördjupar vi dina kunskaper i språket och dess bibliotek, med fokus på Modern C++. Kursen vänder sig till dig som nyligen börjat med C++ och vill gå vidare, eller till dig som arbetat i C++ men längre tillbaka i tiden och vill friska upp detaljerna. Du får lära dig om lambda uttryck, automatisk typinferens, move semantics med flera nya begrepp i språket. Men vi gör också en djuplodande översikt av befintliga delar av språket, som olika former av klassmedlemmar, templates och operator överlagring. Vidare, så gör vi en grundlig genomgång av standard bibliotektet, såsom containers och algorithms och nya tillägg såsom regex, smart pointers med flera.

Påbyggnadskurs i C++
3 dagar
Intermediate
Nyblivna eller ringrostiga C++ programmerare
Praktiska kunskaper 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.

  • Lambda expression
  • Automatic type identification with auto
  • Move semantics
  • Deep diving in different class member forms, templates and operator overlay
  • STL container classes, iterators and STL algorithms
  • Smart pointer types in stdlib ++
  • Use of regular expressions for recognition and compensation
  • Support for random number generation via stochastic distributions
  • Management of dates, times and time intervals
  • Write programs that use I / O streams and files
  • Review and exemplification of common C ++ idioms, such as RAII, own iterators, for-each,
  • How to implement separation of read / write with operator []
  • How C ++ is translated into C similar constructions

Part-1 - Modern C++

Presentation of syntax and library for Modern C++.

Evolution of C++

Quick recap how C++ have evolved over the years and what we and others mean with the phrase “Modern C++”.

  • Stroustrup
  • Evolution of Classic C++
  • Evolution of Modern C++
  • What is Modern C++, anyway
  • Recommended online resources

Syntax Enhancements in C++ 11/14/17

Presentation of the most important syntactic improvements of the language.

  • Automatic type inference
  • Java-style for-each loop
  • Uniform initializer syntax
  • Strongly types enums
  • Compile time constant expressions
  • Null pointer literal
  • Unicode support
  • Raw strings
  • Multi-line strings
  • Right-value references
  • Move semantics

Lambda Expressions

The most exciting syntax enhancement in Modern C++ is without doubt, lambda expressions

  • What is a lambda expression
  • Basic syntax
  • Capture of local variables in the surrounding scope
  • Writing functions that accept lambda expressions

Part-2 - C++ Language Topics

Review and discussion of common language topics.

More about Constructors & Members

Review of how to use constructors and declare class members.

  • Constructor chaining
  • Different ways of initialize member variables
  • Friends
  • Inline friend non-member functions
  • Move constructor
  • Move operator
  • Understanding move-semantics
  • Compiler generated members
  • How to enforce a compiler generated member
  • How to omit a compiler generated member
  • Using override and final function modifiers
  • Type conversion constructor
  • How to prevent implicit type conversion
  • Type conversion operator
  • Base class visibility
  • Default visibility of structs
  • How to emulate Java style interfaces

More about Templates

Review of how to declare and use template functions and classes.

  • What is a template
  • Function templates
  • Explicit type instantiation of functions
  • Template classes
  • Template methods
  • Template parameters
  • Template specialization
  • Type aliases
  • Type traits
  • Using decltype()
  • Variadic templates
  • Recursive templates

More about Operator Overloading

Review of how to implement and use operator overloading.

  • What is overloading operators
  • Overloadable operators
  • Cannot change the arity
  • Cannot change the precedence
  • Overloading of arithmetic operators
  • Overloading of relational operators
  • Overloading of increment operators
  • Overloading of the index operator
  • Overloading of the arrow operator
  • Overloading of the function call operator

Heap Allocated Objects

Review of the new/delete operators and how to use the placement variant of new.

  • The new & delete operators
  • The new & delete operators for arrays
  • The placement variant of new and how to use it
  • Overloading new & delete for your own class

Part-3 - Standard Libray

Presentation of the standard library in C++ 11/14/17.

Text Strings & Regexes

Discussions about the string class and how to work with regex objects.

  • The std::string class
  • String API
  • Useful functions/operators
  • Type conversion functions
  • String search
  • Character oriented functions
  • What is SSO (Short String Optimization)
  • Working with legacy C/C++ code, using text strings
  • Raw strings
  • Using a regex object
  • Regex match operation
  • Regex replace operation
  • Implementing split and join for text strings and list of strings

Helper Types

Presentation of some minor but still useful classes.

  • Using pair
  • Using tuple
  • Min/Max values of scalar types
  • Math functions
  • Complex numbers
  • Numeric array
  • Rational numbers
  • The chrono types
  • Durations
  • Time units
  • Time literals
  • Clocks
  • Random number generation
  • Supported stochastic distributions
  • Random number engines

STL Container Types

Presentation of all container types in the standar library.

  • What is a sequence container
  • Typical methods of a sequence container
  • vector
  • deque
  • array<T,N>
  • list
  • forward_list
  • What is an associative container
  • Implicit binary tree vs. hash table
  • Typical methods of an associative container
  • set
  • unordered_set
  • multiset
  • map<K,V>
  • unordered_map<K,V>
  • What is a container adapter
  • stack
  • queue
  • priority_queue
  • Container block allocators
  • User-defined allocator

STL Iterators & Intervals

Presentation of the important concept of an interval and how this is represented by two iterators.

  • What is an iterator
  • What is an interval
  • Iterator categories
  • (In/Out)put iterators
  • Forward iterators
  • Bidirectional iterators
  • Random access iterators
  • End-point adapters
  • I/O iterators
  • Iterator adaptors
  • Using a back-inserter

STL Algorithms

Presentation of STL algorithms used to operator on intervals, hence containers.

  • The STL architecture
  • Overview of STL algorithms
  • Different ways of providing the business logic to an algorithm function
  • Understand function suffixes
  • Using functions that take predicates
  • Using the transform() function
  • Using the accumulate() function
  • Sorting
  • Different ways to populate a container

I/O Streams & Files

Presentation of the stream sub-library.

  • The streams abstraction in C++
  • Class ostream, ofstream, ostringstream
  • Class istream, ifstream, istringstream
  • Manipulators
  • Bi-directional binary I/O
  • Stream position
  • Stream status
  • Understanding the typed input idiom
  • The line-oriented input idiom
  • The word-oriented input idiom
  • The character-oriented input idiom

Part-4 - Idioms & Techniques

Discussion of some advanced topics of C++ usage.

Smart Pointers

Discussion and implementation of the smart pointer concept and presentation of the smart pointer support in the standard library.

  • What is a smart pointer and which are the benefits
  • Basic implementation
  • Using a transfer class to make the compiler happy
  • To delete or not delete, that’s question
  • Different smart pointer concepts
  • UniquePtr
  • CopyPtr
  • RefCountPtr
  • Smart pointers in C++ 11
  • unique_ptr
  • shared_ptr
  • weak_ptr

Common C++ Idioms

Discussion and implementation of a set of well-proven common idioms inC++.

  • What is an idiom
  • Understanding the for-each loop
  • Supporting for-each in your own classes
  • Implementation of class Range
  • Implementation of class LineSlurper
  • Understanding static initializers
  • Supporting static initializers in your own classes
  • Overriding the index operator
  • How to differentiate between read and write for operator[]
  • Understanding the RAII idiom
  • Mutex locks
  • Debug tracing

Translating C++ into C

Discussion of how C++ is represented internally and how you can see that C++ is just a thin compile-time layer around C.

  • How the member variables of a class is represented
  • How member functions are represented
  • Understanding name-mangling
  • How method invocation is represented
  • How operators are represented
  • How constructors/destructors are represented
  • How class hierarchies are represented
  • How virtual methods are represented and works in run-time
  • How lambda expressions are represented
  • How exceptions are represented

Standards & Guidelines

Presentation of the standardization work, and the official guidelines for Modern C++

  • The standardization process
  • A new C++ standard every third year
  • Online compilers and why they are of use
  • The C++ Core Guidelines
  • GSL - The Guidelins Support Library