D Language Ranges

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Remarks

If a foreach is encountered by the compiler

foreach (element; range) {

it's internally rewritten similar to the following:

for (auto it = range; !it.empty; it.popFront()) {
    auto element = it.front;
    ...
}

Any object which fulfills the above interface is called an input range and is thus a type that can be iterated over:

struct InputRange {
    @property bool empty();
    @property T front();
    void popFront();
}


Got any D Language Question?