www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Template Instantiation

How is the sequence of instantiations determined in case of entwined 
definitions of templates?

Example:

template Mapping( uint n, Value){
  static if( n == 0){
    pragma( msg, "map n==0");
    alias E!(  Value, DATA) Mapping;
  } else {
    pragma( msg, "map n>0");
    alias E!( Mapping!( n -1, Value), MGR) Mapping;
  }
}

In which sequence will the instantiation

  alias Mapping!(3, int) Map;
  auto v= new Map;

cause the template E to be instantiated?

I ask this because on slight modifications I got errors, that E wasn't 
instantiated.

-manfred
Jun 28 2008