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 ...

Get C++ Reactive Programming now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.