• Home
  • History
  • Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #include "rxcpp/rx.hpp"
2 
3 #include "rxcpp/rx-test.hpp"
4 #include "catch.hpp"
5 
6 SCENARIO("any sample") {
7     printf("//! [any sample]\n");
__anon511fbf700102(int n) 8     auto values = rxcpp::observable<>::from(1, 2, 3, 4, 5).any([](int n) { return n > 3; });
9     values.
10             subscribe(
__anon511fbf700202(bool v) 11             [](bool v) { printf("OnNext: %s\n", v ? "true" : "false"); },
__anon511fbf700302() 12             []() { printf("OnCompleted\n"); });
13     printf("//! [any sample]\n");
14 }
15 
16 SCENARIO("any - operator syntax sample") {
17     using namespace rxcpp;
18     using namespace rxcpp::sources;
19     using namespace rxcpp::operators;
20 
21     printf("//! [any - operator syntax sample]\n");
22     auto values = range(1, 10)
__anon511fbf700402(int n) 23         | any([](int n) { return n == 1; });
24     values.
25             subscribe(
__anon511fbf700502(bool v) 26             [](bool v) { printf("OnNext: %s\n", v ? "true" : "false"); },
__anon511fbf700602() 27             []() { printf("OnCompleted\n"); });
28     printf("//! [any - operator syntax sample]\n");
29 }