10#ifndef WS2812_RMT_DETAIL_HPP
11#define WS2812_RMT_DETAIL_HPP
17namespace ws2812_rmt::detail {
32template <
typename Port,
typename Sig>
33 requires std::is_class_v<Port> && std::is_function_v<Sig>
37template <
typename Port,
typename R,
typename... Args>
38 requires std::is_class_v<Port>
39struct ExactHook<Port,
R(Args...) noexcept> {
41 static void Take(
R (Port::*hook)(Args...) noexcept) noexcept;
43 static void Take(
R (Port::*hook)(Args...) const noexcept) noexcept;
48concept ClassType = std::is_class_v<T>;
53inline constexpr bool kAlwaysFalse =
false;
57concept Enumeration = std::is_enum_v<E>;
63template <Enumeration E>
64[[nodiscard]]
constexpr std::underlying_type_t<E> ToUnderlying(E e)
noexcept {
65 return static_cast<std::underlying_type_t<E>
>(e);
72template <Enumeration E>
79template <Enumeration E>
80[[nodiscard]]
constexpr bool IsEnumerator(E e)
noexcept {
81 return static_cast<uint32_t
>(ToUnderlying(e)) <=
82 static_cast<uint32_t
>(ToUnderlying(EnumLast<E>::kValue));