Skip to content

Instantly share code, notes, and snippets.

@Razzo78
Last active February 8, 2018 07:47
Show Gist options
  • Save Razzo78/b73bb79ed7b9a9d265a47bad232e7b3b to your computer and use it in GitHub Desktop.
Save Razzo78/b73bb79ed7b9a9d265a47bad232e7b3b to your computer and use it in GitHub Desktop.
C++, ReactiveX - How to call on_next from a declared observable
rxcpp::subjects::subject<int> sub;
auto o = sub.get_subscriber();
auto source = sub.get_observable();
source.subscribe(
[](int v) {printf("OnNext: %d\n", v); },
[]() {printf("OnCompleted\n"); });
o.on_next(1);
o.on_next(2);
o.on_next(3);
o.on_completed();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment