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

◆ visit() [1/2]

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

Definition at line 154 of file variant.h.

154 {
155 if (_tag == Empty)
156 return;
157
158 // Fn is "a pointer to function taking (void* storage, Visitor&)"
159 using Fn = void (*)(void *, Visitor &);
160
161 // Build a constexpr array of one thunk per type in Types...
162 // Each thunk casts the storage back to the right T* and calls
163 // visitor.accept
164 static constexpr Fn table[] = {
166
167 // _tag is 1-based, so dispatch in O(1) via one indirect call:
168 // Check bounds to prevent out-of-bounds access
169 size_t index = _tag - 1;
170 if (index < sizeof...(Types)) {
172 }
173 }
char _storage[max_size< Types... >::value]
Definition variant.h:294
static void visit_fn(void *storage, Visitor &v)
Definition variant.h:197
static constexpr Tag Empty
Definition variant.h:14

Referenced by fl::Gradient::Gradient().

+ Here is the caller graph for this function: