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;
__anonba2719620102()9     auto resource_factory = [](){return resource(rxcpp::util::to_vector({1, 2, 3, 4, 5}));};
__anonba2719620202(resource res)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(
__anonba2719620302(int v)14             [](int v){printf("OnNext: %d\n", v);},
__anonba2719620402()15             [](){printf("OnCompleted\n");});
16     printf("//! [scope sample]\n");
17 }
18