June 2018
Intermediate to advanced
348 pages
8h 45m
English
We have written our first custom operator as a unary function. All operators are unary functions that take Observables as a parameter. The function took observable<string> as a parameter and returned another observable<string>. We can achieve the same effect by writing an operator (inline) as a Lambda. Let's see how it can be done:
//----------- operatorInline.cpp #include "rxcpp/rx.hpp" #include "rxcpp/rx-test.hpp" #include <iostream> namespace rxu=rxcpp::util; #include <array> using namespace rxcpp; using namespace rxcpp::operators; int main() { std::array< std::string,4 > a={{"Praseed", "Peter", "Sanjay","Raju"}}; auto helloNames = [] (observable<std::string> src ) { return src.map([](std::string s) ...Read now
Unlock full access