www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - template instantiation in D

reply Druzhinin Alexandr <news digitalmars.com> writes:
Code is http://dpaste.dzfl.pl/73bd7002. And I can't understand why 
compiler instantiates SimpleFSM.execTransition!(), line #30 - I expected 
it would be instantiated only if template parameters were wrong, but it 
occurs always.
Does compiler instantiates ALL possible template specialization?
Sep 27 2012
parent Druzhinin Alexandr <news digitalmars.com> writes:
27.09.2012 22:48, Druzhinin Alexandr пишет:
 Code is http://dpaste.dzfl.pl/73bd7002. And I can't understand why
 compiler instantiates SimpleFSM.execTransition!(), line #30 - I expected
 it would be instantiated only if template parameters were wrong, but it
 occurs always.
 Does compiler instantiates ALL possible template specialization?

Oh, I've just understood my problem - because possibility of execTransition!() calling can be known only in run-time, compiler should instantionates it too, just in case. Good thing this newsgroup is, good thing )))
Sep 27 2012