9template <
typename... Types>
class Variant {
32 copy_construct_from(other);
84 template <
typename T,
typename... Args>
102 template <
typename T>
bool is() const noexcept {
106 template <
typename T> T *
ptr() {
110 template <
typename T>
const T *
ptr()
const {
111 return is<T>() ?
reinterpret_cast<const T *
>(&
_storage) :
nullptr;
128 template <
typename T>
bool equals(
const T &other)
const {
136 template <
typename Visitor>
void visit(Visitor &visitor) {
141 using Fn = void (*)(
void *, Visitor &);
146 static constexpr Fn table[] = {
153 template <
typename Visitor>
void visit(Visitor &visitor)
const {
158 using Fn = void (*)(
const void *, Visitor &);
161 static constexpr Fn table[] = {
170 template <
typename T,
typename Visitor>
173 v.accept(*
reinterpret_cast<T *
>(storage));
176 template <
typename T,
typename Visitor>
179 v.accept(*
reinterpret_cast<const T *
>(storage));
184 using Fn = void (*)(
void *);
191 template <
typename T>
static void destroy_fn(
void *storage) {
192 reinterpret_cast<T *
>(storage)->~T();
197 using Fn = void (*)(
void *,
const Variant &);
198 static constexpr Fn table[] = {&Variant::template
copy_fn<Types>...};
203 template <
typename T>
205 new (storage) T(*
reinterpret_cast<const T *
>(&other.
_storage));
210 using Fn = void (*)(
void *,
Variant &);
211 static constexpr Fn table[] = {&Variant::template
move_fn<Types>...};
212 table[other._tag - 1](&
_storage, other);
229 return type_to_tag_impl<T, Types...>::value;
239 template <
typename T,
typename U,
typename... Rest>
249 template <
typename T,
typename... Args>
void construct(Args &&...args) {
char _storage[max_size< Types... >::value]
Variant & operator=(Variant &&other) noexcept
Variant & operator=(const T &value)
Variant & operator=(const Variant &other)
void construct(Args &&...args)
static void visit_fn_const(const void *storage, Visitor &v)
static void visit_fn(void *storage, Visitor &v)
Variant(const Variant &other)
static constexpr Tag Empty
static constexpr Tag type_to_tag()
fl::enable_if< contains_type< T, Types... >::value, T & >::type emplace(Args &&...args)
static void move_fn(void *storage, Variant &other)
static void copy_fn(void *storage, const Variant &other)
void destroy_current() noexcept
void visit(Visitor &visitor) const
Variant & operator=(T &&value)
void visit(Visitor &visitor)
bool empty() const noexcept
static void destroy_fn(void *storage)
void copy_construct_from(const Variant &other)
bool equals(const T &other) const
Variant(Variant &&other) noexcept
void move_construct_from(Variant &other) noexcept
constexpr remove_reference< T >::type && move(T &&t) noexcept
constexpr T && forward(typename remove_reference< T >::type &t) noexcept
Implements a simple red square effect for 2D LED grids.
static FASTLED_NAMESPACE_BEGIN uint8_t const p[]
static constexpr Tag value
static constexpr Tag value
static constexpr bool value