|
| template<typename T, enable_if_t< is_constructible_v< decay_t< T >, T >, int > = 0> |
| constexpr optional< decay_t< T > > | make_optional (T &&value) noexcept(is_nothrow_constructible_v< optional< decay_t< T > >, T >) |
| | 从值创建可选值
|
| template<typename T, typename... Args, enable_if_t< is_constructible_v< T, Args... >, int > = 0> |
| constexpr optional< T > | make_optional (Args &&... args) noexcept(is_nothrow_constructible_v< T, Args... >) |
| | 原位构造可选值
|
| template<typename T, typename U, typename... Args> |
| constexpr enable_if_t< is_constructible_v< T, std::initializer_list< U > &, Args... >, optional< T > > | make_optional (std::initializer_list< U > ilist, Args &&... args) noexcept(is_nothrow_constructible_v< T, std::initializer_list< U > &, Args... >) |
| | 使用初始化列表原位构造可选值
|
| template<typename T> |
| constexpr optional< T & > | make_optional (T &value) noexcept |
| | 创建引用可选值
|
| template<typename T> |
| constexpr optional< remove_reference_t< T > & > | make_optional (T &&)=delete |
| template<typename T> |
| constexpr const T & | get (const optional< T > &opt) |
| | 获取可选值中的值
|
| template<typename T> |
| constexpr T & | get (optional< T > &opt) |
| | 获取可选值中的值
|
| template<typename T> |
| constexpr const T && | get (const optional< T > &&opt) |
| | 获取可选值中的值
|
| template<typename T> |
| constexpr T && | get (optional< T > &&opt) |
| | 获取可选值中的值
|