Search⌘ K

Introduction and History

Explore the concept of ranges in D, focusing on how they abstract data access through member functions like empty, front, and popFront. Understand container and algorithm definitions, and discover how D's ranges improve upon C++ iterators for flexible data processing.

We'll cover the following...

Ranges

Ranges of algorithms over a great number of container types. Ranges emphasize how container elements are accessed, as opposed to how the containers are implemented.

Ranges are a very simple concept that is based on whether a type defines certain sets of member functions. We have already covered this concept in the foreach with structs and classes chapter: any type that provides the member functions empty, front, and popFront() can be used with the foreach loop. The set of those three member functions is ...