std::expect...::has_value(3)

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

✨ NAME ✨

std::expected::operatorbool,std::expected::has_value β€” std::expected::operatorbool,std::expected::has_value

Okay bestie, welcome to the std::expect...::has_value(3) page from the C++ Standard Libary manual πŸ’– this one is all about checking whether your std::expected is holding an expected value β€” very main character energy, no cap.


🌸 Synopsis 🌸

constexpr explicit operator bool() const noexcept;  (since C++23)
constexpr bool has_value() const noexcept;          (since C++23)

Checks whether *this contains an expected value. That's the whole vibe check ✨


πŸŽ€ Parameters πŸŽ€

(none) β€” no arguments, no extras, literally nothing to pass. Nada 🫢


πŸ’… Return value πŸ’…

  • true if *this contains an expected value
  • false if *this contains an unexpected value

πŸ¦‹ Notes πŸ¦‹

A std::expected object is never empty. If has_value() returns true, operator* can be used to access the contained value; otherwise, error() can be used.


πŸ”₯ Example πŸ”₯

This section is incomplete Reason: no example

Category: * Todo no example


πŸ‘‘ See also πŸ‘‘

  • operator-> accesses the expected value
  • operator* (public member function)
  • error returns the unexpected value (public member function)

That's the whole page, bestie 🫢 signing off from http://cppreference.com on 2024.06.10 β€” this was std::expect...::has_value(3), mwah πŸ’…βœ¨

πŸ“¦ where this page comes from