Eponymous Aggregates
    Simen Kjaeraas 
    simen.kjaras at gmail.com
       
    Sat Aug 10 09:42:53 PDT 2013
    
    
  
On 2013-08-10, 14:58, JS wrote:
> e.g.,
>
> interface A
> {
>      static T A(T)() { ... }
> }
>
> can be used as A!T instead of A.A!T. Same for classes and structs. If  
> you want a use case I'm not going to stop you from coming up with one...  
> so feel free.
Tried with DMD 2.063.2, and I'm unable to make A!T compile. Are you sure
you've written the code you intended to?
For reference, this is the code I tried:
interface A {
     static T A(T)() {
         return T.init;
     }
}
void main() {
     A!int a;        // Error: template instance A!(int) A is not a  
template declaration, it is a interface
     auto b = A!int; // Error: template instance A!(int) A is not a  
template declaration, it is a interface
}
This code, of course, works:
template A(T) {
     interface A {
     }
}
void main() {
     A!int a;
}
    
    
More information about the Digitalmars-d
mailing list