CppAdv2021W49
Links zur Schulung (Beispiele/Übungen mit Online-Compiler / Infografiken)
Aufgaben und zugehörige Musterlösungen am Anfang
=== danach aktuellstes Element jeweils oben (damit man nicht immer scrollen muss) ===
https://onlinegdb.com/w2AzPk7ej
https://godbolt.org/z/Gon3Y4zdT
https://godbolt.org/z/hdTcGzjdq
https://tbfe.de/data/uploads/infographics/Example-OpenClosePrinciple.png
[CLOBS-32...37] ClobsObserver Exercise Step 5
- https://onlinegdb.com/-yuTq37pT (onlineGDB project to start with)
- https://onlinegdb.com/CGYjqZ4-T (Solution adapted to onlineGDB)
- https://onlinegdb.com/4j8sCxBUa Erweiterte Lösung:
- ObserverContainer based on std::set (avoiding multiple insertions)
- ObtainerContainer operationens are protected by mutex
- For test purposes that mutex may be locked via menu command X and Y
[CLOBS-27...31] ClockObserver Exercise Step 4
- https://onlinegdb.com/QHlCwh2H- (onlineGDB project to start with)
- https://onlinegdb.com/W0fzVukmV (Solution adapted to onlineGDB)
[CLOBS-20...26] ClockObserver Exercise Step 3
- https://onlinegdb.com/Sbt8f_N3M part 1 (template class Array)
- https://onlinegdb.com/Z32vfx7S_d part 2 (derived class ObserverArray)
[CLOBS-14...18] ClockObserver Exercise Step 2
- Start with solution from last step
Note that the Execute() to wrap in try-catch is in main.cpp (at the very end)
Note that SetClock() to modify is also in main.cpp (in class Application)
Understand that for manual testing- the main program will end after an exception is thrown ...
- ... unless you wrap the whole try-catch there in a loop
- https://onlinegdb.com/d3VzIBok4 (Solution adapted to onlineGDB)
[CLOBS-6...12] ClockObserver Exercise Step 1
- https://onlinegdb.com/LpgbK4Krr (onlineGDB project to start with)
- https://onlinegdb.com/rNx9P4pIvs (Solution adapted to onlineGDB)
Modifications made:- Flat file hierachie (no subdirectories)
- no namespaces (may be added after Exerrcise step 5)
- Application, SystemManager and Tests all in main.cpp
- Configuration via Preprocesssor Macros now in main.cpp
[KAPITEL-Seite]
[KAPITEL-Seite]
[DYNMM-38...50]
- https://godbolt.org/z/8367h45qb "Rule of Five" Beispiel aus Kapitel BAS vereinfacht mit std::unique_ptr als "Move-Only"-Klasse
- https://godbolt.org/z/z64x71E4a dto. erweitert mit "tiefem Kopieren"
- https://godbolt.org/z/fb9fhsb5f systematische "CopyTracker" Klasse ald Alternative zu Counter-Klasse mit einigen Testausgaben)
[DYNMM-38] Smart Pointer Überblick
[DYNMM-7ff] UB bei falscher Kombination von new/delete und new[]/delete[]
[CAST-18]
[EX-12]
- https://tbfe.de/data/uploads/infographics/ExceptionBasics.png
- https://tbfe.de/data/uploads/infographics/ExceptionDetails.png
[BASICS-80...87]
- https://tbfe.de/data/uploads/infographics/DiamondShapedInheritance.png
- https://tbfe.de/data/uploads/infographics/MultipleInheritance.png
[Basics-71]
- https://godbolt.org/z/vc99dj1sd (Vertiefung zu public/privat bei Basisklassen und zur vereinfachten Delehation mittels `using Base::...`)
[BASICS-36...46] State-Machine Beispiele
- https://godbolt.org/z/hsrYvb (wie in Schulungs-Unterlage)
- https://godbolt.org/z/rsne7M (einige kleinere Verbesserungen, z.B. neue "using"-typedefs)
- https://godbolt.org/z/GYT1hj (je eine (Sub-) Tabelle pro Zustand - realisiert mit multi_map)
- https://godbolt.org/z/PnY9Ks (dto., Zustände sind jetzt Zeiger auf jeweilige Sub-Tabelle)
[BASICS-30...35] Ergänzung Typ-Umwandlungen
- https://godbolt.org/z/GofjGqsxE (WeakTyped)
- https://godbolt.org/z/Y4n9WvxEK (StrongTyped)
- https://godbolt.org/z/3n4E95Gfr (ArithmeticType)
[BASICS-31...34]
- https://godbolt.org/z/drr8rzKfs (Beispiel wie abgedruckt ...)
- https://godbolt.org/z/bxsqKh8KK (... und mit einigen Erweiterungen)
[BASICS-26...28]
- https://godbolt.org/z/f6Y8rfP1a (Rule of Five)
- https://godbolt.org/z/r9Ks8bYEP (Copy vs. Move)
[BASICS-22]
- https://godbolt.org/z/8vqafTcMh (Mehrdeutigkeiten bei "Uniform Initialization")
[BASICS-11]
[BASICS-10]
- Seit C++11 ist die Typ-Deduktion im Compiler stark erweitert.
https://tbfe.de/data/uploads/infographics/New_in_C++11_C++14.png - Die Regeln sollen für den Entwickler "bequem" sein und unterscheiden sich daher von Fall zu Fall in den Details.
[BASICS-9]
[BASICS-8]
[INTRO-8]
[INTRO-5]
- Unsafe-Code: https://godbolt.org/z/1n3MPfb3M (Compiler Explorer)
dto. http://coliru.stacked-crooked.com/a/eb87439759ba4952 (Coliru)