Existing error handling mechanisms in the C++ language, such as status codes and exceptions, suffer from shortcomings in safety, predictability, or informativeness.
This thesis systematically analyzes these approaches and introduces the std::expected template class from the C++23 standard as a solution.
Using a practical refactoring case study, we demonstrate how std::expected overcomes the limitations of previous solutions through explicit and type-safe error handling.
The key contribution is demonstrating that std::expected offers a balanced combination of performance, safety, and code readability, thereby representing a robust foundation for writing reliable software in the modern C++ language.
|