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 135 of file InputBinding.cpp.
136{
138 return std::nullopt;
139 return std::visit([](const auto& v) -> std::optional<int32_t> {
140 using T = std::decay_t<
decltype(v)>;
141 if constexpr (std::is_same_v<T, int32_t>)
142 return v;
143 if constexpr (std::is_same_v<T, float>)
144 return static_cast<int32_t>(v);
145 return std::nullopt;
146 },
148}
References index.