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

Cleanup with the finally() Operator

So far, in this chapter, we have seen that the source sequence in RxCpp can terminate gracefully after throwing exceptions. The finally() Operator is useful when we are using external resources, or when there's a need to free up some resources allocated in some other parts of the program. As we know, there are millions of lines of code that are already written for building various systems in C++, and it is highly likely that we need to handle resource management when using legacy external dependencies. This is a place where finally() comes in handy in RxCpp:

//------- Finally.cpp #include "rxcpp/rx.hpp" int main() { auto values = rxcpp::observable<>::range(1, 3). concat(rxcpp::observable<>:: error<int>(std::runtime_error("Error ...
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