std:optional
a view containing at most one element. (C++26) - HN
the idea of βan optional type is a list with zero or one items in itβ is much more normal in functional places
The original design (N3527 over a decade ago) for std::optional specifically says itβs not the container with exactly zero or one items
Scala has it like this since day one. Tried to convince D to adopt it, but was unsuccessful.
Written on November 23, 2025, Last update on November 23, 2025
c++
optional
rust
scala
dlang