Extract an int32 argument by index.
float arguments are truncated to int32_t.
- Parameters
-
| index | Argument index (0-based). |
- Returns
- Int value, or std::nullopt if out of range or wrong type.
Definition at line 130 of file InputBinding.cpp.
131{
133 return std::nullopt;
134 return std::visit([](const auto& v) -> std::optional<int32_t> {
135 using T = std::decay_t<
decltype(v)>;
136 if constexpr (std::is_same_v<T, int32_t>)
137 return v;
138 if constexpr (std::is_same_v<T, float>)
139 return static_cast<int32_t>(v);
140 return std::nullopt;
141 },
143}