How to foreach over a DList?

Jeroen Bollen jbinero at gmail.com
Mon Mar 31 12:30:11 PDT 2014


On Monday, 31 March 2014 at 19:26:23 UTC, Jeroen Bollen wrote:
> On Monday, 31 March 2014 at 18:24:39 UTC, H. S. Teoh wrote:
>> On Mon, Mar 31, 2014 at 05:50:16PM +0000, Jeroen Bollen wrote:
>>> I am trying to foreach over a std.container.DList but it 
>>> isn't working. I
>>> have tried the following code:
>> [...]
>>
>> Maybe try using opSlice:
>>
>> 	DList myList;
>> 	foreach (e; myList[]) { ... }
>>
>> ?
>>
>>
>> T
>
> Can you explain that syntax?

nvm figured it out;

Are constant DLists supposed to be un-foreach-able?
Error: mutable method std.container.DList!(ubyte).DList.opSlice 
is not callable using a const object


More information about the Digitalmars-d-learn mailing list