ulib/3party/rxcpp/Rx/v2/examples/doxygen/default_if_empty.cpp
2024-01-10 09:33:36 +08:00

18 lines
424 B
C++

#include "rxcpp/rx.hpp"
#include "rxcpp/rx-test.hpp"
#include "catch.hpp"
SCENARIO("default_if_empty sample"){
printf("//! [default_if_empty sample]\n");
auto values = rxcpp::observable<>::empty<int>()
.default_if_empty(42);
values.subscribe(
[](int v) { printf("OnNext: %d\n", v); },
[]() { printf("OnCompleted\n"); } );
printf("//! [default_if_empty sample]\n");
}