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 Composite/Visitor pattern for expression processing

To demonstrate the journey from the GoF pattern catalog to Observables, we will model a four-function calculator as a running example. Since expression trees or AST are hierarchical in nature, they will be a good example to model as a Composite pattern. We have purposefully omitted writing a parser to keep the code listing small:

#include <iostream> #include <memory> #include <list> #include <stack> #include <functional> #include <thread> #include <future> #include <random> #include "FuncCompose.h" // available int the code base using namespace std; //---------------------List of operators supported by the evaluator enum class OPERATOR{ ILLEGAL,PLUS,MINUS,MUL,DIV,UNARY_PLUS,UNARY_MINUS ...
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