KwargsValue 的包装器,类似于 std::optional。
struct DataItem;| 名称 | 描述 |
|---|---|
DateItem |
构造函数。 |
| 名称 | 描述 |
|---|---|
valueOr |
构造函数。 |
hasValue |
构造函数。 |
| 名称 | 描述 |
|---|---|
operator-> |
构造函数。 |
构造函数。
constexpr DataItem(const KwargsValue* __that = nullptr) noexcept;返回指向数据的指针。
constexpr const KwargsValue* operator->() const noexcept;检查是否有键对应的值,如果有,返回 true,否则,返回 false。
constexpr bool hasValue() const noexcept;template<typename _ValueType, typename... _Args>
constexpr _ValueType valueOr(_Args&&... __args) const noexcept;-
_ValueType值的类型,需要显式指定,如果和原始值的类型不一致时将尝试使用内置类型转换器进行转换。
-
_Args参数列表的类型。
-
__args当对应的键没有值时,将使用该参数列表来调用
_ValueType的构造函数进行原地构造并返回。
dataItem.valueOr<std::string>(5, 'c');如果 std::string(5, 'c'),同等于 std::string("ccccc")。