Skip to content

Instantly share code, notes, and snippets.

@veryjos
Created May 18, 2018 00:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save veryjos/f359bc22a174f6b821710e9d36eebe17 to your computer and use it in GitHub Desktop.
Save veryjos/f359bc22a174f6b821710e9d36eebe17 to your computer and use it in GitHub Desktop.
#include "Events.hpp"
#include <string>
using namespace tdrp;
struct Resource {
EventDispatcher<std::string, int> evtUpdated;
};
int main(int argc, char* argv[]) {
Resource r;
auto eventHandle = r.evtUpdated.Subscribe([](std::string s, int v) {
printf("shit!\n");
});
r.evtUpdated.Post("resource updated", 36);
r.evtUpdated.Unsubscribe(eventHandle);
r.evtUpdated.Post("resource updated", 37);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment