Fully Functional C++ with Range-v3

Now with online quizzes.

Functional programming is coming to C++.
Embrace new challenges with this
down-to-earth compact manual and develop a radically different way of thinking with C++ and its Range-v3 library.

Instant PDF
39.95 CHF
PDF + Print Book
54.95 CHF

Format: Color A5 paperback
International shipping is included in the final price.

What is it all about

Do you like C++ but miss the possibility to express ideas in an abstract manner without going into the details of the control flow?

This is just the book you need. Accompanied by visual cues, it lets you explore functional programming notions using the C++ Range-v3 library. In mere 72 pages you are guaranteed to gain fresh insights and develop a new train of thought.

Straight to the point

No setup necessary thanks to an online compiler. Succinct and practical one-page examples.

Plenty of practice

60 little drills, 27 fully-elaborated examples, 20 exercises with solutions, 5 online quizzes and quick reference.

High-level focus

Challenges you to think in terms of logic, rather than in terms of control flow.

What is Range-v3?

The C++ Range-v3 library, authored by Eric Niebler and Casey Carter, is the predecessor of C++20 Ranges. The library brings C++ to a whole new level, introducing a simpler algorithmic API, composition and on-demand evaluation. This will allow for code that is easier to reason about, test and parallelize.

What is inside this book?


We will start our journey with an introduction to the range-v3 library where you will learn about its main pillar - views - and how they relate to the functional programming notions of higher-order functions, composition and on-demand evaluation. We will be working with an online compiler.


60 little drills Here you will learn to accomplish small tasks. We will generate, transform, zip, accumulate and filter ranges. We will discover useful one-to-many and one-to-many transformations, we will group, chunk, slide, join and concatenate. At the end, we will get down to input, output and range comprehensions.


Example guide

27 practical examples This is a solid collection of 8 shorter examples, such as Hamming distance, Approximation of Pi and 11 full-page examples, such as Fizz Buzz and Luhn algorithm. These are followed by 3 longer advanced examples that handle input, user-defined objects and std::optional. To top it off, there are 5 examples of range comprehensions. See the full list of examples in the Table Of Contents. All the examples are complemented by visual cues to help you spot patterns and aid your learning process.



20 exercises with solutions You will practice what you learned on a series of exercises. We will be generating unusual sequences, narcissistic numbers and determining probabilities. We will be solving geometric problems and discovering some interesting uses of grouping. You won't be on your own, since we provided the source code of the solutions with basic commentary.

Quick reference

70 views, 22 actions A great part of this section is dedicated to views and their common uses. Thanks to this, you will be able to experiment with less frequently used views of the range-v3 library and perhaps come up with your very own patterns. In addition, you will find here an essential selection of range algorithms, iterators and accessors.



5 quizzers, 25 multiple choice questions The companion website contains quizzers, i.e. longer interactive exercises that let you practice Range-v3 and challenge you on the following topics:


Each quizzer consists of 5 multiple-choice questions related to the example and a little exercise to consolidate your knowledge.

Range-v3 quizzer

The format readers like

3 out of 5 of customers opt for the Instant PDF + Print Book.


Questions you might have

What is the format and contents of this book?

The print book has a small compact A5 format, i.e. 148 x 210 mm or 5.8 x 8.3 inches and consists of 72 full color pages on satin-coated paper. There are five sections - Basics, Drill, Example guide, Practice and Quick reference. Visual cues, such as icons and colors, are used to help you identify and remember commonly occuring functional programming patterns. The book has a modern design, in coherence with the philosophy of modern C++. The book comes with the full source code of the examples and exercises published on the companion website.

Why isn't this a book on Ranges in C+20?

As of now, range-v3 is contains many convenience views that won't be incorporated into C++20. Zipping was omitted from C++20 due to issues with proxy iterators and partial specializations (std::vector<bool>). Furthermore, some very useful views that can take care of cyclicity, grouping, striding, sliding etc. won't be part of C++20.

Is this an official Range-v3 manual?

This book employs the range-v3 library to present practical examples, as such, it's not a substitute for an official documentation. Notwithstanding that, the book contains a Quick reference guide that covers common uses of 70 views currently implemented in the range-v3 library (except for views::common and views::ref). Changes do appear on a regular basis, hence you are advised to consult the github account of the range-v3, the website of Eric Niebler or Stackoverflow range-v3 topics.

Can I benefit from this book if I don't know C++?

Yes. The high-level notions presented in this book can be applied to other programming languages. The book has been read through and understood well by a non C++ developer. A word of caution, though. If you plan to proceed with C++, inform yourself about undefined behavior. The book shows, that it's not difficult to run into dangling references if the idea behind views isn't well understood.

Will I learn about monads in this book?

No. C++ doesn't provide much support for monads at this point. As far as side effects are concerned, we currently use std::optional to handle absence of a meaningful value, e.g. an unsuccessful search or a failed conversion.

Are the examples presented in this book optimised for speed?

In C++ we normally care about performance, but it's too early for optimizations. The aim is to develop high-level thinking, premature optimization would obscure the intent. Commonly used patterns will be eventually optimised by compilers.

Do I need to understand C++20 Concepts to follow this book?

The focus of this book is on practical examples and high-level API, as a result C++20 Concepts aren't part of this book. Nevertheless, you will occassionally find examples, where your views won't compose, as they differ in the constraints they place on the underlying range algorithms, in other words, they differ in Concepts (C++20). To take care of such cases, in this book, we resorted to materialization, i.e. an intermediate conversion to an STL container.

Is this book available on Amazon?

This is a small series and currently there are no plans to market it through large online resellers such as Amazon.

I purchased the PDF, can I still order the Print Book?

If you already purchased the PDF and would like to purchase the Print Book, send us an email with your order reference number. You will get a one-time link using which you can order the Print Book.

Why do I pay a premium price for an A5 book?

The most powerful messages are concise. This is not just a book but a mighty companion on your functional programming journey. Thanks to its superior design, the book delivers results in no time. Furthermore, you get access to the companion website with quizzers that will help you effortlessly consolidate your knowledge.

Information on orders / shipping


The shipping is included in the listed price. Your book will be shipped in a protective B5 cardboard envelope via the Swiss Post International ECONOMY mail. Allow approximately

  • 1 - 2 days for Switzerland
  • 7 - 10 days for European countries
  • 7 - 14 days for the US
  • 10 - 20 days for the rest of the world

Attention: Exceptionally some countries (such as India) might levy an import tax on the physical part of the consignment.

Communicate via email before making the following orders

  • If you wish to order three or more items.
  • If you are a VAT registered business / institution registered in the EU, i.e. eligible for the deduction of the national VAT rate for digital products under the reverse charge rule.
  • If you ordered a PDF and decided that you would also like the Print book.



Get Started Now

Instant PDF
39.95 CHF
PDF + Print Book
54.95 CHF

International shipping included