function-local template specialization error
    bearophile 
    bearophileHUGS at lycos.com
       
    Wed Jul 14 10:45:09 PDT 2010
    
    
  
canalpay:
> Thanks, But this example works:
> void main()
> {
>     T input(T)()
>     {}
> 
> }
> 
>  Why ?
You are right. Beside allowing nested functions (this is well known), it seems D2 also accepts the definition (with template constraint too) and instantiation of simple templates inside functions, I didn't know this.
But currently nested functions can't be overloaded. Probably for similar reasons inside a function you can't define more than one template with the same name. I presume this limit can be removed, so if you really need this you can ask for an enhancement request and if you can add a patch too to increase a bit the probability to see it fulfilled someday.
Bye,
bearophile
    
    
More information about the Digitalmars-d-learn
mailing list