How to foreach over a DList?

Jeroen Bollen jbinero at gmail.com
Mon Mar 31 22:32:55 PDT 2014


Still no luck:

import std.container;
import std.stdio;

void main()
{
	DList!ubyte list1 = DList!ubyte();
	list1 ~= cast(ubyte) 1;
	list1 ~= cast(ubyte) 2;
	list1 ~= cast(ubyte) 3;

	foreach(ubyte item; list1[]) {
		writeln(item);
	}
}

/usr/include/dlang/dmd/std/container.d(1874): Error: no property 
'_first' for type 'ubyte'
/usr/include/dlang/dmd/std/container.d(1875): Error: no property 
'_first' for type 'ubyte'
/usr/include/dlang/dmd/std/container.d(1875): Error: undefined 
identifier rhs_, did you mean variable rhs?
source/app.d(7): Error: template instance 
std.container.DList!ubyte.DList.opOpAssign!("~", ubyte) error 
instantiating
source/app.d(7): Error: cannot append type ubyte to type 
DList!ubyte


More information about the Digitalmars-d-learn mailing list