Mercurial > projects > orange
diff orange/util/collection/Array.d @ 9:99c52d46822a
Serialization works now with D2, deserialization still doesn't work
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Sat, 24 Jul 2010 18:58:18 +0200 |
parents | 11a31bd929f9 |
children | fc315d786f24 |
line wrap: on
line diff
--- a/orange/util/collection/Array.d Wed Jul 21 13:44:08 2010 +0200 +++ b/orange/util/collection/Array.d Sat Jul 24 18:58:18 2010 +0200 @@ -358,14 +358,14 @@ * Throws: AssertException if the return value is less than -1 or * greater than the length of the array - 1. */ -U lastIndexOf (T, U = size_t) (T[] arr, T element) -in +version (Tango) { - assert(arr.length > 0, "mambo.collection.Array.lastIndexOf: The length of the array was 0"); -} -body -{ - version (Tango) + U lastIndexOf (T, U = size_t) (in T[] arr, T element) + in + { + assert(arr.length > 0, "mambo.collection.Array.lastIndexOf: The length of the array was 0"); + } + body { U index = tango.text.Util.locatePrior(arr, element); @@ -374,10 +374,18 @@ return index; } +} - else +else +{ + U lastIndexOf (T, U = size_t) (in T[] arr, dchar element) + in { - foreach_reverse (i, e ; arr) + assert(arr.length > 0, "mambo.collection.Array.lastIndexOf: The length of the array was 0"); + } + body + { + foreach_reverse (i, dchar e ; arr) if (e is element) return i;