Understanding Views from the Ranges Library

Learn about lazy evaluation with Views in the Ranges Library and its importance in manipulating data.

Lazy evaluation with views in the Ranges library

Views in the Ranges library are lazy evaluated iterations over a range. Technically, they are only iterators with built-in logic, but syntactically, they provide a very pleasant syntax for many common operations.

The following is an example of how to use a view to square each number in a vector (via iteration):

Get hands-on with 1400+ tech skills courses.