|
MSTL 1.4.0
A Modern C++ Library with extended functionality, web components, and utility libraries
|
MSTL可选值类型 更多...
#include "MSTL/core/exception/exception.hpp"#include "MSTL/core/functional/invoke.hpp"#include "MSTL/core/memory/construct.hpp"#include "MSTL/core/utility/none.hpp"#include <initializer_list>类 | |
| class | optional< T > |
| 可选值类 更多... | |
| class | optional< T & > |
| 引用可选值类模板 更多... | |
函数 | |
| 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) |
| 获取可选值中的值 | |