FastLED 3.9.15
Loading...
Searching...
No Matches

◆ visit() [2/2]

template<typename... Types>
template<typename Visitor>
void fl::Variant< Types >::visit ( Visitor & visitor) const
inline

Definition at line 175 of file variant.h.

175 {
176 if (_tag == Empty)
177 return;
178
179 // Fn is "a pointer to function taking (const void* storage, Visitor&)"
180 using Fn = void (*)(const void *, Visitor &);
181
182 // Build a constexpr array of one thunk per type in Types...
183 static constexpr Fn table[] = {
185
186 // _tag is 1-based, so dispatch in O(1) via one indirect call:
187 // Check bounds to prevent out-of-bounds access
188 size_t index = _tag - 1;
189 if (index < sizeof...(Types)) {
191 }
192 }
char _storage[max_size< Types... >::value]
Definition variant.h:294
static void visit_fn_const(const void *storage, Visitor &v)
Definition variant.h:205
static constexpr Tag Empty
Definition variant.h:14