this post was submitted on 24 Jun 2025
14 points (100.0% liked)
C++
2040 readers
2 users here now
The center for all discussion and news regarding C++.
Rules
- Respect instance rules.
- Don't be a jerk.
- Please keep all posts related to C++.
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
what don't u get it? why did I make this? or what is the point of this type?
if you are unfamiliar with std::expected then check out https://en.cppreference.com/w/cpp/utility/expected.html
it's basically a type that let you return either a "value" or an "error" and the caller of the function has to check which did the function return. it's a modern way of handling errors in C++ that was introduced in C++23