diff options
author | Kirk Shoop <kirk.shoop@microsoft.com> | 2016-03-01 11:39:10 -0800 |
---|---|---|
committer | Kirk Shoop <kirk.shoop@microsoft.com> | 2016-03-01 11:39:10 -0800 |
commit | 8433dfe942088a572dba79518ba36427921d5b9f (patch) | |
tree | 428acf7ce9c8e02f6b153801f673e0f0ef968169 /Rx/v2/examples | |
parent | ec76ecc0a55c73d35c7cb0944f1563e039583499 (diff) | |
parent | 0b3e8b7b47a11d03cf66ce8de57bf1da9108ce3b (diff) | |
download | RxCpp-8433dfe942088a572dba79518ba36427921d5b9f.tar.gz |
Merge pull request #201 from kirkshoop/pr/200
add sample operator
Diffstat (limited to 'Rx/v2/examples')
-rw-r--r-- | Rx/v2/examples/doxygen/sample.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/Rx/v2/examples/doxygen/sample.cpp b/Rx/v2/examples/doxygen/sample.cpp new file mode 100644 index 0000000..1782af2 --- /dev/null +++ b/Rx/v2/examples/doxygen/sample.cpp @@ -0,0 +1,18 @@ +#include "rxcpp/rx.hpp" + +#include "rxcpp/rx-test.hpp" +#include "catch.hpp" + +SCENARIO("sample period sample") { + printf("//! [sample period sample]\n"); + auto values = rxcpp::observable<>::interval(std::chrono::milliseconds(2)). + take(7). + sample_with_time(std::chrono::milliseconds(4)); + values. + subscribe( + [](long v) { + printf("OnNext: %ld\n", v); + }, + []() { printf("OnCompleted\n"); }); + printf("//! [sample period sample]\n"); +} |