summaryrefslogtreecommitdiff
path: root/Rx/v2/examples/doxygen/scan.cpp
blob: 2a49efdb62f2e10a89d7a42cdc091e1b43e88467 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include "rxcpp/rx.hpp"

#include "rxcpp/rx-test.hpp"
#include "catch.hpp"

SCENARIO("scan sample"){
    printf("//! [scan sample]\n");
    auto values = rxcpp::observable<>::range(1, 7).
        scan(
            0,
            [](int seed, int v){
                return seed + v;
            });
    values.
        subscribe(
            [](int v){printf("OnNext: %d\n", v);},
            [](){printf("OnCompleted\n");});
    printf("//! [scan sample]\n");
}