A wrapper for KwargsValue, similar to std::optional.
struct DataItem;| Name | Description |
|---|---|
DataItem |
Constructor. |
| Name | Description |
|---|---|
valueOr |
Returns the stored value or a default. |
hasValue |
Checks whether a value is present. |
| Name | Description |
|---|---|
operator-> |
Accesses the stored KwargsValue. |
Constructor.
constexpr DataItem(const KwargsValue* __that = nullptr) noexcept;Returns a pointer to the stored data.
constexpr const KwargsValue* operator->() const noexcept;Checks if a value is present for the corresponding key. Returns true if there is a value; otherwise, returns false.
constexpr bool hasValue() const noexcept;Returns the stored value if available; otherwise, constructs and returns a default value.
template<typename _ValueType, typename... _Args>
constexpr _ValueType valueOr(_Args&&... __args) const noexcept;-
_ValueTypeThe desired return type. Must be specified explicitly. If the actual value type is different, the built-in type converter will attempt conversion. -
_ArgsTypes of the arguments to be forwarded. -
__argsArguments forwarded to construct the default value if no stored value is present.
dataItem.valueOr<std::string>(5, 'c');If dataItem has no stored value, this will return std::string(5, 'c'), which is equivalent to "ccccc".