Is there a way to create compile-time delegates?
    Simen kjaeraas 
    simen.kjaras at gmail.com
       
    Mon Jul 19 12:06:27 PDT 2010
    
    
  
Yeah, what the subject says.
I want to have a default delegate for a struct, and without a default
constructor, this has to be a compile-time constant. Now, logically,
there should be nothing wrong with storing the function pointer and a
null context pointer at compile-time, but it seems there is. Any ideas?
struct foo {
     void delegate( ) dg = () {}; // Error: non-constant expression
                                  // __dgliteral1
}
-- 
Simen
    
    
More information about the Digitalmars-d-learn
mailing list