C++ Reactive Programming
上QQ阅读APP看书,第一时间看更新

A Tour of Modern C++ and its Key Idioms

The classic C++ programming language was standardized in 1998 and it was followed by a small revision (mostly corrections) in 2003. To support advanced abstractions, developers relied on the Boost (http://www.boost.org) library and other public domain libraries. Thanks to the next wave of standardization, the language (from C++ 11 onward) was enhanced, and now developers can encode most widely used abstractions (supported by other languages) without relying on external libraries. Even threads and file-system interfaces, which came squarely under the aegis of libraries, are now part of the standard language. Modern C++ (which stands for C++ versions 11/14/17 ) contains superb additions to the language and its libraries, that make C++ the de-facto choice for writing industrial strength production software. The features covered in this chapter are the minimum set of features that a programmer has to understand to work with Reactive Programming constructs in general and RxCpp in particular. The primary objective of this chapter is to cover the most important additions to the language which makes implementing Reactive Programming constructs easier without resorting to esoteric language techniques. Constructs such as Lambda functions, automatic type inference, rvalue references, move semantics, and language level concurrency are some of the constructs which the authors of this book feel that every  C++ programmer should know. In this chapter, we will cover the following topics:

  • Key concerns for C++ programming language design
  • Some enhancements to C++ for writing better code
  • Better memory management through rvalue references and move semantics
  • Better object lifetime management using an enhanced set of smart pointers
  • Behavioral parameterization using Lambda functions and expressions
  • Function Wrappers (the std::function type)
  • Miscellaneous features
  • Writing Iterators and Observers (to put everything together)