Extract a float argument by index.
int32_t arguments are widened to float.
- Parameters
-
| index | Argument index (0-based). |
- Returns
- Float value, or std::nullopt if out of range or wrong type.
Definition at line 120 of file InputBinding.cpp.
121{
123 return std::nullopt;
124 return std::visit([](const auto& v) -> std::optional<float> {
125 using T = std::decay_t<
decltype(v)>;
126 if constexpr (std::is_same_v<T, float>)
127 return v;
128 if constexpr (std::is_same_v<T, int32_t>)
129 return static_cast<float>(v);
130 return std::nullopt;
131 },
133}
References index.