Toast Engine
Loading...
Searching...
No Matches
defer.hpp
Go to the documentation of this file.
1
6
7#pragma once
8
9#include "toast/events/event.hpp"
10#include "toast/export.hpp"
11
12#include <functional>
13
14namespace toast {
15
16namespace _detail {
17
18struct TOAST_API Defer : event::Event<Defer> {
19 std::function<void()> cb;
20
21 Defer(std::function<void()>&& fn) : cb(std::move(fn)) { }
22};
23
24}
25
26inline TOAST_API void defer(std::function<void()> fn) {
27 event::send<_detail::Defer>(std::move(fn));
28}
29}
Member-robber pattern used by the generated reflection code.
Definition defer.hpp:16
Base class for all events. Derive your event type as struct Derived : Event<Derived>.
Definition event.hpp:78