ImFusion SDK 4.3
Overloaded< Ts > Struct Template Reference

#include <ImFusion/Core/Utils/Overloaded.h>

Syntactic sugar for easier implementation of visitors of a std::variant or our Utils::Variant. More...

+ Inheritance diagram for Overloaded< Ts >:

Detailed Description

template<class... Ts>
struct ImFusion::Utils::Overloaded< Ts >

Syntactic sugar for easier implementation of visitors of a std::variant or our Utils::Variant.

Can be used like this:

[](const Foo& foo) { computeFoo(foo); },
[](const Bar& bar) { computeBar(bar); },
[](const Baz& baz) { computeBaz(baz); }
}, var);
Syntactic sugar for easier implementation of visitors of a std::variant or our Utils::Variant.
Definition Overloaded.h:30
T visit(T... args)

You can also put a [](const auto& default) { computeDefault(default); } in the overload set if you would like to implement a default handler instead of an individual handler for each type. However, be aware that it will bind to anything and therefore increase the chance of introducing bugs due to unexpected implicit conversions or when extending the variant at a future time.

See also
https://en.cppreference.com/w/cpp/utility/variant/visit

The documentation for this struct was generated from the following file:
Search Tab / S to search, Esc to close