diff options
author | Grigoriy Chudnov <g.chudnov@gmail.com> | 2016-02-26 14:53:20 +0300 |
---|---|---|
committer | Kirk Shoop <kirk.shoop@microsoft.com> | 2016-03-01 07:25:31 -0800 |
commit | 0b3e8b7b47a11d03cf66ce8de57bf1da9108ce3b (patch) | |
tree | 428acf7ce9c8e02f6b153801f673e0f0ef968169 /Rx/v2/examples | |
parent | ec76ecc0a55c73d35c7cb0944f1563e039583499 (diff) | |
download | RxCpp-0b3e8b7b47a11d03cf66ce8de57bf1da9108ce3b.tar.gz |
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"); +} |