C++0x strongly typed enums

Jay I. jay.27182818@gmail.com
Sat Apr 18 22:44:00 GMT 2009


as far as i know things inside enum are placed in the same scope where
you put enum itself. this example compiles fine:

enum{
 CONST_1=1, CONST_2=2 // global scope
};

int main(){
  int x=CONST_1+CONST_2;
  return 0;
}

i use enums with structures like this:

struct options{
  enum{
    opt_1,opt_2,opt_3
  };
};

...

int x=options::opt_1+options::opt_2;

regards,
jay



More information about the Gcc-help mailing list