Nordlöw
Nordlöw

Reputation: 12138

InputRange Concatenation

Is there a higher-order range pattern that concatenates two or more InputRanges?

Something like

foreach (e; a) {
    // do stuff with e
}
foreach (e; b) {
    // do stuff with e
}
...

should instead be written as

foreach (e; someMagic(a, b, ...)) {
    // do stuff with e
}

Upvotes: 3

Views: 55

Answers (1)

Adam D. Ruppe
Adam D. Ruppe

Reputation: 25595

someMagic is chain from std.range: http://dlang.org/phobos/std_range.html#chain

Upvotes: 6

Related Questions