#include template struct overloaded : Ts... { using Ts::operator()...; }; template auto match(const T& event, Ts&&... args){ return std::visit(overloaded{std::forward(args)...}, event); }