Maki
Loading...
Searching...
No Matches
event.hpp
1//Copyright Florian Goujeon 2021 - 2025.
2//Distributed under the Boost Software License, Version 1.0.
3//(See accompanying file LICENSE or copy at
4//https://www.boost.org/LICENSE_1_0.txt)
5//Official repository: https://github.com/fgoujeon/maki
6
7#ifndef MAKI_EVENT_HPP
8#define MAKI_EVENT_HPP
9
10#include <type_traits>
11
12namespace maki
13{
14
18template<class T>
19struct event_t
20{
24 using type = T;
25};
26
31template<class T, class U>
32constexpr bool operator==(const event_t<T> /*lhs*/, const event_t<U> /*rhs*/)
33{
34 return std::is_same_v<T, U>;
35}
36
41template<class T>
42constexpr auto event = event_t<T>{};
43
44namespace detail
45{
46 template<class T>
47 struct is_event
48 {
49 static constexpr auto value = false;
50 };
51
52 template<class T>
53 struct is_event<event_t<T>>
54 {
55 static constexpr auto value = true;
56 };
57
58 template<class T>
59 constexpr bool is_event_v = is_event<T>::value;
60}
61
62} //namespace
63
64#endif
The Maki library.
Holds an event type.
Definition event.hpp:20
constexpr bool operator==(const event_t< T >, const event_t< U >)
Returns whether T and U are the same type.
Definition event.hpp:32
T type
An alias for the given type.
Definition event.hpp:24