diff base/src/java/lang/util.d @ 113:fb3aa8075988

D2 support for the linux port.
author Jacob Carlborg <doob@me.com>
date Wed, 06 Apr 2011 21:57:23 +0200
parents 9f4c18c268b2
children 536e43f63c81
line wrap: on
line diff
--- a/base/src/java/lang/util.d	Wed Mar 16 21:53:53 2011 +0900
+++ b/base/src/java/lang/util.d	Wed Apr 06 21:57:23 2011 +0200
@@ -216,8 +216,22 @@
 int arrayIndexOf(T)( T[] arr, T v ){
     int res = -1;
     int idx = 0;
-    foreach( p; arr ){
-        if( p == v){
+       
+    
+    static if (is(T == interface))
+    {
+        Object[] array = cast(Object[]) arr;
+        Object value = cast(Object) v;
+    }
+        
+    else
+    {
+        auto array = arr;
+        auto value = v;
+    }
+    
+    foreach( p; array ){
+        if( p == value){
             res = idx;
             break;
         }
@@ -253,4 +267,11 @@
     const ImportData getImportData = ImportData( cast(void[]) import(name), name );
 }
 
-
+template gshared (String content)
+{
+    version (D_Version2)
+        const gshared = "__gshared: " ~ content;
+        
+    else
+        const gshared = content;
+}