array depth template
    Saaa 
    empty at needmail.com
       
    Thu Jun 11 20:01:27 PDT 2009
    
    
  
>
> It's kind of the right idea, but.. it's also kind of weird.
>
> template ArrayDepth(T: T[]) { const ArrayDepth = 1 + ArrayDepth!(T); }
> template ArrayDepth(T)       { const ArrayDepth = 0; }
>
> This lets you get the depth of any array _type_, like
> ArrayDepth!(int[][]) gives 2.
Ah , that's how you make it do at compile time, using const.
BCS also did it a bit like me (one template that is) I just didn't know you 
could also just pass the type :D
Any advantage to using two?
He also does :  is( T B ==B[])  iso  is( T B:B[] )
Any significant difference there? 
    
    
More information about the Digitalmars-d-learn
mailing list