Recursive expansion

Henning Pohl henning at still-hidden.de
Fri Aug 17 15:23:52 PDT 2012


On Friday, 17 August 2012 at 22:01:42 UTC, Jonathan M Davis wrote:
> On Friday, August 17, 2012 23:45:49 Henning Pohl wrote:
>> I've ended up with a TypeTuple storing 1230 auto-generated 
>> types.
>> Now the compiler claims there is a recursive template 
>> expansion.
>> How to stir him from his resolve?
>
> I believe that if a particular template is ever instantiated 
> more than 50
> times recursively, the compiler will error out on the 
> assumption that it's hit
> infinite recursion (it has to bottom out eventually, or would 
> just end up
> running until it ran out of memory if it actually does hit 
> infinite recursion;
> I don't know how arbitrary the choice of 50 was). So, the 
> TypeTuple itself
> shouldn't be a problem (e.g. you should be able to use foreach 
> on it just
> fine), but template instantiations will be a problem if you try 
> and go through
> the whole TypeTuple recursively.
>
> - Jonathan M Davis

Damn, I just ran out of memory using ~ 550 types. DMD was 
flooding my 8GB RAM like in 5 seconds. Fortunately I could kill 
DMD just in time.

So there have to be another solution.

I want to store lots (~615) dynamically loaded function pointers 
in a class and call them using opDispatch. To provide a type-safe 
function call, the types of the functions have to be stored 
somewhere, in a TypeTuple.

Maybe you can help me how this could be done.


More information about the Digitalmars-d-learn mailing list