Kurs i C++ 11/14/17 för C++ Programmerare

Kurs om nya standarden C++ 11/14/17 avseende både språk och bibliotek

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 standardbibiliotek, 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.

Vi kan inte motstå att citera Bjarne Stroupstrup , språkets upphovsman när han uttalar sig om detta:

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

Där han sätter fokus på att

...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.
Detta får du lära dig
  • Använda duck-typing med auto och Java-style for-each loopar
  • Fördjupa sig i tillämpning av lambda uttryck
  • Förstå, använda och själv realisera move semantics
  • Använda smarta pekare
  • Använda reguljära uttryck (regex) för sökning och substitution
Kursinnehåll

Background and Overview

Några ord om hur språket utvecklats och vad som avses med "Modern 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

    • 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
    SnabbFakta
    NamnC++ 11/14/17 för C++ Programmerare
    Längd3 Dagar
    NivåIntermediate
    Målgrupp Erfarna C++ programmerare som vill lära sig modern C++
    Förkunskaper Vana vid att programmera i klassisk C++
    Verktyg
    • GCC/G++ compiler, version 8 or later
    • Jetbrains CLion IDE
    • Ubuntu Linux @ VirtualBox or WLS @ Windows-10
    KursDatum
    DatumPlats PrisBoka
    Hämtar kursschema...
    19000

    Samma-Företags Rabatt

    Vi ger 20% rabatt för tillkommande deltagare från samma företag vid samma kurs-tillfälle. Läs mer här.

    Företagsintern Kurs

    Om du beställer en företagsintern kurs kommer vi till er och håller kursen i era lokaler. Priset bestäms av vår prismodell och baseras på antalet kursdagar, antalet deltagare, samt i förekommande fall resa och logi.

    Läs mer om vår prismodell och beställningsvillkor här.

    Relaterade Kurser
    KursDagarNivå
    C++ Programmering med Trådar3AdvancedVisa
    Linux Systemprogrammering i C++3AdvancedVisa
    Modern C++ Fördjupning3 IntermediateVisa