Super-dee-duper D features
Bill Baxter
dnewsgroup at billbaxter.com
Tue Feb 13 16:31:32 PST 2007
kris wrote:
> kris wrote:
>> Bill Baxter wrote:
>>
>>> Frits van Bommel wrote:
>>>
>>>> By the way, would the new loop syntax allow more than two
>>>> collections to be simultaneously iterated?
>>>
>>>
>>>
>>> Whoa! I certainly hope so. It hadn't even occurred to me that
>>> Andrei might mean this syntax can only be used for just two
>>> collections. If that's the case then ... ick.
>>>
>>> --bb
>>
>>
>> InterleavedIterator does multiple collections via using multiple
>> instances of InterleavedIterator. It's simple to use, and only needs
>> to be written once. Would be better to implement some basic iterator
>> needs than to introduce some tricky new syntax?
>>
>> - Kris
>
>
> Should have given an example. Simple case with 2 entities:
>
> auto two = InterleavedInterator (x, y);
> foreach (x; two) ...
>
> more than 2:
>
> auto three = InterleavedInterator (two, z);
> foreach (x; three) ...
Should have also mentioned where one can find this mythical
InterleavedIterator.
--bb
More information about the Digitalmars-d
mailing list