In this section, we will implement range-based for loops on a custom type written by us to help you understand how all the things mentioned earlier in this chapter can be put together to write programs that support modern idioms. We will implement a class that returns a series of numbers within a bound and will implement infrastructure support for the iteration of the values based on range-based for loops. First, we write the "Iterable/Iterator" (aka "Enumerable/Enumerable") version by leveraging the range-based for loops. After some tweaks, the implementation will be transformed to Observable/Observer (the key interface of Reactive Programming) patterns: The implementation of Observable/Observer pattern ...
Range-based for loops and observables
Get C++ Reactive Programming now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.