...

/

Expression Templates

Expression Templates

In this lesson, we'll study expression templates in detail.

Expression Templates

Expression templates are “structures representing a computation at compile-time, which are evaluated only as needed to produce efficient code for the entire computation.”

Now we are at the center of lazy evaluation.

Lazy Evaluation

The story about lazy evaluation in C++ is quite short. That will change in C++20, with the ranges library from Eric Niebler. Lazy evaluation is the default in Haskell. Lazy evaluation means that an expression is only evaluated when needed.

This strategy has two benefits.

  • Lazy evaluation helps you to
...