Transducers allow to express transformations on sequential inputs (like std::transform, std::filter, most of boost::range::adators [4] and more) in a way that is independent of the input source. They are simple high order functions agnostic of the notion of iterator or collection and can be combined by simple function composition. They can later be applied eagerly or lazily over iterators, but most interestingly, also to other kinds of "reactive" sources, like networked streams, inter-process channels or reactive observables (e.g. RxCpp [3]). Not only they provide an elegant decoupling between the "what" and the "how" and higher level of reuse, their implementation is often simpler and and more performant than similar boost::range adaptors.
Transducers were introduced in Clojure by Rich Hickey [2]. At Ableton we implemented them in C++ and released them as part of our Open Source modern C++ toolkit: Atria [1]. Our implementation introduces innovations of its own, like implementing state-full transducers without mutation, enabling further safety and reusability. We also use Eric Niebler's technique [5] to describe and check its concepts in standard compliant C++11.
In this session we will introduce the concept of transducers and how they can be implemented in modern C++. We will also cover some of the most interesting use-cases.
[1] https://github.com/AbletonAG/atria
[2] http://clojure.org/transducers
[3] https://github.com/Reactive-Extensions/RxCpp
[4] http://www.boost.org/doc/libs/1_58_0/libs/range/doc/html/range/reference/adaptors.html
[5] http://ericniebler.com/2013/11/23/concept-checking-in-c11/