std::expected::error(3)

πŸ“¦ version 2024.07.05, in nixpkgs unstable, opensuse-leap 16.0

πŸ’… std::expected::error(3) πŸ’…

okay bestie, welcome to the C++ Standard Libary manual page for std::expected::error(3). Yes, the header spells it "Libary" β€” I'm not fixing it, I'm respecting the source. Lowkey iconic. Highkey a mood. 🫢


🌸 NAME 🌸

std::expected::error β€” and the NAME section literally says std::expected::error again. Same energy, fr fr. Periodt. πŸ’…

✨ Synopsis ✨

Here are the overloads, all constexpr and all noexcept:

constexpr const E& error() const& noexcept;   (1) (since C++23)
constexpr E& error() & noexcept;              (2) (since C++23)
constexpr const E&& error() const&& noexcept; (3) (since C++23)
constexpr E&& error() && noexcept;            (4) (since C++23)

It accesses the unexpected value contained in *this. That's the vibe.

⚠️ The behavior is undefined if this->has_value() is true. Not a cute little oopsie β€” this is undefined behavior, bestie. That warning is the main character. 😭

πŸ“₯ Parameters πŸ“₯

(none) β€” no parameters, bestie. Zero. None. ✨

🎁 Return value 🎁

The return value is a reference to the unexpected value contained in *this. That's it, and it ate. πŸ’–

πŸ§ͺ Example πŸ§ͺ

This section is incomplete. Reason: no example. 😭 Not me showing up to an example section with zero example β€” the audacity β€” but that's literally what the page says. 🫠

πŸ‘€ See also πŸ‘€

  • operator-> β€” accesses the expected value
  • operator* β€” (public member function)
  • value β€” returns the expected value (public member function)
  • operator bool β€” checks whether the object contains an expected value
  • has_value β€” (public member function)

🏷️ Category 🏷️

  • Todo β€” no example

πŸ’– That's the page, bestie. Source/version: http://cppreference.com Β· date: 2024.06.10 Β· page: std::expected::error(3). Slay, bye! πŸŽ€

πŸ“¦ where this page comes from