Foreach problem

Tim M a at b.com
Sun Jan 11 00:04:38 PST 2009


On Sun, 11 Jan 2009 20:31:51 +1300, Denis Koroskin <2korden at gmail.com>  
wrote:


>> Yep that probibly is a slight bug. What I would like to know is why  
>> cant I do foreach with primitive types like I can with objects.
>
> You can use foreach to iterate over arrays and tuples, if that's what  
> you mean. Iterating over over primitive types makes little sense.


Just re reading my own question I think it is clear what I meant. I meant  
array of primitives so yes iterating over an array, but an array of  
primitives. Dmd handles foreach over SomeObject[] a lot more relaxed than  
int[].




More information about the Digitalmars-d-learn mailing list