Skip to main content

  | मौसम…

411 समाचार
Public archive edition · Attributed source reporting with original dates · AI drafts are excluded

411 REFERENCE · Wikibooks

C++ Language/Type/Variant/OptionalValue

Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.

A variable whose type is std::optional<int> is similar to a pointer to int in the sense that its value might be std::nullopt (similar to a null pointer). In that case, we understand it to semantically mean that the variable "has no meaningful value". Otherwise, an int can be stored by assignment, and accessed by dereferencing. Additional information about optional-value (includes interactive examples)