Загрузка...

the expected outcome - Ivan Čukić - Meeting C++ 2022

the expected outcome - Ivan Čukić - Meeting C++ 2022
Slides: https://slides.meetingcpp.com
Survey: https://survey.meetingcpp.com

There is a plethora of ways to do error handling in C++ and all have their pros and cons.

In C++23, we got yet another option to encode errors in the types themselves with std::expected. Some features are still missing and will only come in C++26, but as this is a library feature, we can easily roll up a complete "expected" and use it long before 2026 comes knocking. There are also alternatives to std::expected in the form of Boost.Outcome which, albeit with some philosophical and practical differences, model a similar thing.

In this talk, we will cover what std::expected and similar types are all about and how they can be used for unified error handling. We will also see some more advanced usage patterns that make working with expected-like types a more pleasant task than doing the if-error-handle-else-proceed dance all the time.

The last part of the talk will focus on integrating expected-like types with C++20 coroutines for people who want to have a more familiar syntax for handling errors with expected-like types that looks like try-catch blocks that we have with C++'s exceptions, but without all the baggage that exceptions bring with them.

While the ideas that will be covered in the talk are very beginner friendly, some implementation details that we'll cover are more involved.

Видео the expected outcome - Ivan Čukić - Meeting C++ 2022 канала Meeting Cpp
Страницу в закладки Мои закладки
Все заметки Новая заметка Страницу в заметки

На информационно-развлекательном портале SALDA.WS применяются cookie-файлы. Нажимая кнопку Принять, вы подтверждаете свое согласие на их использование.

Об использовании CookiesПринять