Introduction to modern C++ (slides) and code samples from Lectures

 

Notes: compile with c++11 / c++14 / c++17 / c++20 switch enabled. E.g. g++ -std=c++20. If needed, add -lpthread to link against thread library.

Review material for basic C++ prerequisites (fundamental programming course level, up to classes)

http://www.icce.rug.nl/documents/cplusplus/  (good and didactic reference)

 

 

L/R-values, move semantics and r-value references, perfect forwarding, auto, range-based loops, nullptr, scoped enums :

Meyers-MoveSemantics (slides)

Meyers-cpp11NotesSample.pdf slide set: slides [1-7] + [18-34]

http://www.codeproject.com/Articles/397492/Move-Semantics-and-Perfect-Forwarding-in-Cplusplus   (perfect-forwarding)

 

 

STL

- containers (vector, set, map, multi-set, multi-map, string)

- iterators

- algorithms and numeric algorithms

- lambdas

- optional

- asyncs and threads

- random and chrono libraries

 

 

PHAST library

- PHAST web site  (register to download documentation)

- presentation (NOTE: phast::transform has changed ... now a for_each needs to be used in its place)

Miscellaneous material:

https://smartbear.com/blog/develop/the-biggest-changes-in-c11-and-why-you-should-care/?q=biggest+c+++care  

https://smartbear.com/blog/develop/c11-tutorial-introducing-the-move-constructor-and/?q=c%2B%2B+++move+assignement

Documentation and reference material about C++: Cpp Annotations web site (useful also for refreshing some basic knowledge of C++: classes, constructors, life-cycle, operators overload, function objects, introduction to STL standard template library with containers algorithms and iterators)

C++ Reference (Entry + intermediate): cplusplus.com

C++ Reference (intermediate to advanced): cppreference.com

Tables with compilers, and versions, that support each modern (11,14,17,2a) C++ feature

Exception safety levels

 

 

 

 

 

 

Some suggested exercises:

- perform timing of different variations of the Big-number class usage, adopting moves where appropriate vs using copies

- implement two versions of a sample code that manages a scoresheet, e.g. for a sportive event (managing a player_name/team_name and the score). One version using a std::map< > and one using a std::vector< std::pair< >>, reimplementing the basic "map" funcionalities: insert and lookup. Compare timing.