Home | History | Annotate | Download | only in doxygen
      1 #include "rxcpp/rx.hpp"
      2 
      3 #include "rxcpp/rx-test.hpp"
      4 #include "catch.hpp"
      5 
      6 SCENARIO("scope sample"){
      7     printf("//! [scope sample]\n");
      8     typedef rxcpp::resource<std::vector<int>> resource;
      9     auto resource_factory = [](){return resource(rxcpp::util::to_vector({1, 2, 3, 4, 5}));};
     10     auto observable_factory = [](resource res){return rxcpp::observable<>::iterate(res.get());};
     11     auto values = rxcpp::observable<>::scope(resource_factory, observable_factory);
     12     values.
     13         subscribe(
     14             [](int v){printf("OnNext: %d\n", v);},
     15             [](){printf("OnCompleted\n");});
     16     printf("//! [scope sample]\n");
     17 }
     18