34 constexpr optional() noexcept : _has_value(false)
36#if __cplusplus >= 202002L
37 if (std::is_constant_evaluated())
41#if __cplusplus >= 202002L
67 return this->_has_value;
70 constexpr T
value() const noexcept
82 constexpr T
value_or(
const T &other)
const noexcept
96 if (this->_has_value && other.has_value())
102 if (this->_has_value)
114 template <
class... Args> T &
emplace(Args &&...args)
constexpr T value() const noexcept
constexpr optional() noexcept
Constructs an optional that does not contain a value.
T value_type
The type of the optional value.
constexpr T operator->() const noexcept
constexpr T operator*() const noexcept
constexpr optional(T value) noexcept
void swap(optional &other) noexcept
Swaps the optional with another optional.
constexpr T value_or(const T &other) const noexcept
Returns the value of the optional or a default value.
optional operator=(T &value) noexcept
T & emplace(Args &&...args)
Constructs the value in place.
constexpr bool has_value() const noexcept
void swap(T &a, T &b) noexcept
Exchanges the values of a and b.