Examples of std::variant

This lesson explains the basic idea of ErrorCode.

Having learned most of the std::variant details, we can now explore a few examples.

Error Handling

The basic idea is to wrap the possible return type with some ErrorCode, and that way allow functions to output more information about the errors. Without using exceptions or output parameters.

Get hands-on with 1300+ tech skills courses.