June 2018
Intermediate to advanced
348 pages
8h 45m
English
To kickstart the discussion, let's write a simple operator that works on observable<string>. The operator just prepends the literal text Hello before each item in the stream:
//----------- operatorSimple.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;
// Write a Simple Reactive operator Takes an Observable<string> and
// Prefix Hello to every item and return another Observable<string>
observable<std::string> helloNames(observable<std::string> src ) {
return src.map([](std::string s) { return "Hello, " + s + "!"; });
}
The custom operator that we have implemented is written ...
Read now
Unlock full access