Build instructions:
git clone https://github.com/ReactiveX/RxCpp.git
make
./main
This is the output of the program:
===== println stream of std::string =====
s: Hello, Matthew!
s: Hello, Aaron!
===== process all items =====
async_fun() sending the first data immediately
OnNext:99
async_fun() inside async begin
OnNext:100
OnNext:101
OnNext:102
OnNext:103
async_fun() inside async end
OnCompleted
===== process all items and transform in a chain =====
async_fun() sending the first data immediately
Map: 99 -> 990
OnNext:990
async_fun() inside async begin
Map: 100 -> 1000
OnNext:1000
Map: 101 -> 1010
OnNext:1010
Map: 102 -> 1020
OnNext:1020
Map: 103 -> 1030
OnNext:1030
async_fun() inside async end
OnCompleted
===== process all items and transform between different types in a chain =====
async_fun() sending the first data immediately
Map: 99 -> 99.123
OnNext:99.123
async_fun() inside async begin
Map: 100 -> 100.123
OnNext:100.123
Map: 101 -> 101.123
OnNext:101.123
Map: 102 -> 102.123
OnNext:102.123
Map: 103 -> 103.123
OnNext:103.123
async_fun() inside async end
OnCompleted
===== process all items + exception =====
async_fun() sending the first data immediately
OnNext:199
async_fun() inside async begin
OnNext:200
OnNext:201
OnError: testing exception
async_fun() inside async end
===== process only the last item =====
async_fun() sending the first data immediately
async_fun() inside async begin
async_fun() inside async end
OnNext serves here also as OnCompleted:103
===== process all items producing sub items for each input item =====
flat_map create sub elements from i:1
flat_map create output element i:1 i_sub:101
OnNext: 1 - 101
flat_map create output element i:1 i_sub:102
OnNext: 1 - 102
flat_map create output element i:1 i_sub:103
OnNext: 1 - 103
flat_map create sub elements from i:2
flat_map create output element i:2 i_sub:201
OnNext: 2 - 201
flat_map create output element i:2 i_sub:202
OnNext: 2 - 202
flat_map create output element i:2 i_sub:203
OnNext: 2 - 203
flat_map create sub elements from i:3
flat_map create output element i:3 i_sub:301
OnNext: 3 - 301
flat_map create output element i:3 i_sub:302
OnNext: 3 - 302
flat_map create output element i:3 i_sub:303
OnNext: 3 - 303