In the article about std::expected, I introduced the type and showed some basic examples, and in this text, you’ll learn how it is implemented. A simple idea with struct In short, std::expected should contain two data members: the actual expected value and the unexpected error object. So, in theory, we could use a simple structure: