Differences From Artifact [41ba420d0c49ce8d]:
- File
src/util.d
- 2012-07-15 07:02:32 - part of checkin [8acc8e6c78] on branch trunk - Prioritize distant lambda. (user: kinaba) [annotate]
- 2012-07-15 12:14:10 - part of checkin [e02668367d] on branch trunk - Revert redesign in the trunk. (user: kinaba) [annotate]
To Artifact [b76be1f6ad977d56]:
- File
src/util.d
- 2012-07-15 11:17:59 - part of checkin [ff0ab77d3d] on branch trunk - new game class. (user: kinaba) [annotate]
3 3 public import std.conv;
4 4 public import std.range;
5 5 public import std.stdio;
6 6 public import std.string;
7 7 public import std.typecons;
8 8 public import std.math;
9 9 import std.c.stdlib;
10 +
11 +T[] erase(T,V)(T[] xs, V y)
12 +{
13 + foreach(i,x; xs)
14 + if(x == y)
15 + return xs[0..i]~xs[i+1..$];
16 + return xs;
17 +}
10 18
11 19 // To avoide the following ICE:
12 20 // src\phobos\std\algorithm.d(4552):
13 21 // Error: function std.algorithm.count!("a == b",string,char).count
14 22 // compiler error, parameter 'value', bugzilla 2962?
15 23 // Assertion failure: '0' on line 717 in file 'glue.c'
16 24 int count(T,V)(T[] a, V v)