On Tuesday, August 10, 2010 12:06:55 Mafi wrote: > Am 10.08.2010 18:22, schrieb Trass3r: > > Container has List, BinaryHeap etc. but no Queue. Is there anything like > > that in Phobos? > > Hi, > I don't know if ther is one but I think D's arrays are powerful enough > unless you avoid the GC. > > 1. a.front() => a[0] > 2. a.popFront() => a = a[1..$] > 3. a.pushBack(x) => a ~= x > > I think in phobos there must be front and popFront for arrays to make > them ranges but I don't know where.
If you want to treat an array like a range, use the functions in std.array. That's not a terribly cheap way to do things though since you keep resizing the array and will likely get a lot of reallocations. If efficiency isn't an issue, then it could be a nice, clean solution, but if efficiency is a priority, then that's probably not a good way to go. - Jonathan M Davis