Title: Theory / Unimportant / CS / Programming / C++ / STL / optional
Tags: constant

Typ: std::optional<T>
Meaning: Potentially a T value
Page: https://en.cppreference.com/w/cpp/utility/optional
Language: C++

Instruction: std::optional<T> {}
Page: https://en.cppreference.com/w/cpp/utility/optional/optional
Language: C++
Returns: An optional with no value
Exception: noexcept

Instruction: std::optional<T> {std::in_place, args}
Page: https://en.cppreference.com/w/cpp/utility/optional/optional
Language: C++
Returns: An optional with value T{args}
Exception: noexcept if T construction is noexcept

Instruction: opt *
Page: https://en.cppreference.com/w/cpp/utility/optional
Language: C++
Returns: the value contained in opt
Variables: std::optional<T> optional
Exception: noexcept

Instruction: optional.value()
Page: https://en.cppreference.com/w/cpp/utility/optional
Language: C++
Returns: the value contained in optional
Variables: std::optional<T> optional
Exception: std::bad_optional_access if *this does noptional contain a value.

Instruction: optional.value_or(v)
Page: https://en.cppreference.com/w/cpp/utility/optional
Language: C++
Returns: the value contained in optional if any, optionalherwise v
Variables: std::optional<T> optional
Exception: Any exception thrown by the selected constructor of the return value T.

Instruction: optional.and_then(f)
Page: https://en.cppreference.com/w/cpp/utility/optional
Language: C++
Returns: value of f on the value if it exists, optionalherwise empty optional
Variables: std::optional<T> optional
f: T -> optional<U>
Intuition: flatmap

Instruction: optional.transform(f)
Page: https://en.cppreference.com/w/cpp/utility/optional
Language: C++
Returns: optional f applied to the value if it exists, optionalherwise empty optional
Variables: std::optional<T> optional
Intuition: map

Instruction: optional.or_else(f)
Page: https://en.cppreference.com/w/cpp/utility/optional
Language: C++
Returns: the value if it exists, optionalherwise f()
Variables: std::optional<T> optional

Instruction: optional.reset()
Page: https://en.cppreference.com/w/cpp/utility/optional
Effect: remove the value of optional
Language: C++
Variables: std::optional<T> optional

Instruction: optional.emplace(args)
Page: https://en.cppreference.com/w/cpp/utility/optional
Effect: destroy contained value if any and replace it by T{args}
Language: C++
Variables: std::optional<T> optional

Question: The order on std::optional<T>
Answer: not defined is minimal. The underlying T order otherwise
Page: https://en.cppreference.com/w/cpp/utility/optional

Instruction: std::make_optional(args)
Page: https://en.cppreference.com/w/cpp/utility/optional
Language: C++
Returns: an optional constructed from args
Assuming: args rvalue

Constant: std::nullopt
Meaning: the optional empty value
Page: https://en.cppreference.com/w/cpp/utility/optional
Language: C++

Typ: std::nullopt_t
Meaning: an empty class type used to indicate optional type with uninitialized state
Page: https://en.cppreference.com/w/cpp/utility/optional
Language: C++