Created
November 20, 2012 12:47
-
-
Save WideWord/4117723 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <list> | |
| #include <functional> | |
| namespace timecraft { | |
| template<typename... T> class Event { | |
| private: | |
| std::list<std::function<void(T...)>> _list; | |
| public: | |
| inline const Event& operator+=(std::function<void(T...)> callback) { | |
| _list.push_back(callback); | |
| } | |
| inline void call(T... args) { | |
| for (auto f : _list) f(args...); | |
| } | |
| }; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment