C++: TODO List¶
Move C++03 and C++11, and “C++: Miscellaneous Live-Hacking” into new group, “C++”
Depend c++11 on c++03, topic by topic
Bring pieces of C++: Miscellaneous Live-Hacking to where they belong
STL, Containers and Algorithms¶
make UserDB_Map exercise refer to multimap<>
extract back-insert-iterator thing, and link to copy<>, reverse_copy<>: Copying and Reversing
Make an exercise out of
C style error handling. One return value and one output parameter. Ugly. https://github.com/jfasch/2021-12-06/blob/main/live-hacking/exceptions/exceptions.cpp
Only slightly better: pack both into one
std::exception, uncaught (⟶ terminates). https://github.com/jfasch/2021-12-06/blob/main/live-hacking/exceptions/exception-exc.cpp
Custom exceptions; order of handling. https://github.com/jfasch/2021-12-06/blob/main/live-hacking/exceptions/exceptions-custom.cpp
Functors: Overloading the Function Call Operator¶
(Better not use integers, better use custom class. User?)
Function with 3 parameters: “How to order 2 numbers”. https://github.com/jfasch/2021-12-06/blob/main/live-hacking/functors/calloperator-problem.cpp
… but want only two ⟶ class with
Sort takes comparison function with two arguments. Hardcode one (and be hardcoded to one particular sort order). https://github.com/jfasch/2021-12-06/blob/main/live-hacking/functors/sort-problem.cpp
Functor given to
Doing all this with Lambda. https://github.com/jfasch/2021-12-06/blob/main/live-hacking/functors/sort-lambda.cpp
Start parameters: thread-with-start-parameters.cpp
Lost increment (aka “Mother of All Race Conditions”): thread-lost-increment.cpp
Using a mutex (“toilet door lock”): thread-no-lost-increment-mutex.cpp
Same, but encapsulating the racy integer together with a mutex in a class that behaves like an integer: thread-no-lost-increment-mutex-beautiful.cpp
For integers, though, there is a better way to safety - atomics: thread-no-lost-increment-atomic-fast.cpp
C++ >= 11¶
Building a sum in 1000 different ways (from completely old-school to range based for to
Same with strings. https://github.com/jfasch/2021-12-06/blob/main/live-hacking/sum-strings.cpp
Add boost test
Define requirement: add interface
UserDB_Vectorderive from it.
swap()example from livehacking
User: how to transform pointers into references.
Complete Transcription of C++11¶
Many of the chapters from the LaTex deck haven’t yet been transcribed.
Introduce dependencies from C++11 into C++03 into C
Some subgroups. For example
explicit. See here for a live-hacked explanation.
Bring this as a screenplay.
point in C
point in C++, members and ctors
shapes, based upon point (circle, triangle, rectangle, …)
Split More Constructors, Destructors in two.
Plain ctor, initializer list.
rectin the middle.
Resource management separated, as a preparation to what follows: Object Copy (And Resource Management): There Be Dragons