static switch

cal callumenator at gmail.com
Mon Jun 11 23:13:40 PDT 2012


Does a switch statement acting on a template parameter act just 
like a chain of  static if-else's? That is, does it just generate 
the code for the matching case?

enum E { A, B, C }

class Blah(E param) {
   void foo() {
     switch(param) {
       case(E.A) : blah;
       case(E.B) : ....
       default:
     }
   }
}

Thanks,
cal


More information about the Digitalmars-d-learn mailing list