Skip to content

Instantly share code, notes, and snippets.

@WideWord
Created November 20, 2012 12:47
Show Gist options
  • Select an option

  • Save WideWord/4117723 to your computer and use it in GitHub Desktop.

Select an option

Save WideWord/4117723 to your computer and use it in GitHub Desktop.
#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