std::experi...::nullopt_t(3)
Hey bestie! π This is the std::experi...::nullopt_t(3) page from the C++ Standard Libary manual β yes, the header repeats std::experi...::nullopt_t(3), and we are not doing that twice, periodt. π
πΈ NAME πΈ
std::experi...::nullopt_t β literally std::experi...::nullopt_t. Thatβs the whole name, no cap. β¨
β¨ Synopsis β¨
Okay so hereβs where it lives and what it looks like:
Defined in header <experimental/optional>
struct nullopt_t; (library fundamentals TS)
std::experimental::nullopt_t is an empty class type used to indicate optional type with uninitialized state. In particular, std::experimental::optional has a constructor with nullopt_t as a single argument, which creates an optional that does not contain a value. π«Ά
std::experimental::nullopt_t must be a LiteralType and cannot have a default constructor. π
It must have a constexpr constructor that takes some implementation-defined literal type. π
π¦ Notes π¦
nullopt_t is not DefaultConstructible to support both op = {}; and op = nullopt; as the syntax for disengaging an optional object. Thatβs the whole vibe β itβs giving very deliberate design choice. π
A possible implementation of this class is:
struct nullopt_t
{
constexpr nullopt_t(int) {}
};
π See also π
nulloptβ an object of typenullopt_t(C++17) (constant)
π Category π
- Noindexed pages
Okay thatβs the page, bestie! Source/version/date sign-off: http://cppreference.com Β· 2024.06.10 Β· std::experi...::nullopt_t(3). Bye bestie, go disengage an optional responsibly ππ
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms