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 115 of file InputBinding.cpp.
116{
118 return std::nullopt;
119 return std::visit([](const auto& v) -> std::optional<float> {
120 using T = std::decay_t<
decltype(v)>;
121 if constexpr (std::is_same_v<T, float>)
122 return v;
123 if constexpr (std::is_same_v<T, int32_t>)
124 return static_cast<float>(v);
125 return std::nullopt;
126 },
128}