# C++ grundkurs

Nivå: beginner | Målgrupp: Tekniska programmerare | Förkunskaper: Praktiska kunskaper i något kompilerande språk
https://www.ribomation.se/programmerings-kurser/cxx-basics/

Nya standarden C++11/14/17 har tagit världen med storm och C++ har återtagit rollen som ett modernt
systemutvecklingsspråk. I denna kurs bygger vi effektivt upp dina nya kunskaper och färdigheter i Modern C++.

Den nya standarden C++11 har tagit världen med storm och C++ har återtagit rollen som ett modernt
systemutvecklingsspråk. Det publiceras en ny C++ standard vart tredje år. Den senaste är C++23.

I denna kurs bygger vi effektivt upp dina nya kunskaper och färdigheter i Modern C++.

- Programming in Modern C ++
- Use the standard library efficiently
- Design your own data types
- Understand and apply insights regarding memory management in C++
- Use auto (automatic type inference) almost always
- Use lambda expressions to improve and simplify your code
- Use std::string object productively
- Work with STL containers, iterators and algorithms
- Work file I/O and within the file system
- Understand how to use and implement template based functions and classes
- Understand how to use operator overloading
- Understand when to use derived classes and virtual functions

#### Background and Overview
- From `cfront`, Classic C++ and into Modern C++
- Design objectives
- Some myths and facts of C++

#### Scalar Types and Operators
- Integral types
- Floating-point types
- Boolean
- Characters
- Type variations, such as short/long, signed/unsigned
- Variables
- Lexical scopes
- Automatic type inference using `auto`

#### Composite Types
- Native arrays
- Struct
- Classes (briefly)
- Unions
- Enum types
- Name spaces
- Type aliases

#### Statements
- If statements
- While loops
- For loops
- Foreach loops
- Switch statements

#### Functions
- 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
- Lambda syntax
- Passing free variables by reference or value
- Functions taking lambdas as parameters and/or returning lambdas

#### Pointers and references
- 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
- 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
- ostream / ofstream / ostringstream
- istream / ifstream / istringstream
- Bidirectional I/O with fstream
- Manipulators
- The input idiom
- Line-oriented input
- Word-oriented input
- Character-oriented input

#### Helper Types
- Pair
- Tuple
- Date-times
- Durations
- Clocks
- Date formatting
- Random number generators

#### 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

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

#### 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_inserter iterators
- Transforming and aggregating
- Sorting
- Populating data into containers

#### Classes (*User Defined Types*)
- What is a user-defined type
- Specification vs. implementation
- Member variables and functions
- Object creation (instantiation)
- Visibility
- Constructors
- Destructor
- Inline member functions
- Member overloading
- The pointer `this`

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

#### 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 assigment operator

#### Heap Allocated Objects
- What is dynamic memory anyway
- Using the new and delete operators
- Pitfalls
- The placement variant of new

#### Exceptions
- What is an exception
- Throwing exceptions
- Catching exceptions
- The merits of automatic destruction during throw
- Exceptions in the standard library
- Pitfalls

#### Templates
- What is a template
- Function templates
- Class Templates
- Member function templates
- Template parameter forms
- Type equivalence
- Template specialization
- Pitfalls
- Type traits
- Using `decltype()`
- Variadic templates

#### Operator Overloading
- What is operator overloading
- Syntax
- Overloadable operators
- Rule set
- Overloading of arithmetic 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
- What 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
- Include files
- CPP constants
- Pre-defined constants
- Conditional compilation
- Include guards
- CPP macro functions
- Stringification and name-concatenation
- Assertions

#### Building 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
- Make
- GNU Autotools
- CMake
- Gradle
- Doxygen
- Google Test
- Catch2
- log4cxx
- Boost
- Poco

#### Standards and Guidelines
- 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
