10#include "type_list.hpp"
62template <
typename... Events>
64 static_assert(
sizeof...(Events) > 0,
65 "variant_event cannot have empty EventList");
67 using base_type = std::variant<Events...>;
68 using base_type::base_type;
70 friend auto operator<<(std::ostream &stream,
variant_event const &event)
73 [&](
auto const &e) -> std::ostream & {
return stream << e; },
82template <
typename EventList>
83struct variant_or_single_event_impl
84 : std::type_identity<variant_event<EventList>> {};
86template <
typename Event>
87struct variant_or_single_event_impl<type_list<Event>>
88 : std::type_identity<Event> {};
102template <
typename EventList>
104 typename internal::variant_or_single_event_impl<
126template <
typename Visitor,
typename Event>
128 return visitor(std::forward<Event>(event));
136template <
typename Visitor,
typename EventList>
140 return std::visit(std::forward<Visitor>(visitor), std::move(event));
148template <
typename Visitor,
typename EventList>
152 return std::visit(std::forward<Visitor>(visitor), event);
160template <
typename Visitor,
typename EventList>
163 return std::visit(std::forward<Visitor>(visitor), event);
Variant event.
Definition variant_event.hpp:58
typename internal::variant_or_single_event_impl< unique_type_list_t< EventList > >::type variant_or_single_event
Select the plain event if single, otherwise tcspc::variant_event.
Definition variant_event.hpp:103
typename unique_type_list< TypeList >::type unique_type_list_t
Helper type for tcspc::unique_type_list.
Definition type_list.hpp:299
constexpr auto visit_variant_or_single_event(Visitor visitor, Event &&event)
Apply a visitor to an event that is not a tcspc::variant_event.
Definition variant_event.hpp:127
libtcspc namespace.
Definition acquire.hpp:29
Compile-time representation of a list of types.
Definition type_list.hpp:38