Skip to Main Content
C++ Reactive Programming
book

C++ Reactive Programming

by Praseed Pai, Peter Abraham
June 2018
Intermediate to advanced content levelIntermediate to advanced
348 pages
8h 45m
English
Packt Publishing
Content preview from C++ Reactive Programming

A tale of two Operators – flatmap versus concatmap

A source of confusion among developers is often centered around the flatmap and concatmap  Operators. Their differences are really important and we will cover them in this section. Let's take a look at the flatmap  operator and how it works:

//----------- Flatmap.cpp #include "rxcpp/rx.hpp" #include "rxcpp/rx-test.hpp" #include <ioStream> namespace rxu=rxcpp::util; #include <array> int main() { std::array< std::string,4 > a={{"Praseed", "Peter", "Sanjay","Raju"}}; //---------- Apply Flatmap on the array of names //---------- Flatmap returns an Observable<T> ( map returns T ) //---------- The First lamda creates a new Observable<T> //---------- The Second Lambda manipulates primary Observable ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Boost.Asio C++ Network Programming Cookbook

Boost.Asio C++ Network Programming Cookbook

Dmytro Radchuk

Publisher Resources

ISBN: 9781788629775Supplemental Content