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