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 153 of file variant.h.

153 {
154 if (_tag == Empty)
155 return;
156
157 // Fn is "a pointer to function taking (const void* storage, Visitor&)"
158 using Fn = void (*)(const void *, Visitor &);
159
160 // Build a constexpr array of one thunk per type in Types...
161 static constexpr Fn table[] = {
163
164 // _tag is 1-based, so dispatch in O(1) via one indirect call:
165 table[_tag - 1](&_storage, visitor);
166 }
char _storage[max_size< Types... >::value]
Definition variant.h:255
static void visit_fn_const(const void *storage, Visitor &v)
Definition variant.h:177
static constexpr Tag Empty
Definition variant.h:12