Those are my solutions to the exercises from the 2024 C++ course at the Faculty of Mathematics, Informatics, and Mechanics of the University of Warsaw.
The course enhanced abilities in using C++ constructs like RAII, smart pointers, templates, lambdas, operator overloading, constexpr computation and modular architecture all while maintaining robust exception safety, effective resource handling and functional immutable abstractions.
Here is the quick rundown of those projects with the most important concepts and examples of usage thereof:
- Medals
std::regex: input validation- Error handling
- Strict STL usage
- String Queue
namespace,extern Cand header guards to connect C and C++- Safe global-state management, including avoiding static-initialization-order fiasco and properly hiding internal data structures
- Detailed diagnostic logging enabled/disabled conditionally via the
-DNDEBUGflag without changing the core logic
- Knights Tournament
- Explicit constructors, copy/move operations,
- Battle logic encoded through
<=>and==, - Operators += and + for looting knights,
constexprsupport and a compile-timeTRAINEE_KNIGHT(usage ofinline).- Formatted printing of the tournament state
constevalfunctionmax_diff_classes
- Binder
- Copy-on-write design: Internal state is shared with deferred copies upon modification; hence efficiency and iterator stability are maintained
- Strong exception safety: the state is preserved after an error occurs
- RAII-based resource management, including smart pointers
- Iterators: implementing a
std::forward_iteratorwith const-correct iteration.
- Counters
- C++20 modules: structure the program into
.cppmtranslation units providing stable interfaces and avoiding preprocessor directives - Strong input validation: instant error identification, with line number monitoring and rigid formatting rules preserving state without interruption
- C++20 modules: structure the program into
- Functional Lists
- Higher-order functions: Lists as folds
(f, a) → result - Type-generic callables: Operator templates need careful type propagation
std::functionto maintain type correctness- Copies by default;
std::refandstd::reference_wrapperfor references
- Higher-order functions: Lists as folds