Getting equivalent elements in a range/array

2011-05-07 Thread Andrej M.
I want to turn this: auto arr = [1, 1, 2, 3, 4, 4]; into this: auto arr2 = [[1, 1], [2], [3], [4, 4]]; I want an array of arrays of the same elements. Lazy or not, I don't care. I thought I could get away with this inside some while loop: auto equals = array(filter!a == b(arr)); arr =

Removing an object from a range

2010-12-12 Thread Andrej M.
I can't seem to find an easy remove method in std.algorithm that takes an object and a range (an array in this case) and removes any matches from the range. I'm using this snippet for now: private DrawingElement[] elements; public override void Remove(DrawingElement d) { foreach (i, child;