5using namespace std::chrono_literals;
11 std::chrono::steady_clock::time_point start{};
12 std::chrono::milliseconds delay;
16 const std::chrono::milliseconds &delay)
17 : callable(callable), delay(delay) {}
20 auto val = callable();
23 return decltype(val){};
25 auto now = std::chrono::steady_clock::now();
30 auto diff = now - start;
31 return diff / delay % 2 ?
decltype(val){} : val;
39 std::chrono::steady_clock::time_point start{};
40 std::chrono::milliseconds delay;
44 const std::chrono::milliseconds &delay)
45 : callable(callable), delay(delay) {}
49 auto now = std::chrono::steady_clock::now();
50 if (now > start + delay) {
Definition: EventToggle.h:35
constexpr ToggleEvent(Callable callable, const std::chrono::milliseconds &delay)
Definition: EventToggle.h:43
constexpr bool operator()()
Definition: EventToggle.h:47
Definition: EventToggle.h:7
constexpr TurboEvent(Callable callable, const std::chrono::milliseconds &delay)
Definition: EventToggle.h:15
constexpr auto operator()()
Definition: EventToggle.h:19