7 #include <unordered_map>
24 template <
typename TEvent>
28 std::unordered_map<TEvent, std::vector<std::function<void()>>> _events;
31 void subscribe(
const TEvent& event,
const std::function<
void()>& lambda)
33 _events[event].push_back(lambda);
42 typename std::unordered_map<TEvent, std::vector<std::function<void()>>>::iterator it =
45 if (it == _events.end())
48 for (
const auto& funct : it->second)
void subscribe(const TEvent &event, const std::function< void()> &lambda)
void notify(const TEvent &event)