Walletfox.com

Fully Functional C++ with Range-v3

3rd edition, April 2023

This page lists the most important changes that were made in the third edition of the book Fully Functional C++ with Range-v3.


Compiler change

Instead of Wandbox, please use Godbolt with gcc 12.2 and range-v3 enabled or this setting to compile the examples from the book.

Major content changes

We have added 6 short examples and 6 one-page examples mostly focused on the practical use of views::partial_sum, views::exclusive_scan, views::cycle, views::repeat, original use of views::stride and the problem of non-uniformly sized grouping or selection. These include:

Short examples
  • Star numbers
  • Arithmetic sequence 385
  • Least common multiple
  • Meeting overlaps
  • Decimal to binary
  • Continued fraction
Long examples
  • Balanced parentheses
  • Runsums
  • Rail fence cipher
  • Non-uniform chunks
  • Convert seconds to compound duration
  • Linear convolution 1D
Exercises
  • Capitalize every N-th letter
  • Morse numerals
  • de Bruijn sequence
  • Thousands separator
  • Pair-wise swap
  • Cryptarithm

Other content changes

  • We have updated the links with A Plan for C++23 Ranges by Barry Revzin and removed the no-longer existing article A Prime Opportunity for Ranges by Christopher di Bella.
  • The section on Range-v3 vs C++ Ranges has been updated to list major name changes, as well as essential but still missing views in C++23.
  • Due to very low priority of actions in the plan for C++23, we have removed actions from the printed book. You can still find them on the accompanying website.
  • CamelCase to snake_case example now uses views::chunk_by instead of views::tokenize.

Other changes related to developments in C++23

  • We have globally replaced views::group_by by views::chunk_by.
  • Unlike views::filter, views::remove_if is not available in C++20. As a result, we have mostly replaced views::remove_if by views::filter. Think of views::filter as KEEP.

Other smaller corrections

  • Return type of std::isdigit is now explicitly stated as bool for all comparisons.
  • Geometric sequence is generated using a simpler construct views::transform (1 << x) on views::iota(0).
  • Instead of a failed assertions, drop_last(x) now returns an empty view [] if x is greater than the size of the range.

Online additions

  • Maximum sum descent was added into quizzers.

Tagged: Range-v3