Error reporting in C++ - Variants (12/13)

Опубликовано: 05 Апрель 2026
на канале: platis.solutions
117
7

Join me in these bi-weekly series to explore the topic of error reporting in C++.
The focus of this course is the design of functions that normally return a value, but an error may occur so, what should they return instead?

In this video we will be looking at returning a `std::variant` of an error code and the contents of the file.
`std::variant` is a C++17 type-safe union that may be one and only one of the types it holds.
This approach allows us to distinguish between different errors and the contents of the file are protected against accidental access.

The course is also available FOR FREE on Udemy.
It includes coding exercises so you can practice what you have learned.
Check it out and please consider leaving a review if you find it helpful: https://www.udemy.com/course/error-re...