www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - InputRange Concatenation

reply =?UTF-8?B?Ik5vcmRsw7Z3Ig==?= <per.nordlow gmail.com> writes:
Is there a higher-order range pattern that concatenate two 
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
     }
Nov 23 2013
parent "Adam D. Ruppe" <destructionator gmail.com> writes:
On Saturday, 23 November 2013 at 23:39:12 UTC, Nordlöw wrote:
 Is there a higher-order range pattern that concatenate two 
 InputRanges?
Sounds like you need std.range.chain: http://dlang.org/phobos/std_range.html#chain
Nov 23 2013