Created
May 18, 2018 00:21
-
-
Save veryjos/f359bc22a174f6b821710e9d36eebe17 to your computer and use it in GitHub Desktop.
This file contains 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 "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