summaryrefslogtreecommitdiff
path: root/Rx/v2/examples/doxygen/sample.cpp
blob: 1782af2420b48993d415746b785ec6b4a25f470f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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");
}