Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

Changeset 3734

Show
Ignore:
Timestamp:
07/09/08 13:40:34 (5 months ago)
Author:
larsivi
Message:

Backport [3733]

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/next/0.99.7/tango/core/Traits.d

    r3690 r3734  
    173173} 
    174174 
    175  
    176 private template isStaticArrayTypeInst( T ) 
    177 { 
    178     const T isStaticArrayTypeInst = void; 
    179 } 
    180  
    181  
    182175/** 
    183176 * Evaluates to true if T is a static array type. 
    184177 */ 
    185 template isStaticArrayType( T ) 
    186 
    187     static if( is( typeof(T.length) ) && !is( typeof(T) == typeof(T.init) ) ) 
    188     { 
    189         const bool isStaticArrayType = is( T == typeof(T[0])[isStaticArrayTypeInst!(T).length] ); 
     178template isStaticArrayType(T : T[U], size_t U) 
     179
     180    const bool isStaticArrayType = true; 
     181
     182 
     183template isStaticArrayType(T) 
     184
     185    const bool isStaticArrayType = false; 
     186
     187 
     188debug (UnitTest) { 
     189 
     190    unittest { 
     191        assert(isStaticArrayType!(char[15])); 
     192        assert(!isStaticArrayType!(char[])); 
     193 
     194        assert(isDynamicArrayType!(char[])); 
     195        assert(!isDynamicArrayType!(char[15]));     
    190196    } 
    191     else 
    192     { 
    193         const bool isStaticArrayType = false; 
    194     } 
    195 
    196  
     197
    197198 
    198199/**