comparison 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
comparison
equal deleted inserted replaced
112:9f4c18c268b2 113:fb3aa8075988
214 } 214 }
215 215
216 int arrayIndexOf(T)( T[] arr, T v ){ 216 int arrayIndexOf(T)( T[] arr, T v ){
217 int res = -1; 217 int res = -1;
218 int idx = 0; 218 int idx = 0;
219 foreach( p; arr ){ 219
220 if( p == v){ 220
221 static if (is(T == interface))
222 {
223 Object[] array = cast(Object[]) arr;
224 Object value = cast(Object) v;
225 }
226
227 else
228 {
229 auto array = arr;
230 auto value = v;
231 }
232
233 foreach( p; array ){
234 if( p == value){
221 res = idx; 235 res = idx;
222 break; 236 break;
223 } 237 }
224 idx++; 238 idx++;
225 } 239 }
251 265
252 template getImportData(String name ){ 266 template getImportData(String name ){
253 const ImportData getImportData = ImportData( cast(void[]) import(name), name ); 267 const ImportData getImportData = ImportData( cast(void[]) import(name), name );
254 } 268 }
255 269
256 270 template gshared (String content)
271 {
272 version (D_Version2)
273 const gshared = "__gshared: " ~ content;
274
275 else
276 const gshared = content;
277 }