Changeset 248

Show
Ignore:
Timestamp:
02/20/10 02:59:30 (2 years ago)
Author:
walter
Message:

add AssociativeArray?.get()

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/import/object.di

    r247 r248  
    354354    return &opApply; 
    355355    } 
     356 
     357    Value get(Key key, lazy Value defaultValue) 
     358    { 
     359    auto p = key in *cast(Value[Key]*)(&p); 
     360    return p ? *p : defaultValue; 
     361    } 
    356362} 
    357363 
  • trunk/src/object_.d

    r247 r248  
    21262126    { 
    21272127    return &opApply; 
     2128    } 
     2129 
     2130    Value get(Key key, lazy Value defaultValue) 
     2131    { 
     2132    auto p = key in *cast(Value[Key]*)(&p); 
     2133    return p ? *p : defaultValue; 
    21282134    } 
    21292135}