Filtering generator outputs with adaptors

We've mentioned that the raw output of a generator is usually filtered through a single distribution in order to convert the generator's raw bits into usable data values. Interestingly, it is also possible to send a generator's output through a generator adaptor, which can reformat the raw bits in various, perhaps useful ways. The standard library provides three adaptors--std::discard_block_engine, std::shuffle_order_engine, and std::independent_bits_engine. These adaptor types work just like the container adaptors (such as std::stack) we discussed in Chapter 4, The Container Zoo--they provide a certain interface but delegate most of their implementation details to some other class.

An instance of ...

Get Mastering the C++17 STL 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.