this post was submitted on 24 Jun 2025
14 points (100.0% liked)

C++

2040 readers
1 users here now

The center for all discussion and news regarding C++.

Rules

founded 2 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[โ€“] bollybing@lemmynsfw.com 3 points 1 week ago (1 children)
[โ€“] nodeluna@programming.dev 1 points 1 week ago

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