Skip to Content
C++ Reactive Programming
book

C++ Reactive Programming

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

Converting an arbitrary Lambda to a custom Rx operator

In the previous section, we learned that it is possible to use the lift<t> operator to implement custom operators that can be part of the operator chaining infrastructure of the RxCpp library. The workings of lift<T> are a bit complicated and we will write an Adapter class to convert an arbitrary Lambda that takes a parameter (of the basic types) to a form where the lift<T> operator can be applied.

The adapter code will help us to make calls such as this:

observable<T>::lift<T>( liftaction( lambda<T> ) )

Let's write an Adapter class implementation and a generic function wrapper on top of it to be consumed in a program:

//----------- operatorLiftSecond.cpp #include "rxcpp/rx.hpp" #include ...
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

Functional Programming in C++

Functional Programming in C++

Ivan Cukic

Publisher Resources

ISBN: 9781788629775Supplemental Content